SWIG compilation failing because of C++ style comment (#1795)

Rocco Meli <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <[email protected]>
Hi,
I tried to compile the latest version of SWIG with the latest version of bison 3.6 and I get the following error:


make[1]: Entering directory 'XXX/swig/Source'
make  all-am
make[2]: Entering directory 'XXX/swig/Source'
depbase=`echo CParse/parser.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H   -I../Source/Include -I../Source/CParse -I../Source/Include -I../Source/DOH -I../Source/CParse -I../Source/Doxygen -I../Source/Preprocessor -I../Source/Swig -I../Source/Modules   -g -O2 -Wall -W -ansi -pedantic -MT CParse/parser.o -MD -MP -MF $depbase.Tpo -c -o CParse/parser.o CParse/parser.c &&\
mv -f $depbase.Tpo $depbase.Po
CParse/parser.c: In function ‘yyparse’:
CParse/parser.c:13053:3: error: C++ style comments are not allowed in ISO C90
   // Pop stack until we find a state that shifts the error token.
   ^
CParse/parser.c:13053:3: error: (this will be reported only once per input file)
Makefile:930: recipe for target 'CParse/parser.o' failed
make[2]: *** [CParse/parser.o] Error 1
make[2]: Leaving directory 'XXX/swig/Source'
Makefile:599: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory 'XXX/swig/Source'
Makefile:37: recipe for target 'source' failed
make: *** [source] Error 2

This is due to the fact that a C++ style comment is used in a .c file and SWIG compiles with the —pedantic option. Since the comment in parser.c does not come from SWIG’s parser.y, this might be a problem with bison.

I opened the following issue on SWIG as well: https://github.com/swig/swig/issues/1795

Best wishes,
Rocco Meli
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.