g++: __attribute__ ((unused)) in function definition
Andrew Pinski
pinskia@physics.uc.edu
Wed Jan 23 05:59:00 GMT 2002
This has been fixed on the mainline of the cvs version of gcc (3.1);
I don't know if it will or was back ported to gcc 3.0 for gcc 3.0.4.
Thanks,
Andrew Pinski
On Wednesday, January 23, 2002, at 08:52 , Lane, Roy wrote:
> Hi,
>
> This looks like a bug to me (sorry if it's already a known problem):
>
>> cat -> xx.c
> int main(int argc __attribute__ ((unused))) { int x; x = x + 1; return
> (1); }
>> gcc -c -Wall -W xx.c
>> mv xx.c xx.cxx
>> g++ -c -Wall -W xx.cxx
> xx.cxx:1: parse error before `__attribute__'
> xx.cxx: In function `int main(...)':
> xx.cxx:1: ISO C++ forbids declaration of `x' with no type
> xx.cxx:1: parse error before `return'
>
> ^^^ looks like g++ isn't recognizing __attribute__ in function
> parameter.
> gcc handles this correctly (as shown above)
>
> environment:
>
>> gcc -v
>
> Reading specs from
> /cadsrv/proj14/gcc/opt/TWWfsw/gcc302/bin/../lib/gcc-lib/alpha-dec-osf4.0
> d/3.0.2/specs
> Configured with: ../configure --enable-nls --with-included-gettext
> --enable-shared --enable-libgcj --enable-threads
> --prefix=/opt/TWWfsw/gcc302 --with-local-prefix=/opt/TWWfsw/gcc302
> Thread model: single
> gcc version 3.0.2
>
>> g++ -v
>
> Reading specs from
> /cadsrv/proj14/gcc/opt/TWWfsw/gcc302/bin/../lib/gcc-lib/alpha-dec-osf4.0
> d/3.0.2/specs
> Configured with: ../configure --enable-nls --with-included-gettext
> --enable-shared --enable-libgcj --enable-threads
> --prefix=/opt/TWWfsw/gcc302 --with-local-prefix=/opt/TWWfsw/gcc302
> Thread model: single
> gcc version 3.0.2
>
>> uname -a
>
> OSF1 ... V4.0 1229 alpha
>
> thanks,
>
> Roy
>
>
More information about the Gcc-bugs
mailing list