Red Hat Bugzilla – Bug 30943
Compiling flex++ generated C++ source with -Wall produces warnings
Last modified: 2015-05-04 21:32:03 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [de] (X11; U; Linux 2.2.17-14 i686)
flex++ generated code doesn't fit to other warning free sources.
Steps to Reproduce:
1.Translate a lex .ll input file with flex++
2.Compile the generated lex.yy.cc source with g++ -Wall
3.Some warnings are produced.
Actual Results: lex.yy.cc: In method `int yyFlexLexer::yylex ()':
lex.yy.cc:601: warning: label `find_rule' defined but not used
/usr/include/g++-3/stl_map.h: At top level:
lex.yy.cc:1508: warning: `void *yy_flex_realloc (void *, unsigned int)'
defined but not used
Expected Results: No warnings
I use the map template class and other features of the STL/libstdc++.
This is fixed in the rawhide/beta flex package, AFAIK.
No, it isn't. I tried it with flex-2.5.4a-13 from ftp.redhat.com/rawhide. It
produces the same warnings.
Another point: could you add bison++ to the Red Hat distribution? flex++ doesn't
make much sense without bison++. I had to use the Mandrake RPM
bison++-1.21.7-2mdk, but would like to see it full-supported in my favorite
distribution. It's a must for the serious developer.
I just wanted to add that this is not fixed in flex-2.5.4a-26.
This warning appears when plain flex is used, not only flex++.
The warning doesn't appear (for me) if I don't use a REJECT directive in the
I'll attach an example of the scanner that exibits the problem.
Created attachment 70964 [details]
Simple scanner - testcase for a bug
Created attachment 70966 [details]
Forgotten piece of a scanner
Apologies for this getting lost in the shuffle. Could you try this on
a current release?
$ flex parser.l
$ cc -c -Wall lex.yy.c
lex.yy.c:1768: warning: 'yy_flex_realloc' defined but not used
$ rpm -q flex
Not a big problem of course.
From User-Agent: XML-RPC
flex-2.5.4a-35.fc4 has been pushed for FC4, which should resolve this issue. If these problems are still present in this version, then please make note of it in this bug report.