Bug 242742
Summary: | flex broken for %option noyywrap, yyclass, prefix | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jay Berkenbilt <ejb> | ||||||||
Component: | flex | Assignee: | Petr Machata <pmachata> | ||||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | |||||||||
Severity: | low | Docs Contact: | |||||||||
Priority: | low | ||||||||||
Version: | 7 | CC: | ejb, mnewsome, srinivas.aji, xjakub | ||||||||
Target Milestone: | --- | Keywords: | Reopened | ||||||||
Target Release: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | Linux | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | 2.5.33-9.fc7 | Doc Type: | Bug Fix | ||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2009-02-10 21:28:39 UTC | Type: | --- | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description
Jay Berkenbilt
2007-06-05 15:57:22 UTC
Created attachment 156239 [details]
tarfile containing example.fl and ExampleLexer.hh
I am seeing this issue too. From the flex code and the patch, it looks like the problem is this. All the symbols being #defined in flex-2.5.33-yy.patch are being modified with specified prefix only in C mode, not in C++ mode. In C mode, with noyywrap, we are okay since the output file later defines Prefix_wrap(n) rather than redifining yywrap. But in C++ mode, this leads to a redefinition of yywrap. Solution would be to surround the lines introduced by this patch with %if-c-only, %endif, (directly for flex.skl and strings of these for skel.c) since they don't seem to be useful for C++ mode anyway. I will attach a suitably modified 2.5.33-yy.patch after I test it. Created attachment 157163 [details] A modified flex-2.5.33-yy.patch which fixes this issue for me. Diff from the earlier patch is: $ diff flex-2.5.33-yy.patch flex-2.5.33-yy-fix.patch 4c4 < @@ -54,6 +54,32 @@ m4_changequote([[, ]]) --- > @@ -54,6 +54,34 @@ m4_changequote([[, ]]) 9a10 > +%if-c-only 31a33 > +%endif 40c42 < @@ -59,6 +59,32 @@ const char *skel[] = { --- > @@ -59,6 +59,34 @@ const char *skel[] = { 45a48 > + "%if-c-only", 67a71 > + "%endif", I applied fix and built new package. It should hit the repository in several days. Thanks for patch! flex-2.5.33-9.fc7 has been pushed to the Fedora 7 stable repository. If problems still persist, please make note of it in this bug report. Please could you reintroduce this patch (and try to move it upstream)? This problem still persists with flex in F10. The patch was dropped because upstream contains the code. And indeed, F-10 version seems to work for me: $ ~/fedora/flex/F-10/flex-2.5.35/flex -+ -o FlexLexer.example.cc example.fl $ g++ -c -I. FlexLexer.example.cc Created attachment 331314 [details] Simple test file Hm, for the example.fl file it works, but look at the simple file I've attached (plain.l): >flex -o plain.c plain.l >gcc plain.c plain.l:4:1: warning: "plainwrap" redefined plain.c:354:1: warning: this is the location of the previous definition [...the rest of output is not important] Maybe it's because we build a C scanner, not C++? Your file contains the "%option noyywrap" directive: """If you do not supply your own version of `yywrap()', then you must either use `%option noyywrap' (in which case the scanner behaves as though `yywrap()' returned 1), or you must link with `-lfl' to obtain the default version of the routine, which always returns 1.""" So just either drop the directive, or your own "plainwrap" macro. You're right of course and I'm very sorry and thank you for clarification. Unfortunately there is one more such a dumb warning, I'm afraid that this time it's not just my fault -- it is filed as bug 484961. |