> Le 1 déc. 2014 à 20:44, Bernd Edlinger <[email protected]> a écrit :
> 
> Hello,
> 
> I noticed, that bison does no longer compile with flex 2.5.38 and above.
> 
> That is because flex 2.5.38 changed the place where the YY_USER_INIT
> is evaluated.  Previously it was evaluated after code_start is declared, but
> now it is evaluated before code_start is declared:

Hi Bernd,

Thanks for the report.  Yeah, this is truly annoying,
Flex broke the API without clear message, as far as I can see.

Instead of relying more on Flex, and playing dirty macro tricks,
I rather installed the following changes (well, until the build
farm confirms everything is ok).

Thanks again!

commit 975bb564319aa4f4204c48aba265757ba207a80f
Author: Akim Demaille <[email protected]>
Date:   Wed Dec 31 14:48:13 2014 +0100

    flex: don't trust YY_USER_INIT
    
    Reported by Bernd Edligner and others.
    
    * src/scan-gram.l: here.

diff --git a/THANKS b/THANKS
index 1b1ff71..4559a90 100644
--- a/THANKS
+++ b/THANKS
@@ -16,6 +16,7 @@ Art Haas                  [email protected]
 Baron Schwartz            [email protected]
 Ben Pfaff                 [email protected]
 Benoit Perrot             [email protected]
+Bernd Edligner            [email protected]
 Bernd Kiefer              [email protected]
 Bert Deknuydt             [email protected]
 Bill Allombert            [email protected]
diff --git a/src/scan-gram.l b/src/scan-gram.l
index abc8a89..d0b81a8 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -45,9 +45,6 @@
 
 #define YY_DECL GRAM_LEX_DECL
 
-#define YY_USER_INIT                                    \
-   code_start = scanner_cursor = loc->start;            \
-
 /* Location of scanner cursor.  */
 static boundary scanner_cursor;
 
@@ -166,6 +163,15 @@ eqopt    ([[:space:]]*=)?
   /* Where containing comment or string or character literal started,
      when applicable.  */
   boundary token_start PACIFY_CC (= scanner_cursor);
+
+  /* We cannot trust YY_USER_INIT, whose semantics changes over time
+     (it moved in Flex 2.5.38).  */
+  static bool first = true;
+  if (first)
+    {
+      scanner_cursor = loc->start;
+      first = false;
+    }
 %}
 
 


Reply via email to