Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#140 Compiler warnings (2.5.36)

2.5.36
closed-fixed
Will Estes
5
2013-07-12
2012-07-31
Ilya Voronin
No

After upgrading from 2.5.35 to 2.5.36 i'm started to get a compiler warning:

dew_lexer.c: In function ‘yy_scan_bytes’:
dew_lexer.c:1548:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Test code can be found here: https://github.com/ivoronin/dew

Discussion


  • Anonymous
    2012-08-04

    This happens in 2.5.37 as well:

    lex.yy.cpp: In function ‘int yylex()’:
    lex.yy.cpp:753: warning: comparison between signed and unsigned integer expressions
    lex.yy.cpp: In function ‘yy_buffer_state* yy_scan_bytes(const char*, yy_size_t)’:
    lex.yy.cpp:1580: warning: comparison between signed and unsigned integer expressions

    750 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
    751 {
    752 int yyl;
    753 for ( yyl = 0; yyl < yyleng; ++yyl )
    754 if ( yytext[yyl] == '\n' )
    755

    1572 int i;
    1573
    1574 /* Get memory for full buffer, including space for trailing EOB's. */
    1575 n = _yybytes_len + 2;
    1576 buf = (char *) yyalloc(n );
    1577 if ( ! buf )
    1578 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
    1579
    1580 for ( i = 0; i < _yybytes_len; ++i )
    1581 buf[i] = yybytes[i];
    1582

     

  • Anonymous
    2012-08-04

    This following patch fixes it. My apologies for the formatting, I can't figure out how to attach a file to this bug or send this to a SF mailing list.

    diff --git a/flex.skl b/flex.skl
    index 01d8204..7802f45 100644
    --- a/flex.skl
    +++ b/flex.skl
    @@ -2360,7 +2360,7 @@ YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yyb
    YY_BUFFER_STATE b;
    char *buf;
    yy_size_t n;
    - int i;
    + yy_size_t i;
    m4_dnl M4_YY_DECL_GUTS_VAR();

    /* Get memory for full buffer, including space for trailing EOB's. */
    diff --git a/gen.c b/gen.c
    index 5a5daef..8d24a86 100644
    --- a/gen.c
    +++ b/gen.c
    @@ -1972,7 +1972,7 @@ void make_tables ()
    ("if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )");
    indent_up ();
    indent_puts ("{");
    - indent_puts ("int yyl;");
    + indent_puts ("yy_size_t yyl;");
    do_indent ();
    out_str ("for ( yyl = %s; yyl < yyleng; ++yyl )\n",
    yymore_used ? (yytext_is_array ? "YY_G(yy_prev_more_offset)" :

     
    Last edit: Anonymous 4 days ago
  • Will Estes
    Will Estes
    2012-08-04

    @nomis52,

    Thanks for the patch. I will review it for inclusion. It is expected that this bug is also present in 2.5.37 as well.

     
  • Will Estes
    Will Estes
    2012-08-04

    • assigned_to: nobody --> wlestes
    • status: open --> closed-fixed
     
  • Will Estes
    Will Estes
    2012-08-04

    The submitted patch has been applied and will be included in the next release of flex.

     
  • dbp
    dbp
    2013-07-12

    A number of open source projects have had to alter their Makefiles to cope with this problem in flex (google: flex Wno-sign-compare). And with FC19 out, which brings a newer flex, this bug is being visited on all users of flex-- and likely, will affect all users of Centos 7 / RHEL7. It would be great to cut a new release of flex to fix this problem.

     
    Last edit: dbp 2013-07-12