#134 Ignore --noreject and --noyymore with -l

2.5.35
closed-fixed
nobody
5
2012-08-08
2012-03-23
Andrey Tsyvarev
No

When use in lex-compatible mode, flex generates REJECT and yymore() macros whenever them are used by actions or not.
These leads to warnings when compile generated file with '-Wall' option to compiler:

test.c: In function ‘yylex’:
test.c:876: warning: label ‘find_rule’ defined but not used
parser.l: At top level:
test.c:2073: warning: ‘yy_flex_strlen’ defined but not used

I inspect flex source files, and found in "main.c" next lines:

661 if ( lex_compat )
...
669 /* Don't rely on detecting use of yymore() and REJECT,
670 * just assume they'll be used.
671 */
672 yymore_really_used = reject_really_used = true;

I don't understand why autodetection needed to be disabled, but this also disable (make been ignored) --noreject and --noyymore options.

When remove last 4 lines, everything OK: REJECT and yymore() are not generated and warnings disappear.

Discussion

  • Some lex-file which produce warnings described

     
    Attachments
  • Will Estes
    Will Estes
    2012-08-08

    • status: open --> closed-fixed
     
  • Will Estes
    Will Estes
    2012-08-08

    This has been fixed in the flex codebase and will be included in the next release.