[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#504684: gcc-4.3: __attribute__((const)) breaks __attribute__((warn_unused_result))



Package: gcc-4.3
Version: 4.3.2-1
Severity: normal

Making a function __attribute__((const)) makes the warnings from
__attribute__((warn_unused_result)) go away.

I've attached a minimal testcase.  Results:

$ echo == USE_CONST == ; gcc -DUSE_CONST -c test.c -o /dev/null ; echo == \!USE_CONST == ; gcc -c test.c -o /dev/null
== USE_CONST ==
== !USE_CONST ==
test.c: In function ‘update_rocket_state’:
test.c:14: warning: ignoring return value of ‘func’, declared with attribute warn_unused_result

- Josh Triplett and Jamey Sharp

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.27-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.3 depends on:
ii  binutils            2.18.1~cvs20080103-7 The GNU assembler, linker and bina
ii  cpp-4.3             4.3.2-1              The GNU C preprocessor
ii  gcc-4.3-base        4.3.2-1              The GNU Compiler Collection (base 
ii  libc6               2.7-16               GNU C Library: Shared libraries
ii  libgcc1             1:4.3.2-1            GCC support library
ii  libgomp1            4.3.2-1              GCC OpenMP (GOMP) support library

Versions of packages gcc-4.3 recommends:
ii  libc6-dev                     2.7-16     GNU C Library: Development Librari

Versions of packages gcc-4.3 suggests:
pn  gcc-4.3-doc                   <none>     (no description available)
pn  gcc-4.3-locales               <none>     (no description available)
ii  gcc-4.3-multilib              4.3.2-1    The GNU C compiler (multilib files
pn  libgcc1-dbg                   <none>     (no description available)
pn  libgomp1-dbg                  <none>     (no description available)
pn  libmudflap0-4.3-dev           <none>     (no description available)
pn  libmudflap0-dbg               <none>     (no description available)

-- no debconf information
#ifdef USE_CONST
int func(void) __attribute__((const)) __attribute__((warn_unused_result));
#else
int func(void) __attribute__((warn_unused_result));
#endif

void update_rocket_state(void)
{
 func();
}

Reply to: