bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bison scan-code and flex-3.5.36


From: Tys Lefering
Subject: bison scan-code and flex-3.5.36
Date: Sat, 16 Apr 2011 23:52:32 +0200

>On Sun, Apr 10, 2011 at 1:00 AM, Joel E. Denny wrote:
>What flex are you using?
See below. It is issue with flex-3.5.36 development version
on sf flex 2.5.36 which does not work with bison test compile:

then yyleng which is in the flex generated output is not int
but size_t , (but possibly better and safer nowadays)

The flex manual on sf says:

int yyleng
    holds the length of the current token.

http://flex.sourceforge.net/manual/User-Values.html#index-yyleng-234

but the flex.skl in sf repo has size_t and not int:
467   %if-not-reentrant
468   extern yy_size_t yyleng;
469   %endif

http://flex.cvs.sourceforge.net/viewvc/flex/flex/flex.skl?revision=2.213&view=markup



When test compile bison master this does happen:
./configure --enable-gcc-warnings

gcc -std=gnu99  -I. -I./lib  -I./lib -I.    -g -O2 -MT
src/src_bison-scan-code-c.o -MD -MP -MF
src/.deps/src_bison-scan-code-c.Tpo -c -o src/src_bison-scan-code-c.o
`test -f 'src/scan-code-c.c' || echo './'`src/scan-code-c.c
In file included from src/scan-code-c.c:3:0:
src/scan-code.c:789:11: error: conflicting types for 'code_get_leng'
./src/flex-scanner.h:28:1: note: previous declaration of
'code_get_leng' was here
In file included from src/scan-code-c.c:3:0:
src/scan-code.c:2344:11: error: conflicting types for 'code_get_leng'
./src/flex-scanner.h:28:1: note: previous declaration of
'code_get_leng' was here
make[2]: *** [src/src_bison-scan-code-c.o] Error 1
make[2]: Leaving directory
`/home/twlevo/etc/bisongit/bisontestcompile/bison-master-test/bison-master'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/twlevo/etc/bisongit/bisontestcompile/bison-master-test/bison-master'
make: *** [all] Error 2

in flex generated scan-code.c is:
/** Get the length of the current token. */
yy_size_t code_get_leng  (void)

but in flex-scanner.h is:
int   FLEX_PREFIX (get_leng) (void);

code_get_leng() returns gram_leng;
#define yyleng gram_leng
/* %if-not-reentrant */
extern yy_size_t gram_leng; <--

manual edited flex-scanner.h and bison compiles perfect.

On 64-bits GNU/LINUX the int is a signed 32-bits and starts to
overflow at 2G but size_t is full unsigned 64-bits.

This is a flex issue but maybe bison can do something
smart to allow yyleng both int and size_t ?

Thanks, Tys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]