Replace bison 3.4.2 with bison 3.6.4

This commit is contained in:
Samuel Tyler 2025-12-19 21:53:49 +11:00
parent 63b24502c7
commit 00808ed08a
No known key found for this signature in database
GPG key ID: EB5091A5C77E8DC4
14 changed files with 349 additions and 119 deletions

View file

@ -0,0 +1,118 @@
SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
Revert "diagnostics: translate bison's own tokens"
This reverts commit 2cc361387c9790b387d205f5d862f493c148e424.
This format is not suppported by Bison 3.4.
---
src/parse-gram.y | 71 ++++++++++++++++++++++++++----------------------
1 file changed, 39 insertions(+), 32 deletions(-)
diff --git bison-3.6.4/src/parse-gram.y bison-3.6.1/src/parse-gram.y
index d09f49a7..0879ca41 100644
--- bison-3.6.4/src/parse-gram.y
+++ bison-3.6.4/src/parse-gram.y
@@ -140,26 +140,32 @@
boundary_set (&@$.end, grammar_file, 1, 1, 1);
}
-%token
- STRING _("string")
- TSTRING _("translatable string")
+/* Define the tokens together with their human representation. */
+%token GRAM_EOF 0 "end of file"
+%token STRING "string"
+ TSTRING "translatable string"
+
+%token PERCENT_TOKEN "%token"
+%token PERCENT_NTERM "%nterm"
- PERCENT_TOKEN "%token"
- PERCENT_NTERM "%nterm"
+%token PERCENT_TYPE "%type"
+%token PERCENT_DESTRUCTOR "%destructor"
+%token PERCENT_PRINTER "%printer"
- PERCENT_TYPE "%type"
- PERCENT_DESTRUCTOR "%destructor"
- PERCENT_PRINTER "%printer"
+%token PERCENT_LEFT "%left"
+%token PERCENT_RIGHT "%right"
+%token PERCENT_NONASSOC "%nonassoc"
+%token PERCENT_PRECEDENCE "%precedence"
- PERCENT_LEFT "%left"
- PERCENT_RIGHT "%right"
- PERCENT_NONASSOC "%nonassoc"
- PERCENT_PRECEDENCE "%precedence"
+%token PERCENT_PREC "%prec"
+%token PERCENT_DPREC "%dprec"
+%token PERCENT_MERGE "%merge"
- PERCENT_PREC "%prec"
- PERCENT_DPREC "%dprec"
- PERCENT_MERGE "%merge"
+/*----------------------.
+| Global Declarations. |
+`----------------------*/
+%token
PERCENT_CODE "%code"
PERCENT_DEFAULT_PREC "%default-prec"
PERCENT_DEFINE "%define"
@@ -185,23 +191,24 @@
PERCENT_TOKEN_TABLE "%token-table"
PERCENT_VERBOSE "%verbose"
PERCENT_YACC "%yacc"
+;
- BRACED_CODE "{...}"
- BRACED_PREDICATE "%?{...}"
- BRACKETED_ID _("[identifier]")
- CHAR _("character literal")
- COLON ":"
- EPILOGUE _("epilogue")
- EQUAL "="
- ID _("identifier")
- ID_COLON _("identifier:")
- PERCENT_PERCENT "%%"
- PIPE "|"
- PROLOGUE "%{...%}"
- SEMICOLON ";"
- TAG _("<tag>")
- TAG_ANY "<*>"
- TAG_NONE "<>"
+%token BRACED_CODE "{...}"
+%token BRACED_PREDICATE "%?{...}"
+%token BRACKETED_ID "[identifier]"
+%token CHAR "character literal"
+%token COLON ":"
+%token EPILOGUE "epilogue"
+%token EQUAL "="
+%token ID "identifier"
+%token ID_COLON "identifier:"
+%token PERCENT_PERCENT "%%"
+%token PIPE "|"
+%token PROLOGUE "%{...%}"
+%token SEMICOLON ";"
+%token TAG "<tag>"
+%token TAG_ANY "<*>"
+%token TAG_NONE "<>"
/* Experimental feature, don't rely on it. */
%code pre-printer {tron (yyo);}
@@ -224,7 +231,7 @@
%printer { fprintf (yyo, "%%%s", $$); } PERCENT_FLAG
%printer { fprintf (yyo, "<%s>", $$); } TAG tag
-%token <int> INT _("integer literal")
+%token <int> INT "integer"
%printer { fprintf (yyo, "%d", $$); } <int>
%type <symbol*> id id_colon string_as_id symbol token_decl token_decl_for_prec
--
2.52.0

View file

@ -0,0 +1,17 @@
SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
Our version of bison does not have dangling-alias.
--- bison-3.6.4/Makefile.am 2025-12-15 22:03:53.093822507 +1100
+++ bison-3.6.4/Makefile.am 2025-12-15 22:04:07.336823714 +1100
@@ -42,7 +42,7 @@
BISON = $(top_builddir)/tests/bison
BISON_IN = $(top_srcdir)/tests/bison.in
YACC = $(BISON) -o y.tab.c
-AM_YFLAGS_WITH_LINES = --defines -Werror -Wall,dangling-alias --report=all
+AM_YFLAGS_WITH_LINES = --defines -Wall --report=all
AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
# Initialization before completion by local.mk's.

