From 8358090292e21c61a583da542bad9099ad65f355 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 20 Jan 2021 18:30:16 -0800 Subject: [PATCH 01/26] c: port to HP-UX 11.23 Problem reported by Albert Chin in: https://lists.gnu.org/r/bug-bison/2021-01/msg00029.html * data/skeletons/c.m4 (b4_c99_int_type_define): Work around HP-UX bug. --- NEWS | 3 +++ data/skeletons/c.m4 | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/NEWS b/NEWS index e3633e05..1fd12f9f 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ GNU Bison NEWS * Noteworthy changes in release ?.? (????-??-??) [?] +** Bug fixes + +*** C-language parsers now work around quirks of HP-UX 11.23 (2003). * Noteworthy changes in release 3.7.4 (2020-11-14) [stable] diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4 index 07148ef8..14a16a9d 100644 --- a/data/skeletons/c.m4 +++ b/data/skeletons/c.m4 @@ -242,6 +242,18 @@ typedef int_least16_t yytype_int16; typedef short yytype_int16; #endif +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ From 1ac973aa568342700bfd404b41b6f0081d6a2a67 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 12 Jan 2021 06:28:13 +0100 Subject: [PATCH 02/26] c: adjust _Noreturn to pedantic clang Reported by Joe Nelson . https://lists.gnu.org/r/help-bison/2021-01/msg00004.html Fixed by Paul Eggert in gnulib. https://lists.gnu.org/r/bug-gnulib/2021-01/msg00156.html * data/skeletons/c.m4 (b4_attribute_define): Adjust _Noreturn to pedantic clang. --- data/skeletons/c.m4 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4 index 14a16a9d..8c08b0a5 100644 --- a/data/skeletons/c.m4 +++ b/data/skeletons/c.m4 @@ -378,14 +378,16 @@ dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings. && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ || (defined _MSC_VER && 1900 <= _MSC_VER))) # define _Noreturn [[noreturn]] -# elif (!defined __cplusplus \ - && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ - || (defined __apple_build_version__ \ - ? 6000000 <= __apple_build_version__ \ - : 3 < __clang_major__ + (5 <= __clang_minor__)))) +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) /* _Noreturn works as-is. */ -# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C +# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ + || 0x5110 <= __SUNPRO_C) # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) From 4744faf2055d5b3aacfacc10ba8b4bb84693ec24 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Jan 2021 15:37:19 +0100 Subject: [PATCH 03/26] autoconf: update --- submodules/autoconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/autoconf b/submodules/autoconf index babc8660..66fdaea3 160000 --- a/submodules/autoconf +++ b/submodules/autoconf @@ -1 +1 @@ -Subproject commit babc8660d5a7561ed7e99e09aeabffaccfe06d6d +Subproject commit 66fdaea3cfb4e758212c1891913e9a59441d49af From 1e0b0872448debb5e51c6393d11489a8d8166207 Mon Sep 17 00:00:00 2001 From: Martin Rehak Date: Wed, 18 Nov 2020 09:10:01 +0100 Subject: [PATCH 04/26] examples: avoid "unbound variable" errors When the shell option `nounset` is set, we may get "unbound variable" errors. https://lists.gnu.org/r/bug-bison/2020-11/msg00013.html * examples/test (diff_opts): Be sure to initialize it. --- examples/test | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/test b/examples/test index 81076701..7590e128 100755 --- a/examples/test +++ b/examples/test @@ -37,6 +37,7 @@ strip_prompt=false # If diff supports --strip-trailing-cr, use it, to avoid EOL issues # when testing Java programs on Windows. echo "checking for diff --strip-trailing-cr..." +diff_opts= if diff --strip-trailing-cr "$1" "$1"; then diff_opts=--strip-trailing-cr fi From 89d2b69c1b926c9dc1da3834ba2a7a924d4e2d4f Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 2 Dec 2020 21:38:43 +0100 Subject: [PATCH 05/26] c++: use noexcept where appropriate Reported by Don Macpherson. https://github.com/akimd/bison/issues/63 https://github.com/akimd/bison/issues/64 * data/skeletons/c++.m4, data/skeletons/lalr1.cc: here. --- data/skeletons/c++.m4 | 6 +++--- data/skeletons/lalr1.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/skeletons/c++.m4 b/data/skeletons/c++.m4 index 78c66def..5081273f 100644 --- a/data/skeletons/c++.m4 +++ b/data/skeletons/c++.m4 @@ -340,7 +340,7 @@ m4_define([b4_symbol_type_define], } /// Destroy contents, and record that is empty. - void clear () + void clear () YY_NOEXCEPT {]b4_variant_if([[ // User destructor. symbol_kind_type yykind = this->kind (); @@ -424,7 +424,7 @@ m4_define([b4_symbol_type_define], by_kind (kind_type t); /// Record that this symbol is empty. - void clear (); + void clear () YY_NOEXCEPT; /// Steal the symbol kind from \a that. void move (by_kind& that); @@ -544,7 +544,7 @@ m4_define([b4_public_types_define], {} ]b4_inline([$1])[void - ]b4_parser_class[::by_kind::clear () + ]b4_parser_class[::by_kind::clear () YY_NOEXCEPT { kind_ = ]b4_symbol(-2, kind)[; } diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index b95f9aa9..6214f96f 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -271,9 +271,9 @@ m4_define([b4_shared_declarations], { public: context (const ]b4_parser_class[& yyparser, const symbol_type& yyla); - const symbol_type& lookahead () const { return yyla_; } - symbol_kind_type token () const { return yyla_.kind (); }]b4_locations_if([[ - const location_type& location () const { return yyla_.location; } + const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; } + symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[ + const location_type& location () const YY_NOEXCEPT { return yyla_.location; } ]])[ /// Put in YYARG at most YYARGN of the expected tokens, and return the /// number of tokens stored in YYARG. If YYARG is null, return the From 1d3df34671ad4f0f60fef87558c6eb87b572eb14 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 2 Dec 2020 21:39:26 +0100 Subject: [PATCH 06/26] tables: avoid warnings and save bits The yydefgoto table uses -1 as an invalid for an impossible case (we never use yydefgoto[0], since it corresponds to the reduction to $accept, which never happens). Since yydefgoto is a table of state numbers, this -1 forces a signed type uselessly, which (1) might trigger compiler warnings when storing a value from yydefgoto into a state number (nonnegative), and (2) wastes bits which might result in using a int16 where a uint8 suffices. Reported by Jot Dot . https://lists.gnu.org/r/bug-bison/2020-11/msg00027.html * src/tables.c (default_goto): Use 0 rather than -1 as invalid value. * tests/regression.at: Adjust. --- src/parse-gram.c | 26 +++++++++++++++++++------- src/parse-gram.h | 2 +- src/tables.c | 9 ++++++++- tests/regression.at | 2 +- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/parse-gram.c b/src/parse-gram.c index cfca03b5..3071f803 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.3.7-d831b. */ +/* A Bison parser, made by GNU Bison 3.7.4.6-89d2b-dirty. */ /* Bison implementation for Yacc-like parsers in C @@ -45,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 30703 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30704 -/* Bison version. */ -#define YYBISON_VERSION "3.7.3.7-d831b" +/* Bison version string. */ +#define YYBISON_VERSION "3.7.4.6-89d2b-dirty" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -365,6 +365,18 @@ typedef int_least16_t yytype_int16; typedef short yytype_int16; #endif +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ @@ -791,9 +803,9 @@ static const yytype_int16 yypgoto[] = }; /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = +static const yytype_uint8 yydefgoto[] = { - -1, 1, 2, 43, 82, 115, 77, 45, 84, 46, + 0, 1, 2, 43, 82, 115, 77, 45, 84, 46, 50, 49, 47, 156, 120, 121, 122, 97, 93, 94, 95, 128, 141, 87, 88, 89, 55, 56, 78, 79, 80, 135, 144, 145, 113, 63, 106, 57, 81, 58, diff --git a/src/parse-gram.h b/src/parse-gram.h index ad4534ff..fcab0ce6 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.3.7-d831b. */ +/* A Bison parser, made by GNU Bison 3.7.4.6-89d2b-dirty. */ /* Bison interface for Yacc-like parsers in C diff --git a/src/tables.c b/src/tables.c index 052e96e6..d26a4a97 100644 --- a/src/tables.c +++ b/src/tables.c @@ -512,7 +512,14 @@ default_goto (symbol_number sym, size_t state_count[]) { const goto_number begin = goto_map[sym - ntokens]; const goto_number end = goto_map[sym - ntokens + 1]; - state_number res = -1; + + /* In the case this symbol is never reduced to ($accept), use state + 0. We used to use -1, but as a result the yydefgoto table must + be signed, which (1) might trigger compiler warnings when storing + a value from yydefgoto into a state number (nonnegative), and (2) + wastes bits which might result in using a int16 where a uint8 + suffices. */ + state_number res = 0; if (begin != end) { diff --git a/tests/regression.at b/tests/regression.at index 099b39a0..20b5f739 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -737,7 +737,7 @@ static const yytype_int8 yypgoto[] = }; static const yytype_int8 yydefgoto[] = { - -1, 2, 3, 4, 8 + 0, 2, 3, 4, 8 }; static const yytype_int8 yytable[] = { From a700a138228ed0d94bbfcf4feeb90093d2fbeca9 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 5 Dec 2020 06:49:48 +0100 Subject: [PATCH 07/26] glr.cc: don't "leak" yyparse When using glr.cc, the C function yyparse is an internal detail that should not be exposed. Users might call it by accident (I did). * data/skeletons/glr.c (yyparse): When used for glr.cc, rename as yy_parse_impl. * data/skeletons/glr.cc: Adjust. --- data/skeletons/glr.c | 4 ++-- data/skeletons/glr.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index a50f1804..1456b4ec 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -215,7 +215,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C], #define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[ ]m4_if(b4_prefix, [yy], [], [[/* Substitute the variable and function names. */ -#define yyparse ]b4_prefix[parse +#define ]b4_glr_cc_if([yy_parse_impl], [yyparse])[ ]b4_prefix[]b4_glr_cc_if([_parse_impl], [parse])[ #define yylex ]b4_prefix[lex #define yyerror ]b4_prefix[error #define yydebug ]b4_prefix[debug]]b4_pure_if([], [[ @@ -2420,7 +2420,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) `----------*/ int -yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[) +]b4_glr_cc_if([yy_parse_impl], [yyparse])[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[) { int yyresult; yyGLRStack yystack; diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc index 8ba34fc2..cf2c4c20 100644 --- a/data/skeletons/glr.cc +++ b/data/skeletons/glr.cc @@ -144,7 +144,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl int ]b4_parser_class[::parse () { - return ::yyparse (*this]b4_user_args[); + return ::yy_parse_impl (*this]b4_user_args[); } #if ]b4_api_PREFIX[DEBUG From 3b03c62e49f2c94bc797a1a81ffb4c32fa7ea986 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 3 Jan 2021 20:08:35 +0100 Subject: [PATCH 08/26] c++: I'm tired of Flex's warnings * doc/bison.texi: Disable another warning I'm tired to see. New releases would be most welcome. --- doc/bison.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/bison.texi b/doc/bison.texi index d38801db..4e9bb58b 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -13555,6 +13555,14 @@ then the parser's to get the set of defined tokens. # pragma GCC diagnostic ignored "-Wsign-conversion" # endif #endif + +// Flex 2.6.4, GCC 9 +// warning: useless cast to type 'int' [-Wuseless-cast] +// 1361 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); +// | ^ +#if defined GCC_VERSION && 900 <= GCC_VERSION +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif %@} @end example @end ignore From 8320691a63ca3bccb21360f780db0e727b6e6567 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 13 Jan 2021 08:01:02 +0100 Subject: [PATCH 09/26] cex: send traces to stderr, not stdout When comparing traces from different machines, the mixture of stdout/stderr in the output are making things uselessly difficult. * src/lssi.c, src/state-item.c: Output debug traces on stderr. --- src/lssi.c | 13 +++++++------ src/state-item.c | 34 ++++++++++++++++------------------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/lssi.c b/src/lssi.c index a5ab8a79..8c26ade0 100644 --- a/src/lssi.c +++ b/src/lssi.c @@ -102,15 +102,16 @@ append_lssi (lssi *sn, Hash_table *visited, lssi_list queue) static void lssi_print (lssi *l) { - print_state_item (&state_items[l->si], stdout); + FILE *out = stderr; + print_state_item (&state_items[l->si], out); if (l->lookahead) { - printf ("FOLLOWL = { "); + fprintf (out, "FOLLOWL = { "); bitset_iterator biter; symbol_number sin; BITSET_FOR_EACH (biter, l->lookahead, sin, 0) - printf ("%s, \n", symbols[sin]->tag); - puts ("}"); + fprintf (out, "%s, \n", symbols[sin]->tag); + fprintf (out, "}"); } } #endif @@ -252,11 +253,11 @@ shortest_path_from_start (state_item_number target, symbol_number next_sym) if (trace_flag & trace_cex) { - puts ("REDUCE ITEM PATH:"); + fputs ("REDUCE ITEM PATH:", stderr); gl_list_iterator_t it = gl_list_iterator (res); const void *sip; while (gl_list_iterator_next (&it, &sip, NULL)) - state_item_print ((state_item *) sip, stdout, ""); + state_item_print ((state_item *) sip, stderr, ""); } return res; } diff --git a/src/state-item.c b/src/state-item.c index a0c5a31a..5080a4c8 100644 --- a/src/state-item.c +++ b/src/state-item.c @@ -486,27 +486,26 @@ state_item_print (const state_item *si, FILE *out, const char *prefix) * Report the state_item graph */ static void -state_items_report (void) +state_items_report (FILE *out) { - printf ("# state items: %zu\n", nstate_items); + fprintf (out, "# state items: %zu\n", nstate_items); for (state_number i = 0; i < nstates; ++i) { - printf ("State %d:\n", i); + fprintf (out, "State %d:\n", i); for (state_item_number j = state_item_map[i]; j < state_item_map[i + 1]; ++j) { state_item *si = &state_items[j]; - item_print (si->item, NULL, stdout); + item_print (si->item, NULL, out); if (SI_DISABLED (j)) { - item_print (si->item, NULL, stdout); - puts (" DISABLED"); + item_print (si->item, NULL, out); + fputs (" DISABLED", out); continue; } - puts (""); if (si->trans >= 0) { - fputs (" -> ", stdout); - state_item_print (&state_items[si->trans], stdout, ""); + fputs (" -> ", out); + state_item_print (&state_items[si->trans], out, ""); } bitset sets[2] = { si->prods, si->revs }; @@ -520,24 +519,23 @@ state_items_report (void) state_item_number sin; BITSET_FOR_EACH (biter, b, sin, 0) { - fputs (txt[seti], stdout); - state_item_print (&state_items[sin], stdout, ""); + fputs (txt[seti], out); + state_item_print (&state_items[sin], out, ""); } } } - puts (""); } } - printf ("FIRSTS\n"); + fprintf (out, "FIRSTS\n"); for (symbol_number i = ntokens; i < nsyms; ++i) { - printf (" %s firsts\n", symbols[i]->tag); + fprintf (out, " %s firsts\n", symbols[i]->tag); bitset_iterator iter; symbol_number j; BITSET_FOR_EACH (iter, FIRSTS (i), j, 0) - printf (" %s\n", symbols[j]->tag); + fprintf (out, " %s\n", symbols[j]->tag); } - puts ("\n"); + fputc ('\n', out); } void @@ -552,8 +550,8 @@ state_items_init (void) prune_disabled_paths (); if (trace_flag & trace_cex) { - printf ("init: %f\n", difftime (time (NULL), start)); - state_items_report (); + fprintf (stderr, "init: %f\n", difftime (time (NULL), start)); + state_items_report (stderr); } } From 7a31b6bb7f24d925851be1849dbf1dbbd3b69826 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 14 Jan 2021 06:32:39 +0100 Subject: [PATCH 10/26] cex: add support for $TIME_LIMIT * src/counterexample.c (TIME_LIMIT): Replace with... (time_limit): this. (counterexample_init): Check $TIME_LIMIT. * src/scan-gram.l: Reorder includes. --- src/counterexample.c | 18 ++++++++++++++++-- src/scan-gram.l | 3 +-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/counterexample.c b/src/counterexample.c index 8a19aa51..b4caef7d 100644 --- a/src/counterexample.c +++ b/src/counterexample.c @@ -23,6 +23,7 @@ #include "system.h" +#include #include #include #include @@ -59,7 +60,7 @@ #define ASSURANCE_LIMIT 2.0f /* The time limit before giving up looking for unifying counterexample. */ -#define TIME_LIMIT 5.0f +static float time_limit = 5.0f; #define CUMULATIVE_TIME_LIMIT 120.0f @@ -1171,7 +1172,7 @@ unifying_example (state_item_number itm1, stderr); assurance_printed = true; } - if (time_passed > TIME_LIMIT) + if (time_passed > time_limit) { fprintf (stderr, "time limit exceeded: %f\n", time_passed); goto cex_search_end; @@ -1208,6 +1209,19 @@ static time_t cumulative_time; void counterexample_init (void) { + /* Recognize $TIME_LIMIT. Not a public feature, just to help + debugging. If we need something public, a %define/-D/-F variable + would be more appropriate. */ + { + const char *cp = getenv ("TIME_LIMIT"); + if (cp) + { + char *end = NULL; + float v = strtof (cp, &end); + if (*end == '\0' && errno == 0) + time_limit = v; + } + } time (&cumulative_time); scp_set = bitset_create (nstates, BITSET_FIXED); rpp_set = bitset_create (nstates, BITSET_FIXED); diff --git a/src/scan-gram.l b/src/scan-gram.l index e10d68e2..6d33cdf2 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -21,9 +21,8 @@ %option prefix="gram_" outfile="lex.yy.c" %{ -#include - #include +#include #include #include #include From 2f554e62604ff9e5944f5d56842132c74697b70c Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Jan 2021 14:37:05 +0100 Subject: [PATCH 11/26] cex: fix traces: add missing end-of-lines In 430ca0fc632f5e8072fe468b8a99c640985f6926, I completely forgot that `puts` adds a `\n`. * src/lssi.c, src/state-item.c: Restore missing end-of-lines in the output. --- src/lssi.c | 4 ++-- src/state-item.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lssi.c b/src/lssi.c index 8c26ade0..44dd819b 100644 --- a/src/lssi.c +++ b/src/lssi.c @@ -111,7 +111,7 @@ lssi_print (lssi *l) symbol_number sin; BITSET_FOR_EACH (biter, l->lookahead, sin, 0) fprintf (out, "%s, \n", symbols[sin]->tag); - fprintf (out, "}"); + fprintf (out, "}\n"); } } #endif @@ -253,7 +253,7 @@ shortest_path_from_start (state_item_number target, symbol_number next_sym) if (trace_flag & trace_cex) { - fputs ("REDUCE ITEM PATH:", stderr); + fputs ("REDUCE ITEM PATH:\n", stderr); gl_list_iterator_t it = gl_list_iterator (res); const void *sip; while (gl_list_iterator_next (&it, &sip, NULL)) diff --git a/src/state-item.c b/src/state-item.c index 5080a4c8..5ca9795a 100644 --- a/src/state-item.c +++ b/src/state-item.c @@ -499,9 +499,10 @@ state_items_report (FILE *out) if (SI_DISABLED (j)) { item_print (si->item, NULL, out); - fputs (" DISABLED", out); + fputs (" DISABLED\n", out); continue; } + putc ('\n', out); if (si->trans >= 0) { fputs (" -> ", out); @@ -524,6 +525,7 @@ state_items_report (FILE *out) } } } + putc ('\n', out); } } fprintf (out, "FIRSTS\n"); @@ -535,7 +537,7 @@ state_items_report (FILE *out) BITSET_FOR_EACH (iter, FIRSTS (i), j, 0) fprintf (out, " %s\n", symbols[j]->tag); } - fputc ('\n', out); + fputs ("\n\n", out); } void From 83bc8895367bf27f8ae78fea9ade8a8d94786698 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Jan 2021 15:05:30 +0100 Subject: [PATCH 12/26] cex: fix traces: fix display of disabled items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The display of disabled state items is incorrect. The item is stuttered, and lacks on end-of-line. From State 7: 1 exp: exp • "⊕" exp -> 1 exp: exp "⊕" • exp <- 1 exp: • exp "⊕" exp 2 exp: exp • "+" exp 2 exp: exp • "+" exp DISABLED 2 exp: exp "+" exp • <- 2 exp: exp "+" • exp 3 exp: exp • "+" exp 3 exp: exp • "+" exp DISABLED 3 exp: exp "+" exp • <- 3 exp: exp "+" • exp to State 7: 1 exp: exp • "⊕" exp -> 1 exp: exp "⊕" • exp <- 1 exp: • exp "⊕" exp 2 exp: exp • "+" exp DISABLED 2 exp: exp "+" exp • <- 2 exp: exp "+" • exp 3 exp: exp • "+" exp DISABLED 3 exp: exp "+" exp • <- 3 exp: exp "+" • exp * src/state-item.c (state_items_report): Don't issue disabled items twice, and issue two '\n' at their end. * tests/conflicts.at: Check it. --- src/state-item.c | 45 ++++---- tests/conflicts.at | 280 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 301 insertions(+), 24 deletions(-) diff --git a/src/state-item.c b/src/state-item.c index 5ca9795a..05cb8075 100644 --- a/src/state-item.c +++ b/src/state-item.c @@ -494,34 +494,33 @@ state_items_report (FILE *out) fprintf (out, "State %d:\n", i); for (state_item_number j = state_item_map[i]; j < state_item_map[i + 1]; ++j) { - state_item *si = &state_items[j]; + const state_item *si = &state_items[j]; item_print (si->item, NULL, out); if (SI_DISABLED (j)) + fputs (" DISABLED\n", out); + else { - item_print (si->item, NULL, out); - fputs (" DISABLED\n", out); - continue; - } - putc ('\n', out); - if (si->trans >= 0) - { - fputs (" -> ", out); - state_item_print (&state_items[si->trans], out, ""); - } - - bitset sets[2] = { si->prods, si->revs }; - const char *txt[2] = { " => ", " <- " }; - for (int seti = 0; seti < 2; ++seti) - { - bitset b = sets[seti]; - if (b) + putc ('\n', out); + if (si->trans >= 0) { - bitset_iterator biter; - state_item_number sin; - BITSET_FOR_EACH (biter, b, sin, 0) + fputs (" -> ", out); + state_item_print (&state_items[si->trans], out, ""); + } + + bitset sets[2] = { si->prods, si->revs }; + const char *txt[2] = { " => ", " <- " }; + for (int seti = 0; seti < 2; ++seti) + { + bitset b = sets[seti]; + if (b) { - fputs (txt[seti], out); - state_item_print (&state_items[sin], out, ""); + bitset_iterator biter; + state_item_number sin; + BITSET_FOR_EACH (biter, b, sin, 0) + { + fputs (txt[seti], out); + state_item_print (&state_items[sin], out, ""); + } } } } diff --git a/tests/conflicts.at b/tests/conflicts.at index 2b6f4315..befd017b 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -1956,7 +1956,285 @@ empty_c2: %prec 'c' ; empty_c3: %prec 'c' ; ]]) -AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) +AT_BISON_CHECK([[--trace=cex -fcaret --report=all -o input.c input.y]], 0, [], +[[init: 0.000000 +# state items: 26 +State 0: + 0 $accept: . start $end + -> 0 $accept: start . $end + => 2 start: . empty_a 'a' + => 4 start: . empty_b 'b' + => 6 start: . empty_c1 'c' + => 7 start: . empty_c2 'c' + => 8 start: . empty_c3 'c' + + 1 start: . 'a' DISABLED + + 2 start: . empty_a 'a' + -> 2 start: empty_a . 'a' + => 9 empty_a: . %empty + <- 0 $accept: . start $end + + 3 start: . 'b' DISABLED + + 4 start: . empty_b 'b' + -> 4 start: empty_b . 'b' + => 10 empty_b: . %empty + <- 0 $accept: . start $end + + 5 start: . 'c' DISABLED + + 6 start: . empty_c1 'c' + -> 6 start: empty_c1 . 'c' + => 11 empty_c1: . %empty + <- 0 $accept: . start $end + + 7 start: . empty_c2 'c' + -> 7 start: empty_c2 . 'c' + => 12 empty_c2: . %empty + <- 0 $accept: . start $end + + 8 start: . empty_c3 'c' + -> 8 start: empty_c3 . 'c' + => 13 empty_c3: . %empty + <- 0 $accept: . start $end + + 9 empty_a: . %empty + <- 2 start: . empty_a 'a' + + 10 empty_b: . %empty + <- 4 start: . empty_b 'b' + + 11 empty_c1: . %empty + <- 6 start: . empty_c1 'c' + + 12 empty_c2: . %empty + <- 7 start: . empty_c2 'c' + + 13 empty_c3: . %empty + <- 8 start: . empty_c3 'c' + +State 1: + 0 $accept: start . $end + -> 0 $accept: start $end . + <- 0 $accept: . start $end + +State 2: + 2 start: empty_a . 'a' + -> 2 start: empty_a 'a' . + <- 2 start: . empty_a 'a' + +State 3: + 4 start: empty_b . 'b' + -> 4 start: empty_b 'b' . + <- 4 start: . empty_b 'b' + +State 4: + 6 start: empty_c1 . 'c' + -> 6 start: empty_c1 'c' . + <- 6 start: . empty_c1 'c' + +State 5: + 7 start: empty_c2 . 'c' + -> 7 start: empty_c2 'c' . + <- 7 start: . empty_c2 'c' + +State 6: + 8 start: empty_c3 . 'c' + -> 8 start: empty_c3 'c' . + <- 8 start: . empty_c3 'c' + +State 7: + 0 $accept: start $end . + <- 0 $accept: start . $end + +State 8: + 2 start: empty_a 'a' . + <- 2 start: empty_a . 'a' + +State 9: + 4 start: empty_b 'b' . + <- 4 start: empty_b . 'b' + +State 10: + 6 start: empty_c1 'c' . + <- 6 start: empty_c1 . 'c' + +State 11: + 7 start: empty_c2 'c' . + <- 7 start: empty_c2 . 'c' + +State 12: + 8 start: empty_c3 'c' . + <- 8 start: empty_c3 . 'c' + +FIRSTS + $accept firsts + 'a' + 'b' + 'c' + start firsts + 'a' + 'b' + 'c' + empty_a firsts + empty_b firsts + empty_c1 firsts + empty_c2 firsts + empty_c3 firsts + + +input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples +input.y:4.5-7: warning: rule useless in parser due to conflicts [-Wother] + 4 | 'a' + | ^~~ +input.y:6.5-7: warning: rule useless in parser due to conflicts [-Wother] + 6 | | 'b' + | ^~~ +input.y:8.5-7: warning: rule useless in parser due to conflicts [-Wother] + 8 | | 'c' + | ^~~ +input.y:13.10-18: warning: rule useless in parser due to conflicts [-Wother] + 13 | empty_a: %prec 'a' ; + | ^~~~~~~~~ +input.y:14.10-18: warning: rule useless in parser due to conflicts [-Wother] + 14 | empty_b: %prec 'b' ; + | ^~~~~~~~~ +input.y:15.11-19: warning: rule useless in parser due to conflicts [-Wother] + 15 | empty_c1: %prec 'c' ; + | ^~~~~~~~~ +input.y:16.11-19: warning: rule useless in parser due to conflicts [-Wother] + 16 | empty_c2: %prec 'c' ; + | ^~~~~~~~~ +input.y:17.11-19: warning: rule useless in parser due to conflicts [-Wother] + 17 | empty_c3: %prec 'c' ; + | ^~~~~~~~~ +REDUCE ITEM PATH: + 0 $accept: . start $end + 7 start: . empty_c2 'c' + 12 empty_c2: . %empty +CONFLICT 1 (size 1 depth 0 rc 2) + 12 empty_c2: . %empty + 12 empty_c2: . %empty + + . + +CONFLICT 2 (size 1 depth 0 rc 2) + 13 empty_c3: . %empty + 13 empty_c3: . %empty + + . + + +CONFLICT 1 (size 2 depth -1 rc 4) + 7 start: . empty_c2 'c' + 7 start: empty_c2 . 'c' + + empty_c2 + `-> . + +CONFLICT 2 (size 1 depth 0 rc 3) + 13 empty_c3: . %empty + 13 empty_c3: . %empty + + . + + +CONFLICT 1 (size 1 depth 0 rc 3) + 12 empty_c2: . %empty + 12 empty_c2: . %empty + + . + +CONFLICT 2 (size 2 depth -1 rc 2) + 8 start: . empty_c3 'c' + 8 start: empty_c3 . 'c' + + empty_c3 + `-> . + + +CONFLICT 1 (size 2 depth -1 rc 3) + 7 start: . empty_c2 'c' + 7 start: empty_c2 . 'c' + + empty_c2 + `-> . + +CONFLICT 2 (size 2 depth -1 rc 2) + 8 start: . empty_c3 'c' + 8 start: empty_c3 . 'c' + + empty_c3 + `-> . + + +CONFLICT 1 (size 3 depth -1 rc 2) + 7 start: . empty_c2 'c' + 7 start: empty_c2 'c' . + + empty_c2 + `-> . + +CONFLICT 2 (size 3 depth -1 rc 2) + 8 start: . empty_c3 'c' + 8 start: empty_c3 'c' . + + empty_c3 + `-> . + + +CONFLICT 1 (size 2 depth -1 rc 4) + 0 $accept: . start $end + 0 $accept: start . $end + + start + `-> empty_c2 'c' + `-> . + +CONFLICT 2 (size 3 depth -1 rc 3) + 8 start: . empty_c3 'c' + 8 start: empty_c3 'c' . + + empty_c3 + `-> . + + +CONFLICT 1 (size 3 depth -1 rc 3) + 7 start: . empty_c2 'c' + 7 start: empty_c2 'c' . + + empty_c2 + `-> . + +CONFLICT 2 (size 2 depth -1 rc 2) + 0 $accept: . start $end + 0 $accept: start . $end + + start + `-> empty_c3 'c' + `-> . + + +CONFLICT 1 (size 2 depth -1 rc 3) + 0 $accept: . start $end + 0 $accept: start . $end + + start + `-> empty_c2 'c' + `-> . + +CONFLICT 2 (size 2 depth -1 rc 2) + 0 $accept: . start $end + 0 $accept: start . $end + + start + `-> empty_c3 'c' + `-> . + + +]]) AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0, [[State 0 From 4910c025796684bf2a70341dde766cd68f3c6b2b Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Jan 2021 18:05:57 +0100 Subject: [PATCH 13/26] package: codespell * src/parse-gram.y: Fix spelling. --- Makefile.am | 3 ++- src/parse-gram.y | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7db4fe11..f94842c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,9 +133,10 @@ gen-ChangeLog: $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $< .PHONY: codespell +CODESPELL = codespell codespell: $(AM_V_GEN) cd $(srcdir) \ - && codespell \ + && $(CODESPELL) \ --regex "[\\w\\-'’\`]+\+*" \ --ignore-words-list "ba,circularly,cloneable,copyable,define'd,dout,froms,iff,ifset,od,ois" \ $$(git ls-files data doc lib src tests) diff --git a/src/parse-gram.y b/src/parse-gram.y index 7c146ea3..2b24ac17 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -513,7 +513,7 @@ tag: // A non empty list of possibly tagged symbols for %nterm. // // Can easily be defined like symbol_decls but restricted to ID, but -// using token_decls allows to reudce the number of rules, and also to +// using token_decls allows to reduce the number of rules, and also to // make nicer error messages on "%nterm 'a'" or '%nterm FOO "foo"'. nterm_decls: token_decls From 11f6839645fcac9d4ac3470f19e385d312e10b8d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 23 Jan 2021 09:42:24 +0100 Subject: [PATCH 14/26] style: YYUSE is private, make it YY_USE This macro is not exposed to users, make start it with 'YY_'. * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, * data/skeletons/glr.cc, data/skeletons/lalr1.cc, * src/parse-gram.c, tests/actions.at, tests/c++.at, tests/headers.at, * tests/local.at (YYUSE): Rename as... (YY_USE): this. --- data/skeletons/bison.m4 | 2 +- data/skeletons/c.m4 | 12 ++++++------ data/skeletons/glr.c | 14 +++++++------- data/skeletons/glr.cc | 6 +++--- data/skeletons/lalr1.cc | 4 ++-- src/parse-gram.c | 16 ++++++++-------- src/parse-gram.h | 2 +- tests/actions.at | 8 ++++---- tests/c++.at | 6 +++--- tests/headers.at | 2 +- tests/local.at | 6 +++--- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/data/skeletons/bison.m4 b/data/skeletons/bison.m4 index 7ab1cb91..12155123 100644 --- a/data/skeletons/bison.m4 +++ b/data/skeletons/bison.m4 @@ -537,7 +537,7 @@ m4_defn([b4_actions_])[]dnl break; }dnl ], -[YYUSE (m4_default([$2], [yykind]));])dnl +[YY_USE (m4_default([$2], [yykind]));])dnl m4_popdef([b4_actions_])dnl ]) diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4 index 8c08b0a5..8a5c851b 100644 --- a/data/skeletons/c.m4 +++ b/data/skeletons/c.m4 @@ -160,11 +160,11 @@ m4_popdef([$1])dnl # b4_parse_param_use([VAL], [LOC]) # -------------------------------- -# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params. +# 'YY_USE' VAL, LOC if locations are enabled, and all the parse-params. m4_define([b4_parse_param_use], -[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl -b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl -b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); +[m4_ifvaln([$1], [ YY_USE ([$1]);])dnl +b4_locations_if([m4_ifvaln([$2], [ YY_USE ([$2]);])])dnl +b4_parse_param_for([Decl], [Formal], [ YY_USE (Formal); ])dnl ]) @@ -398,9 +398,9 @@ dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings. ]])[/* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index 1456b4ec..5034b5ef 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -875,7 +875,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; int yylow; ]b4_parse_param_use([yyvalp], [yylocp])dnl -[ YYUSE (yyrhslen); +[ YY_USE (yyrhslen); # undef yyerrok # define yyerrok (yystackp->yyerrState = 0) # undef YYACCEPT @@ -939,8 +939,8 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, static void yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) { - YYUSE (yy0); - YYUSE (yy1); + YY_USE (yy0); + YY_USE (yy1); switch (yyn) { @@ -1795,8 +1795,8 @@ static YYRESULTTAG yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1]b4_pure_formals[) { - YYUSE (yyx0); - YYUSE (yyx1); + YY_USE (yyx0); + YY_USE (yyx1); #if ]b4_api_PREFIX[DEBUG YY_FPRINTF ((stderr, "Ambiguity detected.\n")); @@ -2140,7 +2140,7 @@ yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED; static yysymbol_kind_t yypcontext_token (const yyGLRStack *yystackp) { - YYUSE (yystackp); + YY_USE (yystackp); yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar); return yytoken; } @@ -2152,7 +2152,7 @@ yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED; static YYLTYPE * yypcontext_location (const yyGLRStack *yystackp) { - YYUSE (yystackp); + YY_USE (yystackp); return &yylloc; }]])], [detailed\|verbose], diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc index cf2c4c20..cfff9773 100644 --- a/data/skeletons/glr.cc +++ b/data/skeletons/glr.cc @@ -157,11 +157,11 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl const semantic_type* yyvaluep]b4_locations_if([[, const location_type* yylocationp]])[) const {]b4_locations_if([[ - YYUSE (yylocationp);]])[ - YYUSE (yyvaluep); + YY_USE (yylocationp);]])[ + YY_USE (yyvaluep); std::ostream& yyo = debug_stream (); std::ostream& yyoutput = yyo; - YYUSE (yyoutput); + YY_USE (yyoutput); ]b4_symbol_actions([printer])[ } diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index 6214f96f..c62c77d2 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -597,7 +597,7 @@ m4_if(b4_prefix, [yy], [], #else // !]b4_api_PREFIX[DEBUG # define YYCDEBUG if (false) std::cerr -# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol) +# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol) # define YY_REDUCE_PRINT(Rule) static_cast (0) # define YY_STACK_PRINT() static_cast (0) @@ -736,7 +736,7 @@ m4_if(b4_prefix, [yy], [], ]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const { std::ostream& yyoutput = yyo; - YYUSE (yyoutput); + YY_USE (yyoutput); if (yysym.empty ()) yyo << "empty symbol"; else diff --git a/src/parse-gram.c b/src/parse-gram.c index 3071f803..5b1ac0a6 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.4.6-89d2b-dirty. */ +/* A Bison parser, made by GNU Bison 3.7.4.23-44a69. */ /* Bison implementation for Yacc-like parsers in C @@ -49,7 +49,7 @@ #define YYBISON 30704 /* Bison version string. */ -#define YYBISON_VERSION "3.7.4.6-89d2b-dirty" +#define YYBISON_VERSION "3.7.4.23-44a69" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -478,9 +478,9 @@ typedef int yy_state_fast_t; /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ @@ -1072,8 +1072,8 @@ yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { FILE *yyoutput = yyo; - YYUSE (yyoutput); - YYUSE (yylocationp); + YY_USE (yyoutput); + YY_USE (yylocationp); if (!yyvaluep) return; # ifdef YYPRINT @@ -1701,8 +1701,8 @@ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) { - YYUSE (yyvaluep); - YYUSE (yylocationp); + YY_USE (yyvaluep); + YY_USE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); diff --git a/src/parse-gram.h b/src/parse-gram.h index fcab0ce6..7dbd0ffd 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.4.6-89d2b-dirty. */ +/* A Bison parser, made by GNU Bison 3.7.4.23-44a69. */ /* Bison interface for Yacc-like parsers in C diff --git a/tests/actions.at b/tests/actions.at index d90851de..da11ceb2 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -334,10 +334,10 @@ exp: { ]AT_CXX_IF([[std::cerr << @$ << '\n']], ]AT_YYLEX_PROTOTYPE[ {]AT_PURE_IF([ - YYUSE(lvalp); - YYUSE(llocp);], [AT_CXX_IF([ - YYUSE(lvalp); - YYUSE(llocp);])])[ + YY_USE(lvalp); + YY_USE(llocp);], [AT_CXX_IF([ + YY_USE(lvalp); + YY_USE(llocp);])])[ return 'x'; } diff --git a/tests/c++.at b/tests/c++.at index 949bdeb6..b894c0f7 100644 --- a/tests/c++.at +++ b/tests/c++.at @@ -1232,10 +1232,10 @@ list: item: 'a' { $$ = $][1; } -| 'e' { YYUSE ($$); YYUSE ($][1); error ("syntax error"); } +| 'e' { YY_USE ($$); YY_USE ($][1); error ("syntax error"); } // Not just 'E', otherwise we reduce when 'E' is the lookahead, and // then the stack is emptied, defeating the point of the test. -| 'E' 'a' { YYUSE ($][1); $$ = $][2; } +| 'E' 'a' { YY_USE ($][1); $$ = $][2; } | 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; } | 'p' { $$ = $][1; } | 's' { $$ = $][1; throw std::runtime_error ("reduction"); } @@ -1394,7 +1394,7 @@ int yylex (yy::parser::semantic_type *lvalp) // Note: this argument is unused, but named on purpose. There used to be a // bug with a macro that erroneously expanded this identifier to // yystackp->yyval. - YYUSE (lvalp); + YY_USE (lvalp); return yy::parser::token::ZERO; } diff --git a/tests/headers.at b/tests/headers.at index 73a43454..4e745ccb 100644 --- a/tests/headers.at +++ b/tests/headers.at @@ -340,7 +340,7 @@ AT_PERL_CHECK([[-n -0777 -e ' |YYNTOKENS # This is actual scoped in a C++ class. |YYPUSH_MORE(?:_DEFINED)? |S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped. - |YYUSE + |YY_USE |YY_ATTRIBUTE(?:_PURE|_UNUSED) |YY(?:_REINTERPRET)?_CAST |YY_CONSTEXPR diff --git a/tests/local.at b/tests/local.at index 91e1e734..c697f5a7 100644 --- a/tests/local.at +++ b/tests/local.at @@ -643,7 +643,7 @@ yyreport_syntax_error (const yypcontext_t *ctx]AT_PARAM_IF([, AT_PARSE_PARAMS])[ { int res = 0;]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ - YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ + YY_USE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ ++global_nerrs; ++*nerrs;]])[]AT_LOCATION_IF([[ LOCATION_PRINT (stderr, *yypcontext_location (ctx)); @@ -679,7 +679,7 @@ static ]AT_YYERROR_PROTOTYPE[ {]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ - YYUSE (\1);])dnl + YY_USE (\1);])dnl AT_YYERROR_SEES_LOC_IF([[ LOCATION_PRINT (stderr, ]AT_LOC[); fprintf (stderr, ": ");]])[ @@ -760,7 +760,7 @@ void ]AT_NAMESPACE[::parser::report_syntax_error (const context& ctx) const {]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ - YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ + YY_USE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ ++global_nerrs; ++*nerrs;]])[]AT_LOCATION_IF([[ std::cerr << ctx.location () << ": ";]])[ From c73dcd6958ed73daff240ca46cc8b0f774a28e22 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 23 Jan 2021 10:14:19 +0100 Subject: [PATCH 15/26] skeletons: introduce "slot"s for symbols Extracted from d9cf99b6a5cb0345e91dfb90fe6d6473024ea97a, in the master branch. * data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics than type and type_tag. --- data/README.md | 8 +++++++- data/skeletons/bison.m4 | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/data/README.md b/data/README.md index 50fbe525..59b220b0 100644 --- a/data/README.md +++ b/data/README.md @@ -142,11 +142,17 @@ The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS: When api.value.type=union, the generated name for the union member. yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc. -- `type` +- `type`: string If it has a semantic value, its type tag, or, if variant are used, its type. In the case of api.value.type=union, type is the real type (e.g. int). +- `slot`: string + If it has a semantic value, the name of the union member (i.e., bounces to + either `type_tag` or `type`). It would be better to fix our mess and + always use `type` for the true type of the member, and `type_tag` for the + name of the union member. + - `has_printer`: 0, 1 - `printer`: string - `printer_file`: string diff --git a/data/skeletons/bison.m4 b/data/skeletons/bison.m4 index 12155123..156b0689 100644 --- a/data/skeletons/bison.m4 +++ b/data/skeletons/bison.m4 @@ -465,6 +465,19 @@ m4_case([$1], # but are S_YYEMPTY and symbol_kind::S_YYEMPTY in C++. m4_copy([b4_symbol_kind_base], [b4_symbol_kind]) + +# b4_symbol_slot(NUM) +# ------------------- +# The name of union member that contains the value of these symbols. +# Currently, we are messy, this should actually be type_tag, but type_tag +# has several meanings. +m4_define([b4_symbol_slot], +[m4_case(b4_percent_define_get([[api.value.type]]), + [union], [b4_symbol([$1], [type_tag])], + [variant], [b4_symbol([$1], [type_tag])], + [b4_symbol([$1], [type])])]) + + # b4_symbol(NUM, FIELD) # --------------------- # Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined. @@ -475,6 +488,7 @@ m4_define([b4_symbol], [id], [b4_symbol_token_kind([$1])], [kind_base], [b4_symbol_kind_base([$1])], [kind], [b4_symbol_kind([$1])], + [slot], [b4_symbol_slot([$1])], [_b4_symbol($@)])]) From 0317055bb06d69b74005273955eddaa345cd1eca Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 30 Dec 2020 08:25:39 +0100 Subject: [PATCH 16/26] %merge: clearer tests on diagnostics * tests/glr-regression.at: Use caret errors. --- tests/glr-regression.at | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/glr-regression.at b/tests/glr-regression.at index f5964756..a6deb9c9 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -1675,11 +1675,19 @@ sym3: %merge { $$ = 0; } ; ]]) AT_BISON_OPTION_POPDEFS -AT_BISON_CHECK([[-o glr-regr18.c -rall glr-regr18.y]], 1, [], +AT_BISON_CHECK([[-o glr-regr18.c -rall -fcaret glr-regr18.y]], 1, [], [[glr-regr18.y:28.18-24: error: result type clash on merge function 'merge': != + 28 | sym2: sym3 %merge { $$ = $][1; } ; + | ^~~~~~~ glr-regr18.y:27.18-24: note: previous declaration + 27 | sym1: sym2 %merge { $$ = $][1; } ; + | ^~~~~~~ glr-regr18.y:29.13-19: error: result type clash on merge function 'merge': != + 29 | sym3: %merge { $$ = 0; } ; + | ^~~~~~~ glr-regr18.y:28.18-24: note: previous declaration + 28 | sym2: sym3 %merge { $$ = $][1; } ; + | ^~~~~~~ ]]) AT_CLEANUP From a26f7cf98fcfe9fa1a3077dafdbff0687c22c039 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 30 Dec 2020 08:27:24 +0100 Subject: [PATCH 17/26] %merge: let mergers record a typing-symbol, rather than a type Symbols are richer than types, and in M4 it is my simpler (and more common) to deal with symbols rather than types. So let's associate mergers to a symbol rather than a type name. * src/reader.h (merger_list): Replace the 'type' member by a symbol member. * src/reader.c (record_merge_function_type): Take a symbol as argument, rather than a type name. * src/output.c (merger_output): Adjust. --- src/output.c | 14 ++++++-------- src/reader.c | 29 +++++++++++++++-------------- src/reader.h | 5 ++++- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/output.c b/src/output.c index 753b1bd7..19c89cb4 100644 --- a/src/output.c +++ b/src/output.c @@ -533,14 +533,12 @@ merger_output (FILE *out) int n; merger_list* p; for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next) - { - if (p->type[0] == '\0') - fprintf (out, " case %d: *yy0 = %s (*yy0, *yy1); break;\n", - n, p->name); - else - fprintf (out, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n", - n, p->type, p->name); - } + if (p->sym && p->sym->content->type_name) + fprintf (out, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n", + n, p->sym->content->type_name, p->name); + else + fprintf (out, " case %d: *yy0 = %s (*yy0, *yy1); break;\n", + n, p->name); fputs ("]])\n\n", out); } diff --git a/src/reader.c b/src/reader.c index 059e9341..b71dd916 100644 --- a/src/reader.c +++ b/src/reader.c @@ -41,7 +41,7 @@ static void check_and_convert_grammar (void); static symbol_list *grammar = NULL; static bool start_flag = false; -merger_list *merge_functions; +merger_list *merge_functions = NULL; /* Was %union seen? */ bool union_seen = false; @@ -93,27 +93,27 @@ get_merge_function (uniqstr name) syms->next->name = uniqstr_new (name); /* After all symbol type declarations have been parsed, packgram invokes record_merge_function_type to set the type. */ - syms->next->type = NULL; + syms->next->sym = NULL; syms->next->next = NULL; merge_functions = head.next; } return n; } -/*-------------------------------------------------------------------------. -| For the existing merging function with index MERGER, record the result | -| type as TYPE as required by the lhs of the rule whose %merge declaration | -| is at DECLARATION_LOC. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| For the existing merging function with index MERGER, record that | +| the result type is that of SYM, as required by the lhs (i.e., SYM) | +| of the rule whose %merge declaration is at DECLARATION_LOC. | +`-------------------------------------------------------------------*/ static void -record_merge_function_type (int merger, uniqstr type, location declaration_loc) +record_merge_function_type (int merger, symbol *sym, location declaration_loc) { if (merger <= 0) return; - if (type == NULL) - type = uniqstr_new (""); + uniqstr type + = sym->content->type_name ? sym->content->type_name : uniqstr_new (""); merger_list *merge_function; int merger_find = 1; @@ -122,17 +122,18 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc) merge_function = merge_function->next) merger_find += 1; aver (merge_function != NULL && merger_find == merger); - if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type)) + if (merge_function->sym && merge_function->sym->content->type_name + && !UNIQSTR_EQ (merge_function->sym->content->type_name, type)) { complain (&declaration_loc, complaint, _("result type clash on merge function %s: " "<%s> != <%s>"), quote (merge_function->name), type, - merge_function->type); + merge_function->sym->content->type_name); subcomplain (&merge_function->type_declaration_loc, complaint, _("previous declaration")); } - merge_function->type = uniqstr_new (type); + merge_function->sym = sym; merge_function->type_declaration_loc = declaration_loc; } @@ -616,7 +617,7 @@ packgram (void) for (symbol_list *p = grammar; p; p = p->next) { symbol_list *lhs = p; - record_merge_function_type (lhs->merger, lhs->content.sym->content->type_name, + record_merge_function_type (lhs->merger, lhs->content.sym, lhs->merger_declaration_loc); /* If the midrule's $$ is set or its $n is used, remove the '$' from the symbol name so that it's a user-defined symbol so that the default diff --git a/src/reader.h b/src/reader.h index 6b4f57ff..2fde52c6 100644 --- a/src/reader.h +++ b/src/reader.h @@ -31,7 +31,10 @@ typedef struct merger_list { struct merger_list* next; uniqstr name; - uniqstr type; + /* One symbol whose type is the one used by all the symbols on which + this merging function is used. */ + symbol *sym; + /* Where SYM was bound to this merging function. */ location type_declaration_loc; } merger_list; From 84b00b6bf0e1813f674e16ab3c349e9d7d71904c Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 30 Dec 2020 09:10:05 +0100 Subject: [PATCH 18/26] %merge: delegate the generation of calls to mergers to m4 Don't generate C code from bison, leave that to the skeletons. * src/output.c (merger_output): Emit invocations to b4_call_merger. * data/skeletons/glr.c (b4_call_merger): New. --- data/skeletons/glr.c | 11 ++++++++++- src/output.c | 8 ++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index 5034b5ef..1ef948cd 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -1,4 +1,4 @@ - -*- C -*- +# -*- C -*- # GLR skeleton for Bison @@ -145,6 +145,15 @@ m4_define([b4_rhs_location], [(b4_rhs_data([$1], [$2]).yyloc)]) +# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM) +# --------------------------------------------------- +m4_define([b4_call_merger], +[b4_case([$1], + [ b4_symbol_if([$3], [has_type], + [yy0->b4_symbol($3, type) = $2 (*yy0, *yy1);], + [*yy0 = $2 (*yy0, *yy1);])])]) + + ## -------------- ## ## Declarations. ## ## -------------- ## diff --git a/src/output.c b/src/output.c index 19c89cb4..5c87d5b4 100644 --- a/src/output.c +++ b/src/output.c @@ -533,12 +533,8 @@ merger_output (FILE *out) int n; merger_list* p; for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next) - if (p->sym && p->sym->content->type_name) - fprintf (out, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n", - n, p->sym->content->type_name, p->name); - else - fprintf (out, " case %d: *yy0 = %s (*yy0, *yy1); break;\n", - n, p->name); + fprintf (out, "]b4_call_merger""([%d], [%s], [%d])[\n", + n, p->name, p->sym->content->number); fputs ("]])\n\n", out); } From 1bac4ecc44f6b7a20b4688b2cb9eeecc91bdb503 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 31 Dec 2020 07:20:49 +0100 Subject: [PATCH 19/26] %merge: fix compatibility with api.value.type=union Reported by Jot Dot. https://lists.gnu.org/r/help-bison/2020-12/msg00014.html * data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): Use the symbol's slot, not its type. * examples/c/glr/c++-types.y: Use explicit per-symbol typing together with api.value.type=union. (yylex): Use yytoken_kind_t. --- data/skeletons/glr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index 1ef948cd..b392dd72 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -150,7 +150,7 @@ m4_define([b4_rhs_location], m4_define([b4_call_merger], [b4_case([$1], [ b4_symbol_if([$3], [has_type], - [yy0->b4_symbol($3, type) = $2 (*yy0, *yy1);], + [yy0->b4_symbol($3, slot) = $2 (*yy0, *yy1);], [*yy0 = $2 (*yy0, *yy1);])])]) From 3abad26a2d0c063719745156dc2d40681c5f969d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 31 Dec 2020 07:55:05 +0100 Subject: [PATCH 20/26] %merge: associate it to its first definition, not the latest Currently each time we meet %merge we record this location as the defining location (and symbol). Instead, record the first definition. In the generated code we go from yy0->A = merge (*yy0, *yy1); to yy0->S = merge (*yy0, *yy1); where S was indeed the first symbol, and in the diagnostics we go from glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != 30 | sym2: sym3 %merge { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != 31 | sym3: %merge { $$ = 0; } ; | ^~~~~~~ glr-regr18.y:30.18-24: note: previous declaration 30 | sym2: sym3 %merge { $$ = $1; } ; | ^~~~~~~ to glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != 30 | sym2: sym3 %merge { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != 31 | sym3: %merge { $$ = 0; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { $$ = $1; } ; | ^~~~~~~ where both duplicates are reported against definition 1, rather than using definition 1 as a reference when diagnosing about definition 2, and then 2 as a reference for 3. * src/reader.c (record_merge_function_type): Keep the first definition. * tests/glr-regression.at: Adjust. --- src/reader.c | 27 ++++++++++++++++----------- tests/glr-regression.at | 6 +++--- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/reader.c b/src/reader.c index b71dd916..a43c5e41 100644 --- a/src/reader.c +++ b/src/reader.c @@ -122,19 +122,24 @@ record_merge_function_type (int merger, symbol *sym, location declaration_loc) merge_function = merge_function->next) merger_find += 1; aver (merge_function != NULL && merger_find == merger); - if (merge_function->sym && merge_function->sym->content->type_name - && !UNIQSTR_EQ (merge_function->sym->content->type_name, type)) + if (merge_function->sym && merge_function->sym->content->type_name) { - complain (&declaration_loc, complaint, - _("result type clash on merge function %s: " - "<%s> != <%s>"), - quote (merge_function->name), type, - merge_function->sym->content->type_name); - subcomplain (&merge_function->type_declaration_loc, complaint, - _("previous declaration")); + if (!UNIQSTR_EQ (merge_function->sym->content->type_name, type)) + { + complain (&declaration_loc, complaint, + _("result type clash on merge function %s: " + "<%s> != <%s>"), + quote (merge_function->name), type, + merge_function->sym->content->type_name); + subcomplain (&merge_function->type_declaration_loc, complaint, + _("previous declaration")); + } + } + else + { + merge_function->sym = sym; + merge_function->type_declaration_loc = declaration_loc; } - merge_function->sym = sym; - merge_function->type_declaration_loc = declaration_loc; } /*--------------------------------------. diff --git a/tests/glr-regression.at b/tests/glr-regression.at index a6deb9c9..51c6ee5e 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -1682,11 +1682,11 @@ AT_BISON_CHECK([[-o glr-regr18.c -rall -fcaret glr-regr18.y]], 1, [], glr-regr18.y:27.18-24: note: previous declaration 27 | sym1: sym2 %merge { $$ = $][1; } ; | ^~~~~~~ -glr-regr18.y:29.13-19: error: result type clash on merge function 'merge': != +glr-regr18.y:29.13-19: error: result type clash on merge function 'merge': != 29 | sym3: %merge { $$ = 0; } ; | ^~~~~~~ -glr-regr18.y:28.18-24: note: previous declaration - 28 | sym2: sym3 %merge { $$ = $][1; } ; +glr-regr18.y:27.18-24: note: previous declaration + 27 | sym1: sym2 %merge { $$ = $][1; } ; | ^~~~~~~ ]]) From 003ca0498d6bc7f1d36d566b26555c4b48f723cf Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Jan 2021 16:00:37 +0100 Subject: [PATCH 21/26] package: bump copyrights to 2021 Run 'make update-copyright'. --- AUTHORS | 2 +- ChangeLog-2012 | 2 +- Makefile.am | 2 +- NEWS | 2 +- PACKAGING | 2 +- README | 2 +- README-alpha | 2 +- README-hacking.md | 2 +- THANKS | 2 +- TODO | 2 +- bootstrap.conf | 2 +- build-aux/Darwin.valgrind | 2 +- build-aux/Linux.valgrind | 2 +- build-aux/cross-options.pl | 2 +- build-aux/local.mk | 2 +- build-aux/update-b4-copyright | 2 +- build-aux/update-package-copyright-year | 2 +- build-aux/update-test | 2 +- cfg.mk | 2 +- configure.ac | 4 ++-- data/README.md | 2 +- data/bison-default.css | 2 +- data/local.mk | 2 +- data/skeletons/bison.m4 | 2 +- data/skeletons/c++-skel.m4 | 2 +- data/skeletons/c++.m4 | 2 +- data/skeletons/c-like.m4 | 2 +- data/skeletons/c-skel.m4 | 2 +- data/skeletons/c.m4 | 2 +- data/skeletons/d-skel.m4 | 2 +- data/skeletons/d.m4 | 2 +- data/skeletons/glr.c | 6 +++--- data/skeletons/glr.cc | 4 ++-- data/skeletons/java-skel.m4 | 2 +- data/skeletons/java.m4 | 2 +- data/skeletons/lalr1.cc | 4 ++-- data/skeletons/lalr1.d | 4 ++-- data/skeletons/lalr1.java | 4 ++-- data/skeletons/location.cc | 4 ++-- data/skeletons/stack.hh | 2 +- data/skeletons/variant.hh | 2 +- data/skeletons/yacc.c | 4 ++-- data/xslt/bison.xsl | 2 +- data/xslt/xml2dot.xsl | 2 +- data/xslt/xml2text.xsl | 2 +- data/xslt/xml2xhtml.xsl | 2 +- doc/bison.texi | 20 ++++++++++---------- doc/local.mk | 2 +- doc/refcard.tex | 2 +- etc/README.md | 2 +- etc/bench.pl.in | 2 +- etc/local.mk | 2 +- examples/README.md | 2 +- examples/c++/README.md | 2 +- examples/c++/calc++/README.md | 2 +- examples/c++/calc++/calc++.test | 2 +- examples/c++/calc++/local.mk | 2 +- examples/c++/local.mk | 2 +- examples/c++/variant-11.test | 2 +- examples/c++/variant-11.yy | 2 +- examples/c++/variant.test | 2 +- examples/c++/variant.yy | 2 +- examples/c/README.md | 2 +- examples/c/bistromathic/README.md | 2 +- examples/c/bistromathic/bistromathic.test | 2 +- examples/c/bistromathic/local.mk | 2 +- examples/c/bistromathic/parse.y | 2 +- examples/c/calc/README.md | 2 +- examples/c/calc/calc.test | 2 +- examples/c/calc/local.mk | 2 +- examples/c/lexcalc/README.md | 2 +- examples/c/lexcalc/lexcalc.test | 2 +- examples/c/lexcalc/local.mk | 2 +- examples/c/lexcalc/parse.y | 2 +- examples/c/lexcalc/scan.l | 2 +- examples/c/local.mk | 2 +- examples/c/mfcalc/local.mk | 2 +- examples/c/mfcalc/mfcalc.test | 2 +- examples/c/pushcalc/README.md | 2 +- examples/c/pushcalc/calc.test | 2 +- examples/c/pushcalc/calc.y | 2 +- examples/c/pushcalc/local.mk | 2 +- examples/c/reccalc/README.md | 2 +- examples/c/reccalc/local.mk | 2 +- examples/c/reccalc/parse.y | 2 +- examples/c/reccalc/reccalc.test | 2 +- examples/c/reccalc/scan.l | 2 +- examples/c/rpcalc/local.mk | 2 +- examples/c/rpcalc/rpcalc.test | 2 +- examples/d/README.md | 2 +- examples/d/calc.test | 2 +- examples/d/calc.y | 2 +- examples/d/local.mk | 2 +- examples/extexi | 2 +- examples/java/README.md | 2 +- examples/java/calc/Calc.test | 2 +- examples/java/calc/Calc.y | 2 +- examples/java/calc/local.mk | 2 +- examples/java/local.mk | 2 +- examples/java/simple/Calc.test | 2 +- examples/java/simple/Calc.y | 2 +- examples/java/simple/local.mk | 2 +- examples/local.mk | 2 +- examples/test | 2 +- lib/get-errno.c | 2 +- lib/get-errno.h | 2 +- lib/local.mk | 2 +- lib/main.c | 2 +- lib/path-join.c | 2 +- lib/path-join.h | 2 +- lib/timevar.def | 2 +- lib/yyerror.c | 2 +- m4/bison-check-compiler-flag.m4 | 2 +- m4/bison-cxx-std.m4 | 2 +- m4/bison-i18n.m4 | 2 +- m4/c-working.m4 | 2 +- m4/cxx.m4 | 2 +- m4/flex.m4 | 2 +- src/AnnotationList.c | 2 +- src/AnnotationList.h | 2 +- src/InadequacyList.c | 2 +- src/InadequacyList.h | 2 +- src/Sbitset.c | 2 +- src/Sbitset.h | 2 +- src/assoc.c | 2 +- src/assoc.h | 2 +- src/closure.c | 2 +- src/closure.h | 2 +- src/complain.c | 2 +- src/complain.h | 2 +- src/conflicts.c | 2 +- src/conflicts.h | 2 +- src/counterexample.c | 2 +- src/counterexample.h | 2 +- src/derivation.c | 2 +- src/derivation.h | 2 +- src/derives.c | 2 +- src/derives.h | 2 +- src/files.c | 2 +- src/files.h | 2 +- src/fixits.c | 2 +- src/fixits.h | 2 +- src/flex-scanner.h | 2 +- src/getargs.c | 2 +- src/getargs.h | 2 +- src/glyphs.c | 2 +- src/glyphs.h | 2 +- src/gram.c | 2 +- src/gram.h | 2 +- src/graphviz.c | 2 +- src/graphviz.h | 2 +- src/ielr.c | 2 +- src/ielr.h | 2 +- src/lalr.c | 2 +- src/lalr.h | 2 +- src/local.mk | 2 +- src/location.c | 2 +- src/location.h | 2 +- src/lr0.c | 2 +- src/lr0.h | 2 +- src/lssi.c | 2 +- src/lssi.h | 2 +- src/main.c | 2 +- src/muscle-tab.c | 2 +- src/muscle-tab.h | 2 +- src/named-ref.c | 2 +- src/named-ref.h | 2 +- src/nullable.c | 2 +- src/nullable.h | 2 +- src/output.c | 2 +- src/output.h | 2 +- src/parse-gram.c | 2 +- src/parse-gram.h | 2 +- src/parse-gram.y | 2 +- src/parse-simulation.c | 2 +- src/parse-simulation.h | 2 +- src/print-graph.c | 2 +- src/print-graph.h | 2 +- src/print-xml.c | 2 +- src/print-xml.h | 2 +- src/print.c | 2 +- src/print.h | 2 +- src/reader.c | 2 +- src/reader.h | 2 +- src/reduce.c | 2 +- src/reduce.h | 2 +- src/relation.c | 2 +- src/relation.h | 2 +- src/scan-code.h | 2 +- src/scan-code.l | 2 +- src/scan-gram.h | 2 +- src/scan-gram.l | 2 +- src/scan-skel.h | 2 +- src/scan-skel.l | 2 +- src/state-item.c | 2 +- src/state-item.h | 2 +- src/state.c | 2 +- src/state.h | 2 +- src/strversion.c | 2 +- src/strversion.h | 2 +- src/symlist.c | 2 +- src/symlist.h | 2 +- src/symtab.c | 2 +- src/symtab.h | 2 +- src/system.h | 2 +- src/tables.c | 2 +- src/tables.h | 2 +- src/uniqstr.c | 2 +- src/uniqstr.h | 2 +- tests/actions.at | 2 +- tests/atlocal.in | 2 +- tests/bison.in | 2 +- tests/c++.at | 2 +- tests/calc.at | 2 +- tests/conflicts.at | 2 +- tests/counterexample.at | 2 +- tests/cxx-type.at | 2 +- tests/diagnostics.at | 2 +- tests/existing.at | 2 +- tests/glr-regression.at | 2 +- tests/headers.at | 2 +- tests/input.at | 2 +- tests/java.at | 2 +- tests/javapush.at | 2 +- tests/linear | 2 +- tests/local.at | 2 +- tests/local.mk | 2 +- tests/m4.at | 2 +- tests/named-refs.at | 2 +- tests/output.at | 2 +- tests/push.at | 2 +- tests/reduce.at | 2 +- tests/regression.at | 2 +- tests/report.at | 2 +- tests/scanner.at | 2 +- tests/sets.at | 2 +- tests/skeletons.at | 2 +- tests/synclines.at | 2 +- tests/testsuite.at | 2 +- tests/torture.at | 2 +- tests/types.at | 2 +- 241 files changed, 259 insertions(+), 259 deletions(-) diff --git a/AUTHORS b/AUTHORS index e624c51b..5991853d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -24,7 +24,7 @@ and nasty bugs. ----- -Copyright (C) 1998-2015, 2018-2020 Free Software Foundation, Inc. +Copyright (C) 1998-2015, 2018-2021 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. diff --git a/ChangeLog-2012 b/ChangeLog-2012 index d56c1267..6ff8f0d7 100644 --- a/ChangeLog-2012 +++ b/ChangeLog-2012 @@ -26733,7 +26733,7 @@ ----- - Copyright (C) 1987-1988, 1991-2015, 2018-2020 Free Software + Copyright (C) 1987-1988, 1991-2015, 2018-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without diff --git a/Makefile.am b/Makefile.am index f94842c4..451af962 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2001-2015, 2018-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/NEWS b/NEWS index 1fd12f9f..e9715723 100644 --- a/NEWS +++ b/NEWS @@ -4554,7 +4554,7 @@ mode: outline fill-column: 76 End: -Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc. +Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc. This file is part of Bison, the GNU Parser Generator. diff --git a/PACKAGING b/PACKAGING index d4bf6d84..69bfc96e 100644 --- a/PACKAGING +++ b/PACKAGING @@ -36,7 +36,7 @@ to the bison package. ----- -Copyright (C) 2002, 2005, 2009-2015, 2018-2020 Free Software Foundation, +Copyright (C) 2002, 2005, 2009-2015, 2018-2021 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. diff --git a/README b/README index 94f8a4f8..e97c65a6 100644 --- a/README +++ b/README @@ -120,7 +120,7 @@ fill-column: 76 ispell-dictionary: "american" End: -Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2020 Free +Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free Software Foundation, Inc. This file is part of GNU bison, the GNU Compiler Compiler. diff --git a/README-alpha b/README-alpha index dbd0e88e..3dff3b2e 100644 --- a/README-alpha +++ b/README-alpha @@ -12,7 +12,7 @@ the problems you encounter. ----- -Copyright (C) 2002, 2004, 2009-2015, 2018-2020 Free Software Foundation, +Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation, Inc. This file is part of GNU Bison. diff --git a/README-hacking.md b/README-hacking.md index b5245bb9..85bc7376 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -569,7 +569,7 @@ bootstrapped.