On Fri, 26 Aug 2016 21:52:11 +0200 Frank Heckenbach
<f.heckenb...@fh-soft.de> wrote:
Package: flex
Version: 2.5.39-8+deb8u1
Severity: normal
After this update, I get the following warning when compiling the
flex generated code with gcc, which I didn't get before:
scan.cpp: In function âint yy_get_next_buffer(yyscan_t)â:
scan.cpp:758:18: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
scan.cpp:1384:3: note: in expansion of macro âYY_INPUTâ
Looking at the code:
#define YY_INPUT(buf,result,max_size) \
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t n; \
for ( n = 0; n < max_size && \
Invoked as:
int num_to_read = ...
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
yyg->yy_n_chars, num_to_read );
So indeed an unsigned value (n) is compared with a signed one
(num_to_read). If this is correct, the warning can be silenced with
a cast of the appropriate one of them.
I've run into the same bug and agree with Frank's analysis. I've
confirmed that the following upstream commit fixes it:
https://github.com/westes/flex/commit/3946924ed5e77420c453bf841603c7278766093a