[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix compile error with flex version 2.5.38 and above
From: |
Akim Demaille |
Subject: |
Re: [PATCH] Fix compile error with flex version 2.5.38 and above |
Date: |
Wed, 31 Dec 2014 14:58:26 +0100 |
> Le 1 déc. 2014 à 20:44, Bernd Edlinger <address@hidden> 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 <address@hidden>
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 address@hidden
Baron Schwartz address@hidden
Ben Pfaff address@hidden
Benoit Perrot address@hidden
+Bernd Edligner address@hidden
Bernd Kiefer address@hidden
Bert Deknuydt address@hidden
Bill Allombert address@hidden
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;
+ }
%}