[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Visual Studio - win_bison creates tab.h file exceeding compiler limi
From: |
Akim Demaille |
Subject: |
Re: Visual Studio - win_bison creates tab.h file exceeding compiler limits |
Date: |
Mon, 9 Nov 2020 19:09:08 +0100 |
Hi!
> Le 9 nov. 2020 à 13:08, Jot Dot <jotdot@shaw.ca> a écrit :
>
> bison generates the tab.h file using YY_ASSERT macros in many places.
> bison is generating lines longer than the microsoft compiler allows, which
> causes a C2026 error. (Line exceeds 16380 bytes).
Bummer. My bad, I had not anticipated this.
> I am starting to write a SQL parser.
Sounds fun ;)
> bison is generating asserts to check for valid tokens but a couple lines are
> over 21700 bytes long.
> Since the compiler truncates the line,
:facepalm:
> any YY_ASSERT() macro fails because the line is simply snipped. Thus it does
> not even encounter the trailing ')'. Naturally the compiler spits out
> gibberish at this point.
Always fun to workaround limitations.
> Although I've known about lex/yacc and flex/bison for years, this is my first
> real attempt to use it. This means I could be doing something "non-standard".
Nope, AFAICT, you're on the right tracks. Wrong compiler though.
> But my work so far was working with the standard C generation method. It is
> only now, converting it to C++, did I encounter this.
>
> It's easy enough to build, manually comment out the offending line, and then
> build again, but this is getting to be time consuming and highly annoying.
> Any fix or ideas would be greatly appreciated.
I'll have to find something better than this long list, but it's going to take
a bit of time.
Meanwhile, I recommend that you locate the file data/skeletons/variant.hh, and
change:
{
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ],
[$@]))[);
}
into
{]b4_parse_assert_if([[
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ],
[$@]))[);]])[
}
twice.
That should eliminate the problem locally until we have something standard.
Could you please confirm it works as expected? (don't use %define
parse.assert).
Cheers!