Building INN with flex 2.5.36

Julien ÉLIE julien at trigofacile.com
Tue Jul 30 18:31:34 UTC 2013


Hi all,

> 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?

I believe the most straight-forward fix is to remove the redefinition of prototypes
(recent versions of flex do not trigger missing prototype warnings), and to
always cast the return value of yyget_leng() to size_t.


--- configfile.l	(révision 9510)
+++ configfile.l	(copie de travail)
@@ -31,20 +31,6 @@
    warnings about it. */
 static void yyunput(int, char *) UNUSED;
 
-/* Prototype the various accessor functions generated by flex to avoid
-   missing prototype warnings. */
-int yyget_lineno(void);
-FILE *yyget_in(void);
-FILE *yyget_out(void);
-int yyget_leng(void);
-char *yyget_text(void);
-int yyget_debug(void);
-void yyset_lineno(int);
-void yyset_in(FILE *);
-void yyset_out(FILE *);
-void yyset_debug(int);
-int yylex_destroy(void);
-
 char *strPtr = 0 ;
 int strPtrLen = 0 ;
 int strIdx = 0 ;
@@ -52,7 +38,6 @@
 int lineCount = 0 ;
 int current ;
 
-static void strAppend (int ch);
 static void strAppend (int ch)
 {
   if (strIdx == strPtrLen)
@@ -162,11 +147,13 @@
 			  return (CHAR) ;}
 
 \"[^\"]*	{{
-	int i ;
+	size_t i ;
 
 	for (i = 1, strIdx = 0, sawBsl = 0 ; ; i++)
           {
-            if (i < yyleng)
+            /* Cast yyget_leng() to size_t because it used to be an int
+             * in flex versions anterior to 2.5.35 (not included). */
+            if (i < (size_t) yyget_leng())
               current = yytext [i] ;
             else
               current = input() ;





-- 
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