Bert Wesarg, le Fri 26 Mar 2010 11:09:05 +0100, a écrit :
> AFAIK the correct usage would be:
> 
>          int square(int __attribute__ ((__unused__)) arg1, int arg2) {
> return arg2; }
> 
> I.e. the attribute is between type and name.

Do you have a reference on this?  For variables, the gcc manual always
puts them after the name, and in the source code of gcc itself I see it
there almost all the time... Also, there is an issue with e.g.

void f(void * __attribute__((unused)) p) {
}

The following

void f(void __attribute__((unused)) * p) {
}

does pass, but looks odd to me: it's not the data pointed by p that we
want to qualify as unused... Which ones of the above pass with your gcc?

> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.1-4ubuntu9'

€ gcc --version
gcc (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)
€ gcc --version
gcc (Debian 4.3.4-5) 4.3.4
€ gcc-4.5 --version
gcc-4.5 (Debian 4.5-20100202-1) 4.5.0 20100202 (experimental) [trunk revision 
156452]
$ gcc --version
gcc (GCC) 3.4.6     (on solaris)
$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
$ gcc --version
gcc (GCC) 4.0.2     (on AIX)

All these don't have any problem with the above.  This really looks
to me like a bug introduced by Ubuntu, probably along their agressive
fortifying policies.

Samuel

Reply via email to