Bug 92377 - Code generated with "bison -y" fails with g++
Code generated with "bison -y" fails with g++
Status: CLOSED DUPLICATE of bug 92262
Product: Red Hat Raw Hide
Classification: Retired
Component: bison (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Roland McGrath
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-06-05 12:22 EDT by John Ellson
Modified: 2007-04-18 12:54 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-02-21 13:53:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Ellson 2003-06-05 12:22:21 EDT
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.
Comment 1 John Ellson 2003-06-05 12:57:58 EDT
Also fails with g++ from today's gcc-3.3-4
Comment 2 Chris Chabot 2003-06-09 09:40:00 EDT
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)
Comment 3 Bill Nottingham 2003-07-24 18:49:04 EDT

*** This bug has been marked as a duplicate of 92262 ***
Comment 4 Red Hat Bugzilla 2006-02-21 13:53:28 EST
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

Note You need to log in before you can comment on or make changes to this bug.