Description of problem: Code generated with "bison -y" fails with g++ The problem originates from the fragment: /usr/share/bison/yacc.c:1116 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) __attribute__ ((__unused__)) #endif The "__attribute__ ((__unused__))" feature is supported by gcc, but apparently not by g++. Version-Release number of selected component (if applicable): bison-1.875-2 gcc-3.2.3-4 How reproducible: 100% Steps to Reproduce: 1. --- test.c --- int main() { yyerrlab1: __attribute__ ((__unused__)) goto yyerrlab2; yyerrlab2: return(0); } 2. gcc -Wall test.c 3. g++ -Wall test.c Actual results: gcc OK g++ fails with: test.c: In function `int main()': test.c:4: syntax error before `goto' test.c:5: warning: label `yyerrlab2' defined but not used test.c:2: warning: label `yyerrlab1' defined but not used Expected results: Either g++ should support __attribute__ in the same way as gcc, or yacc.c should take account of the different behavior. Additional info: g++296 fails in the same way. Problem does not occur with bison-1.35-4, from RH8.0, which had bison.simple instead of yacc.c.
Also fails with g++ from today's gcc-3.3-4
Verified that it also happens for me on RH9 and rawhide-current (20030609) with gcc-3.3-5 and bison-1.875. Commenting out the macro from yacc.c is a workaround i gues (ran into the problem while compiling groff)
*** This bug has been marked as a duplicate of 92262 ***
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.