Package: flex Version: 2.5.34-3 Severity: normal
I started getting new warnings from the C compile phase of lexers as of 2.5.34, which I verified showed up in the transition from 2.5.33-12 to 2.5.34-1. The warnings are: warning: comparison between signed and unsigned integer expressions I tracked it down to a change in the definition of the YY_INPUT macro. Any gcc-4.2 or gcc-4.3 compiler will detect the problem. To reproduce, start with a very simple example.lex: %option nounput %{ extern int keyword(const char *str, unsigned len); %} %% [a-zA-Z_][a-zA-Z0-9$_]* { return keyword(yytext, yyleng); } %% Then build: flex -o example.cc example.lex gcc -Wall example.cc -c The warning that pops out when using lex-2.5.34 is example.cc: In function 'int yy_get_next_buffer()': example.cc:934: warning: comparison between signed and unsigned integer expressions It's easy to see the fault in example.cc. In both flex versions, YY_INPUT is used as YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]) (yy_n_chars), (size_t) num_to_read ); Note that the third argument is of type (size_t). The old, lint-free definition of YY_INPUT starts #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 && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ but the new definition changes the declaration of n to int n; which not only generates a warning for the comparison n < max_size, it's a real mistake. It took me some effort to isolate and analyze to this point. I started trying to find the origin of the problem in the flex code base, but quickly found myself in over my head. I hope you can take it from here. -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core) Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/bash Versions of packages flex depends on: ii debconf [debconf-2.0] 1.5.19 Debian configuration management sy ii libc6 2.7-8 GNU C Library: Shared libraries ii m4 1.4.10-1 a macro processing language Versions of packages flex recommends: ii gcc [c-compiler] 4:4.2.2-2 The GNU C compiler ii gcc-4.0 [c-compiler] 4.0.3-7 The GNU C compiler ii gcc-4.2 [c-compiler] 4.2.3-1 The GNU C compiler ii gcc-4.3 [c-compiler] 4.3-20080202-1 The GNU C compiler -- debconf information excluded -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]