[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
1.875: can't compile output with g++-2.95.3
From: |
Scott McPeak |
Subject: |
1.875: can't compile output with g++-2.95.3 |
Date: |
Wed, 8 Jan 2003 09:53:29 -0800 (PST) |
With bison-1.875 on linux, I can't compile bison's output using
g++-2.95.3. In the past I've been able to simply compile bison's output
with a C++ compiler by adding necessary prototypes to the top, but with
1.875 a parse error prevents such a simple solution.
With the enclosed Makefile and foo.y input, 'make' produces:
$ make
bison foo.y
mv -f foo.tab.c foo.tab.cc
g++ foo.tab.cc
foo.tab.c: In function `int yyparse()':
foo.tab.c:1149: parse error before `goto'
make: *** [foo] Error 1
The problem is this sequence from the skeleton parser:
/* Suppress GCC warning that yyerrlab1 is unused when no action
invokes YYERROR. */
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
__attribute__ ((__unused__))
#endif
gcc may accept this, but g++ does not. An alternative solution that seems
to achieve the goal of this passage and be acceptable to g++ is to insert
"goto yyerrlab1;" just above "yyerrlab1:".
-Scott
foo.y
Description: Text document
Makefile
Description: Text document
- 1.875: can't compile output with g++-2.95.3,
Scott McPeak <=