#129 gcc -Wconversion

open-accepted
Will Estes
5
2012-11-01
2011-06-28
Robert Larice
No

Hello,

I've attached a patch, which would reduce gcc -Wconversion
compiler warnings quite a bit, when compiling flex generated c code.

I disagree a bit with the attitude:
"compiler warnings on flex generated c code are not flex bugs"
When flex is used in a large project, then those warnings
can create quite some noise, and seriously distract attention
from important stuff.

An easy exercise for the attached patch,
is to have a look at flex's own scan.l with
make ; rm scan.c ; make CFLAGS='-O2 -Wconversion'

Regards,
Robert

Discussion

  • Will Estes
    Will Estes
    2012-03-23

    • assigned_to: nobody --> wlestes
     
  • Will Estes
    Will Estes
    2012-08-08

    Your patch partially applied. It's on the git branch bug-3341746 in the sourceforge flex git repository if you'd like to submit a patch against that for the rest of the changes you were attempting.

    Please let me know.

     
  • Robert Larice
    Robert Larice
    2012-08-09

    the following commit:

    commit 9ba3187a537d6a58d345f2874d06087fd4050399
    Date: Thu May 15 21:11:57 2008 +0000
    clean up types; resolves 19619027a537d6a58d345f2874d06087fd4050399

    seems to interfere awfully with my patch.

    at least the change of type for `yyleng'
    from int to yy_size_t (which is unsigned)
    is quite serious.

    yyleng is part of the user API,
    I'm wondering whether this was good to change.

    on the master branch I see in flex.skl now:
    yy_size_t num_to_read ...
    while ( num_to_read <= 0 )
    { /* Not enough room in the buffer - grow it. */
    which makes me nervous, this might be buggy now.

    Please, Whats to do now ?
    Robert

     
  • Will Estes
    Will Estes
    2012-11-01

    • status: open --> open-accepted