[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bison: don't force the Yacc mode
From: |
Akim Demaille |
Subject: |
bison: don't force the Yacc mode |
Date: |
Fri, 7 Dec 2018 06:44:48 +0100 |
Bison's 3.0 announcement (2013-07-25) includes:
*** Use of YACC='bison -y'
TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
Bison extensions.
Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
'y.tab.h' and 'y.outout') to be generated from 'foo.y'.
To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
implementation of Yacc, was using Bison as 'bison -y'. While it does
ensure compatible output file names, it also enables warnings for
incompatibilities with POSIX Yacc. In other words, 'bison -y' triggers
warnings for Bison extensions.
Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
(which also generates 'y.tab.h' and 'y.output' when needed).
Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
flags (YFLAGS, or AM_YFLAGS with Automake).
Unfortunately there was no release of Autoconf in five years.
Yet I installed that change in Bison recently
https://lists.gnu.org/archive/html/bison-patches/2018-11/msg00068.html.
Ok to install?
commit 058a86dc35dadac964bf9cd94d419244e6a70e88
Author: Akim Demaille <address@hidden>
Date: Fri Dec 7 06:26:08 2018 +0100
bison: don't force the Yacc mode
Passing -y forces Bison into POSIX YACC mode. This includes reporting
errors when Bison features are used in the grammar file. Some of
these features (such as %expect) were flagged non-yacc recently. Most
of the time, -y is actually used to please Automake's ylwrap which
expects the output to be y.tab.c.
* m4/bison.m4 (gl_BISON): Use `-o y.tab.c` rather than `-y`.
diff --git a/ChangeLog b/ChangeLog
index 76d6966e4..10187e9e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-12-07 Akim Demaille <address@hidden>
+
+ bison: don't force the Yacc mode
+ Passing -y forces Bison into POSIX YACC mode. This includes reporting
+ errors when Bison features are used in the grammar file. Some of
+ these features (such as %expect) were flagged non-yacc recently. Most
+ of the time, -y is actually used to please Automake's ylwrap which
+ expects the output to be y.tab.c.
+ * m4/bison.m4 (gl_BISON): Use `-o y.tab.c` rather than `-y`.
+
2018-12-01 Bruno Haible <address@hidden>
gnupload: Document short options.
diff --git a/m4/bison.m4 b/m4/bison.m4
index ce47553b0..bbb605413 100644
--- a/m4/bison.m4
+++ b/m4/bison.m4
@@ -8,15 +8,16 @@
AC_DEFUN([gl_BISON],
[
# parse-datetime.y works with bison only.
- : ${YACC='bison -y'}
+ : ${YACC='bison -o y.tab.c'}
dnl
dnl Declaring YACC & YFLAGS precious will not be necessary after GNULIB
dnl requires an Autoconf greater than 2.59c, but it will probably still be
dnl useful to override the description of YACC in the --help output, re
-dnl parse-datetime.y assuming 'bison -y'.
+dnl parse-datetime.y assuming 'bison -o y.tab.c'.
AC_ARG_VAR([YACC],
-[The "Yet Another C Compiler" implementation to use. Defaults to 'bison -y'.
-Values other than 'bison -y' will most likely break on most systems.])dnl
+[The "Yet Another C Compiler" implementation to use. Defaults to
+'bison -o y.tab.c'. Values other than 'bison -o y.tab.c' will most likely
+break on most systems.])dnl
AC_ARG_VAR([YFLAGS],
[YFLAGS contains the list arguments that will be passed by default to Bison.
This script will default YFLAGS to the empty string to avoid a default value of
- bison: don't force the Yacc mode,
Akim Demaille <=