bug-bison
[Top][All Lists]
Advanced

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

bison-1.875 and g++ >= 3.3: parser error before 'goto' (patch included)


From: Matthias Kilian
Subject: bison-1.875 and g++ >= 3.3: parser error before 'goto' (patch included)
Date: Sun, 18 Jan 2004 13:01:47 +0100
User-agent: Mutt/1.3.28i

Hi!

When trying to build Lilypond, I encountered an error within the warning
suppression at the probably unused label yyerrlab1. To reproduce the error,
take the attached file `calc.y' (from the bison documentation), and then:

$ bison calc.y 
$ g++ -c calc.tab.c 
calc.tab.c: In function `int yyparse()':
calc.tab.c:1156: parse error before `goto'

The following micro-patch to yacc.c seems to fix that:

diff -rNu ../bison-1.875/data/yacc.c ./data/yacc.c
--- ../bison-1.875/data/yacc.c  2002-12-28 09:36:02.000000000 +0100
+++ ./data/yacc.c       2004-01-18 12:22:00.000000000 +0100
@@ -1114,7 +1114,7 @@
   /* Suppress GCC warning that yyerrlab1 is unused when no action
      invokes YYERROR.  */
 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
-  __attribute__ ((__unused__))
+  __attribute__ ((__unused__));
 #endif
 
 ]b4_location_if([  yylerrsp = yylsp;

However, g++ still complains about an unused label `yyerror'.

$ bison --version | sed 1q
bison (GNU Bison) 1.875
$ gcc --version | sed 1q
gcc (GCC) 3.3.2

Regards,
        Kili

Attachment: calc.y
Description: Text document

Attachment: calc.tab.c
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]