[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C2026 error in VC++ with large number of tokens
From: |
Akim Demaille |
Subject: |
Re: C2026 error in VC++ with large number of tokens |
Date: |
Sun, 22 Aug 2021 21:56:49 +0200 |
Hi Vince,
> Le 22 août 2021 à 03:58, Vince Huffaker <vince@vincejulie.com> a écrit :
>
> Hi,
>
> Thank you for your reply. See the input file, ApReadBinary.ypp (I have
> reduced it greatly from the original). The HPP file has the bad line at line
> # 3900 - the YY_ASSERT is too long.
But line 3900 is no long, if you read "line" in the text file sense:
> 3900 YY_ASSERT (tok == token::YYEOF
> 3901 || tok == token::YYerror
> 3902 || tok == token::YYUNDEF
> 3903 || (token::AF_SMART_POINTER_INT <= tok && tok <=
> token::AF_POINT2RD_VECTOR_END)
> 3904 || (token::AF_ATTR_MODEL_VIEW <= tok && tok <=
> token::AF_ATTR_TEXTURE_MAPPING)
> 3905 || (token::AF_TESSELLATION_BEGIN <= tok && tok <=
> token::AF_TESS_TRIANGLE_ARRAY)
> ...
> 3998 || (token::CS_PLANE_TO_PLANE3D_V2_END <= tok &&
> tok <= token::CS_PERPENDICULAR_PLANES3D_REF_V2_END)
> 3999 || tok == token::CS_COINCIDENT_POINTS_REF_V4_BEGIN
> 4000 || (token::CS_COINCIDENT_POINTS_V4_BEGIN <= tok &&
> tok <= token::CS_COINCIDENT_POINTS_V4_END)
> 4001 || (token::CS_COINCIDENT_POINTS_REF_V4_END <= tok
> && tok <= token::CS_CYLINDER3D_V7_END));
> 4002 }
So I guess you are telling me that the problem is the "line" in the sense of
the C preprocessor?
I guess I should just ignore this assertion when we are under Visual, i.e.,
emit something like
> #ifndef MSVC
> YY_ASSERT (tok == token::YYEOF
> || tok == token::YYerror
> || tok == token::YYUNDEF
> || (token::AF_SMART_POINTER_INT <= tok && tok <=
> token::AF_POINT2RD_VECTOR_END)
> || (token::AF_ATTR_MODEL_VIEW <= tok && tok <=
> token::AF_ATTR_TEXTURE_MAPPING)
> || (token::AF_TESSELLATION_BEGIN <= tok && tok <=
> token::AF_TESS_TRIANGLE_ARRAY)
> ...
> || (token::CS_PLANE_TO_PLANE3D_V2_END <= tok && tok <=
> token::CS_PERPENDICULAR_PLANES3D_REF_V2_END)
> || tok == token::CS_COINCIDENT_POINTS_REF_V4_BEGIN
> || (token::CS_COINCIDENT_POINTS_V4_BEGIN <= tok && tok <=
> token::CS_COINCIDENT_POINTS_V4_END)
> || (token::CS_COINCIDENT_POINTS_REF_V4_END <= tok && tok <=
> token::CS_CYLINDER3D_V7_END));
> #endif
Could you please add these lines (#ifndef/#endif) and tell me if it does fix
your issue?
Also, do you really need to specify the numbers for all the tokens? It is
because you gave these numbers that the assertion is long. If bison had
numbered itself, there wouldn't be holes, and the assertions is short. Why do
you provide the token numbers?
Cheers!