autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_PROG_YACC: use bison -o y.tab.c (was: [PATCH 0/6] api.value.type supp


From: Akim Demaille
Subject: AC_PROG_YACC: use bison -o y.tab.c (was: [PATCH 0/6] api.value.type support)
Date: Mon, 4 Mar 2013 18:48:41 +0100

Le 25 févr. 2013 à 14:26, Akim Demaille <address@hidden> a écrit :

> Actually I just found what could arguable called a bug in
> Bison:
> 
>> $ ls f.y
>> f.y
>> $ bison -o y.tab.c -d -v f.y
>> $ ls y.*
>> y.output     y.tab.c         y.tab.h
> 
> where I would have expected "y.tab.output".  Fortunately this
> is also what Automake/Autoconf expect.  So, if instead of -y
> Autoconf were using '-o y.tab.c', everybody would be happy.
> 
> And then --yacc = '-Werror=yacc -o y.tab.c'.  I'd be happy
> to avoid making --fixed-output-file public again, it's
> useless.

Hi Autofolks,

The fact that Autoconf sets YACC to bison --yacc is troublesome,
as it emasculates the Bison down to a Yacc-calf (I wouldn't like
to be the vet performing the bollocksectomy of a Bison).

The appended patch addresses this concern by taking profit from
the aforementioned behavior.

FWIW, I have plenty of failures of the test suite on Mac OS 10.8.2.
They all look like:

> 25. tools.at:950: testing autoupdating AU_ALIAS ...
> ../../../tests/tools.at:963: autoupdate 
> ../../../tests/tools.at:964: autoconf --force 
> ../../../tests/tools.at:964: /bin/sh -n configure
> stderr:
> ../../../tests/tools.at:965: ./configure $configure_options 
> --- /dev/null 2013-03-04 18:28:56.000000000 +0100
> +++ 
> /Users/akim/src/gnu/bison/submodules/autoconf/_build/48d-debug/tests/testsuite.dir/at-groups/25/stderr
>     2013-03-04 18:28:56.000000000 +0100
> @@ -0,0 +1,2 @@
> +rm: conftest.dSYM: is a directory
> +rm: conftest.dSYM: is a directory


(BTW, shouldn't the help notices such as the one for YACC
be converted to '' instead of `'?).

commit 63683577534eba689d05c0f4e392379c53e57549
Author: Akim Demaille <address@hidden>
Date:   Mon Mar 4 18:35:13 2013 +0100

    AC_PROG_YACC: don't force Bison to warn against its own features
    
    When invoked with -y/--yacc, Bison warns when its extensions over
    POSIX Yacc are used.  Yet many packages requiring GNU Bison use
    Autoconf/Automake's Yacc support, which passes -y to Bison.  It turns
    out that passing '-o y.tab.c' has exactly the desired effect:
    generating not only y.tab.c but also y.tab.h with -d and y.output with -v.
    
    See http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00100.html.
    
    * lib/autoconf/programs.m4 (AC_PROG_YACC): Use bison -o y.tab.c.
    * NEWS, doc/autoconf.texi: Document this change.

diff --git a/NEWS b/NEWS
index 1780cb9..a429c7b 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,11 @@ GNU Autoconf NEWS - User visible changes.
 - AC_PROG_CC_STDC, AC_PROG_CC_C89, AC_PROG_CC_C99 have been marked as obsolete.
   Applications should use AC_PROG_CC.
 
+- AC_PROG_YACC now uses 'bison -o y.tab.c' instead of 'bison -y'.  Both
+  properly generate 'y.tab.c' and possibly 'y.tab.h' and 'y.output', but
+  the latter also enable warnings for Bison extensions.  Add -Wyacc to
+  your YFLAGS to enable them.
+
 - AC_USE_SYSTEM_EXTENSIONS now enables more system extensions on HP-UX,
   MINIX 3, and OS X.
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index bf4823d..ad22fc6 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -4219,7 +4219,7 @@ and is cached in the @code{ac_cv_path_SED} variable.
 @ovindex YACC
 @caindex prog_YACC
 If @code{bison} is found, set output variable @code{YACC} to @samp{bison
--y}.  Otherwise, if @code{byacc} is found, set @code{YACC} to
+-o y.tab.c}.  Otherwise, if @code{byacc} is found, set @code{YACC} to
 @samp{byacc}.  Otherwise set @code{YACC} to @samp{yacc}.
 The result of this test can be influenced by setting the variable
 @code{YACC} or the cache variable @code{ac_cv_prog_YACC}.
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index f7af8b5..2057e78 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -892,10 +892,10 @@ AN_PROGRAM([yacc],  [AC_PROG_YACC])
 AN_PROGRAM([byacc], [AC_PROG_YACC])
 AN_PROGRAM([bison], [AC_PROG_YACC])
 AC_DEFUN([AC_PROG_YACC],
-[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)dnl
+[AC_CHECK_PROGS(YACC, 'bison -o y.tab.c' byacc, yacc)dnl
 AC_ARG_VAR(YACC,
 [The `Yet Another Compiler Compiler' implementation to use.  Defaults to
-the first program found out of: `bison -y', `byacc', `yacc'.])dnl
+the first program found out of: `bison -o y.tab.c', `byacc', `yacc'.])dnl
 AC_ARG_VAR(YFLAGS,
 [The list of arguments that will be passed by default to $YACC.  This script
 will default YFLAGS to the empty string to avoid a default value of `-d' given




reply via email to

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