help-bison
[Top][All Lists]
Advanced

[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, 29 Aug 2021 10:08:56 +0200

Hi Vince,

> Le 23 août 2021 à 14:58, Vince Huffaker <vince@vincejulie.com> a écrit :
> 
> Hi Akim,
> 
>>> But, maybe there's some alternative approach for bison in the future?  
>>> Maybe we could reserve a range of token values... or somehow indicate to 
>>> Bison that our token values are not truly 'custom', but are sequential 
>>> numbers... maybe that would help?  Don't know -- just trying ideas..
>>> 
>>> Your numbers are not consecutive, there are gaps.  Hence the number of 
>>> clauses: one per (contiguous) range.
> Aha!  I didn't quite understand why the YY_ASSERT looked like it did. I now 
> see the lack of contiguous ranges.  So, as another short-term workaround, I 
> might be able to reduce the number of gaps (by adding dummy token values) to 
> reduce the length of the YY_ASSERT line.

You should avoid doing that.  You will make your tables larger, and defeat the 
whole point of these assertions: clean diagnostics about unknown tokens.

I've installed the following fix.  I'd appreciate if you could confirm that 
this tarball does fix your issue.

https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.90.8-8556.tar.gz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.90.8-8556.tar.lz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.90.8-8556.tar.xz

Cheers!


commit 8556eb4a9a3af10f232f48b05b7b1fe159ffc971
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sun Aug 29 09:45:24 2021 +0200

    c++: beware of Visual C++ limitations
    
    Contrary to what commit d8cc6b073e2802d871a16dc62418a7eb62ed2216 "c++:
    shorten the assertions that check whether tokens are correct"
    believed, MS Visual C++'s preprocessor limitation is not on the input
    line length, but on the size of the line holding the full C++
    statement.
    
    Reported by Vince Huffaker <vince@vincejulie.com>
    <https://lists.gnu.org/r/help-bison/2021-08/msg00003.html>
    
    * data/skeletons/variant.hh (_b4_symbol_constructor_define): Hide the
    assertion from Visual C++.

diff --git a/data/skeletons/variant.hh b/data/skeletons/variant.hh
index efc67a7d..e7177d9f 100644
--- a/data/skeletons/variant.hh
+++ b/data/skeletons/variant.hh
@@ -484,7 +484,9 @@ m4_define([_b4_symbol_constructor_define],
                               b4_locations_if([l]))[)
 #endif
       {]b4_parse_assert_if([[
+#if !defined _MSC_VER || defined __clang__
         ]b4_assert[ (]b4_tok_in($@)[);
+#endif
       ]])[}
 ]])])
 




reply via email to

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