On Mon, Oct 01, 2012 at 11:25:01AM +0200, Akim Demaille wrote:
> 
> Le 28 sept. 2012 à 20:41, Marcin Slusarz a écrit :
> 
> > Hi
> > 
> > With bison >= 2.6 I'm unable to compile envytools 
> > (https://github.com/pathscale/envytools):
> > 
> > In file included from easm_parse.y:28:0:
> > /data1/gfx/envytools/easm/easm_parse.h:124:17: error: unknown type name 
> > 'yyscan_t'
> > 
> > yyscan_t is referenced in easm_parse.h, but never defined, so it looks like
> > bison bug. Is it correct?
> 
> I just typed "yyscan_t" on Google, and found this:
> 
> http://flex.sourceforge.net/manual/About-yyscan_005ft.html

Thanks, I was googling for full error message and couldn't find anything
relevant.

> Nothing related to Bison here.

Heh, downgrading Bison helps, so it's not that obvious. And if I understand
the code correctly, yyscan_t has valid use here (but my Bison/Flex experience
is close to 0).

Well, if you think it's not Bison's fault, we can always "fix it" like in
the attached patch...

Marcin
From: Marcin Slusarz <[email protected]>
Subject: [PATCH] easm: fix build with bison >= 2.6

easm_parse.h started to reference yyscan_t, which is defined in easm_lex.h,
but we can't include easm_lex.h before easm_parse.h, because easm_lex.h
uses YYSTYPE which is defined in easm_parse.h.
To fix this, break the circular dependency by injecting definition of yyscan_t
before including anything.
---
 easm/easm_parse.y | 1 +
 1 file changed, 1 insertion(+)

diff --git a/easm/easm_parse.y b/easm/easm_parse.y
index bfac370..0b6de26 100644
--- a/easm/easm_parse.y
+++ b/easm/easm_parse.y
@@ -23,6 +23,7 @@
  */
 
 %{
+typedef void* yyscan_t;
 #include "easm.h"
 #include "yy.h"
 #include "easm_parse.h"
-- 
1.7.12

Reply via email to