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,96 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2021 Samuel Tyler <samuel@samuelt.me>
#
# SPDX-License-Identifier: GPL-3.0-or-later
../gnulib-ffbb0ce/gnulib-tool --import --local-dir=gl \
--lib=libbison \
--source-base=lib \
--m4-base=m4 \
--po-base=gnulib-po \
--doc-base=doc \
--tests-base=tests \
--aux-dir=build-aux \
--makefile-name=gnulib.mk \
--conditional-dependencies \
--no-libtool \
--macro-prefix=gl \
--po-domain=bison \
argmatch \
array-list \
assert \
assure \
bitsetv \
c-strcase \
calloc-posix \
close \
closeout \
config-h \
configmake \
dirname \
error \
extensions \
fdl \
fopen-safer \
fprintf-posix \
fstrcmp \
getopt-gnu \
gettext-h \
git-version-gen \
gitlog-to-changelog \
gpl-3.0 \
intprops \
inttypes \
isnan \
javacomp-script \
javaexec-script \
ldexpl \
libtextstyle-optional \
malloc-gnu \
mbfile \
mbswidth \
non-recursive-gnulib-prefix-hack \
obstack \
obstack-printf \
perror \
printf-posix \
progname \
quote \
quotearg \
readline \
readme-release \
realloc-posix \
relocatable-prog \
relocatable-script \
rename \
snprintf-posix \
spawn-pipe \
sprintf-posix \
stdbool \
stpcpy \
strdup-posix \
strerror \
strverscmp \
timevar \
unistd \
unistd-safer \
unlink \
unlocked-io \
unsetenv \
update-copyright \
verify \
vsnprintf-posix \
vsprintf-posix \
warnings \
winsz-ioctl \
winsz-termios \
xalloc \
xalloc-die \
xconcat-filename \
xhash \
xlist \
xmemdup0 \
xstrndup
build-aux/prefix-gnulib-mk --lib-name=libbison lib/gnulib.mk

47
steps/bison-3.6.4/pass1.sh Executable file
View file

@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2021-22 Samuel Tyler <samuel@samuelt.me>
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default
# GRAM_error was added after Bison 3.4, and doesn't add anything
# other than some sanity checks.
sed -i '/GRAM_error/d' src/scan-gram.l
# Remove pre-generated flex/bison files
rm src/parse-gram.c src/parse-gram.h
rm src/scan-code.c
rm src/scan-gram.c
rm src/scan-skel.c
# Remove pregenerated info files
rm doc/bison.info*
# Remove gettext files
rm runtime-po/*.gmo
../../import-gnulib.sh
# pregenerated gperf files
for f in lib/iconv_open-*.gperf; do
touch "$(basename "$f" .gperf).h"
done
AUTOPOINT=true AUTOMAKE=automake-1.15 ACLOCAL=aclocal-1.15 autoreconf-2.69 -fi
}
src_configure() {
./configure --prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--disable-nls
}
src_compile() {
make -j1 MAKEINFO=true
}
src_install() {
make MAKEINFO=true DESTDIR="${DESTDIR}" install
}

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;
}

View file

@ -0,0 +1,2 @@
f http://mirrors.kernel.org/gnu/bison/bison-3.6.4.tar.xz 8b13473b31ca7fcf65e5e8a74224368ffd5df19275602a9c9567ba393f18577d
g https://https.git.savannah.gnu.org/git/gnulib.git~ffbb0ce _ 4c14c95b301e74804dd82d3993176b03cffedc18221bf573db35d21f2f8a930e gnulib-ffbb0ce.tar.gz