Building INN with flex 2.5.36

Julien ÉLIE julien at trigofacile.com
Mon Jul 29 20:20:48 UTC 2013


Hi all,

Trying to build INN with flex 2.5.36 or 2.5.37, I get the following error:

/home/iulius/autobuild/bin/gcc-4.8.1/bin/gcc -g -O2 -DDEBUG=1 -Werror -Wall -Wextra -Winit-self -Wsync-nand -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wnormalized=nfc -Wnested-externs -Winline -Wvla -g -O2 -I../include     -c -o config_l.o config_l.c
lex.yy.c:611:11: error: conflicting types for 'yyget_leng'
configfile.l:39:5: note: previous declaration of 'yyget_leng' was here
 int yyget_leng(void);
     ^
configfile.l: In function 'yylex':
configfile.l:169:19: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (i < yyleng)
                   ^
lex.yy.c: In function 'yy_scan_bytes':
lex.yy.c:1861:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
lex.yy.c: At top level:
lex.yy.c:1935:11: error: conflicting types for 'yyget_leng'
configfile.l:39:5: note: previous declaration of 'yyget_leng' was here
 int yyget_leng(void);
     ^
cc1: all warnings being treated as errors




It seems that the yyget_leng() function now returns a size_t, and not an int.

What would be the best way to fix the issue?
I see that someone added an autoconf test (defining YYLENG_IS_YY_SIZE_T) to check
the type of yyleng:
    https://github.com/bgilbert/nip2/commit/5b135dd968633ecee11a9aec8b35df5862f58683

Should a similar fix be used in INN or do you see another solution?




Then we would have:

--- innfeed/configfile.l	(revision 9513)
+++ innfeed/configfile.l	(working copy)
@@ -36,7 +36,7 @@
 int yyget_lineno(void);
 FILE *yyget_in(void);
 FILE *yyget_out(void);
-int yyget_leng(void);
+#ifdef YYLENG_IS_YY_SIZE_T
+  size_t yyget_leng(void);
+#else
+  int yyget_leng(void);
+#endif
 char *yyget_text(void);
 int yyget_debug(void);
 void yyset_lineno(int);
@@ -162,11 +162,11 @@
 			  return (CHAR) ;}
 
 \"[^\"]*	{{
-	int i ;
+#ifdef YYLENG_IS_YY_SIZE_T
+	size_t i ;
+#else
+	int i ;
+#endif
 
 	for (i = 1, strIdx = 0, sawBsl = 0 ; ; i++)
           {
-            if (i < yyleng)
+            if (i < yyget_leng())
               current = yytext [i] ;
             else
               current = input() ;







And then we will have to expect flex 2.5.38 to have this bug fixed:
    http://sourceforge.net/p/flex/bugs/140/
It prevents the use of -Wsign-compare because the code generated by flex
triggers a warning.

-- 
Julien ÉLIE

« – Je t'ai préparé une bonne soupe dont tu me diras des
    nouvelles, mon garçon !
  – Pour moi, ça, ce n'est pas des bonnes nouvelles ! » (Astérix)


More information about the inn-workers mailing list