View file

@ -0,0 +1,29 @@
SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
It is unclear _why_ this is necessary. Something gets broken with
iconv detection for this version.
--- bison-3.6.4/m4/gettext.m4 2025-12-15 23:14:05.683179597 +1100
+++ bison-3.6.4/m4/gettext.m4 2025-12-15 23:14:18.450180679 +1100
@@ -93,9 +93,6 @@
dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
dnl documented, we avoid it.
- ifelse(gt_included_intl, yes, , [
- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
- ])
dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
gt_INTL_MACOSX
@@ -174,9 +171,6 @@
if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
dnl Sometimes libintl requires libiconv, so first search for libiconv.
- ifelse(gt_included_intl, yes, , [
- AM_ICONV_LINK
- ])
dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
dnl because that would add "-liconv" to LIBINTL and LTLIBINTL

View file

@ -0,0 +1,18 @@
SPDX-FileCopyrightText: 2021 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
Why do they insist on using themselves to bootstrap themselves? It doesn't
exist...
--- bison-3.6.4/Makefile.am 2021-04-15 21:29:36.596205032 +1000
+++ bison-3.6.4/Makefile.am 2021-04-15 21:30:00.367365897 +1000
@@ -39,7 +39,7 @@
## Running the bison from this tarball. To generate our own parser,
## but also to run the tests. Of course, you ought to keep a sane
## version of Bison nearby...
-BISON = $(top_builddir)/tests/bison
+BISON = /usr/bin/bison
BISON_IN = $(top_srcdir)/tests/bison.in
YACC = $(BISON) -o y.tab.c
AM_YFLAGS_WITH_LINES = --defines -Werror -Wall --report=all

View file

@ -0,0 +1,21 @@
SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
These are directives that don't exist for Bison 3.4.
diff --git bison-3.6.4/src/parse-gram.y bison-3.6.4/src/parse-gram.y
index d09f49a7..01b8dda9 100644
--- bison-3.6.4/src/parse-gram.y
+++ bison-3.6.4/src/parse-gram.y
@@ -122,10 +122,8 @@
%define api.header.include {"parse-gram.h"}
%define api.prefix {gram_}
%define api.pure full
-%define api.token.raw
%define api.value.type union
%define locations
-%define parse.error custom
%define parse.lac full
%define parse.trace
%defines

View file

@ -0,0 +1,25 @@
SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
Can't fetch PO files, no network access.
--- gnulib-ffbb0ce/gnulib-tool 2025-12-15 21:17:35.808587084 +1100
+++ gnulib-ffbb0ce/gnulib-tool 2025-12-15 21:17:55.399588744 +1100
@@ -5598,16 +5598,6 @@
fi
func_append added_files "$pobase/POTFILES.in$nl"
fi
- # Fetch PO files.
- TP_URL="https://translationproject.org/latest/"
- if $doit; then
- echo "Fetching gnulib PO files from $TP_URL"
- (cd "$destdir"/$pobase \
- && wget --no-verbose --mirror --level=1 -nd -A.po -P . "${TP_URL}gnulib/"
- )
- else
- echo "Fetch gnulib PO files from $TP_URL"
- fi
# Create po/LINGUAS.
if $doit; then
func_dest_tmpfilename $pobase/LINGUAS

View file

@ -0,0 +1,42 @@
SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
SPDX-License-Identifier: GPL-3.0-or-later
This was added with the addition of yypcontext_t -- it's the only use,
remove it. (Bison 3.4 doesn't know about yypcontext_t.)
diff --git bison-3.6.4/src/parse-gram.y bison-3.5.90/src/parse-gram.y
index d09f49a7..cf1a5bf4 100644
--- bison-3.6.4/src/parse-gram.y
+++ bison-3.6.4/src/parse-gram.y
@@ -798,28 +798,9 @@ epilogue.opt:
%%
int
-yyreport_syntax_error (const yypcontext_t *ctx)
+yyreport_syntax_error (const void *ctx)
{
- int res = 0;
- /* Arguments of format: reported tokens (one for the "unexpected",
- one per "expected"). */
- enum { ARGS_MAX = 5 };
- const char *argv[ARGS_MAX];
- int argc = 0;
- yysymbol_kind_t unexpected = yypcontext_token (ctx);
- if (unexpected != YYSYMBOL_YYEMPTY)
- {
- argv[argc++] = yysymbol_name (unexpected);
- yysymbol_kind_t expected[ARGS_MAX - 1];
- int nexpected = yypcontext_expected_tokens (ctx, expected, ARGS_MAX - 1);
- if (nexpected < 0)
- res = nexpected;
- else
- for (int i = 0; i < nexpected; ++i)
- argv[argc++] = yysymbol_name (expected[i]);
- }
- syntax_error (*yypcontext_location (ctx), argc, argv);
- return res;
+ return 0;
}