]> git.saurik.com Git - bison.git/commitdiff
Merge branch 'maint'
authorAkim Demaille <akim@lrde.epita.fr>
Thu, 8 Nov 2012 08:24:51 +0000 (09:24 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Thu, 8 Nov 2012 08:26:44 +0000 (09:26 +0100)
* origin/maint:
  regen
  maint: post-release administrivia
  version 2.6.5
  regen
  tests: syntax-check
  tests: beware of compilers that do not support POSIXLY_CORRECT
  gnulib: update

Conflicts:
src/parse-gram.c
src/parse-gram.h
tests/atlocal.in

1  2 
NEWS
configure.ac
m4/c-working.m4
tests/actions.at
tests/atlocal.in
tests/local.at

diff --combined NEWS
index c067ac09150a7f85e1610ae0a557817cabfc5fc8,bb016bb37008078d2de103f7886a15ebcc42fb51..cb594715480d32941f1090fd96ea2c5df0e2bb7a
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -2,246 -2,6 +2,246 @@@ GNU Bison NEW
  
  * Noteworthy changes in release ?.? (????-??-??) [?]
  
 +** Incompatible changes
 +
 +*** Obsolete features
 +
 +  Support for YYFAIL is removed (deprecated in Bison 2.4.2).
 +  Support for yystype and yyltype (instead of YYSTYPE and YYLTYPE)
 +  is removed (deprecated in Bison 1.875).
 +  Support for YYPARSE_PARAM is removed (deprecated in Bison 1.875).
 +
 +** Warnings
 +
 +*** Enhancements of the -Werror option
 +
 +  The -Werror=CATEGORY option is now recognized, and will treat specified
 +  warnings as errors. The warnings need not have been explicitly activated
 +  using the -W option, this is similar to what GCC 4.7 does.
 +
 +  For example, given the following command line, Bison will treat both
 +  warnings related to POSIX Yacc incompatibilities and S/R conflicts as
 +  errors (and only those):
 +
 +    $ bison -Werror=yacc,error=conflicts-sr input.y
 +
 +  If no categories are specified, -Werror will make all active warnings into
 +  errors. For example, the following line does the same the previous example:
 +
 +    $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
 +
 +  (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
 +
 +  Note that the categories in this -Werror option may not be prefixed with
 +  "no-". However, -Wno-error[=CATEGORY] is valid.
 +
 +  Note that -y enables -Werror=yacc. Therefore it is now possible to require
 +  Yacc-like behavior (e.g., always generate y.tab.c), but to report
 +  incompatibilities as warnings: "-y -Wno-error=yacc".
 +
 +*** The display of warnings is now richer
 +
 +  The option that controls a given warning is now displayed:
 +
 +    foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
 +
 +  In the case of warnings treated as errors, the prefix is changed from
 +  "warning: " to "error: ", and the suffix is displayed, in a manner similar
 +  to GCC, as [-Werror=CATEGORY].
 +
 +  For instance, where the previous version of Bison would report (and exit
 +  with failure):
 +
 +    bison: warnings being treated as errors
 +    input.y:1.1: warning: stray ',' treated as white space
 +
 +  it now reports:
 +
 +    input.y:1.1: error: stray ',' treated as white space [-Werror=other]
 +
 +*** Deprecated constructs
 +
 +  The new 'deprecated' warning category flags obsolete constructs whose
 +  support will be discontinued.  It is enabled by default.  These warnings
 +  used to be reported as 'other' warnings.
 +
 +*** Useless semantic types
 +
 +  Bison now warns about useless (uninhabited) semantic types.  Since
 +  semantic types are not declared to Bison (they are defined in the opaque
 +  %union structure), it is %printer/%destructor directives about useless
 +  types that trigger the warning:
 +
 +    %token <type1> term
 +    %type  <type2> nterm
 +    %printer    {} <type1> <type3>
 +    %destructor {} <type2> <type4>
 +    %%
 +    nterm: term { $$ = $1; };
 +
 +    3.28-34: warning: type <type3> is used, but is not associated to any symbol
 +    4.28-34: warning: type <type4> is used, but is not associated to any symbol
 +
 +*** Undefined but unused symbols
 +
 +  Bison used to raise an error for undefined symbols that are not used in
 +  the grammar.  This is now only a warning.
 +
 +    %printer    {} symbol1
 +    %destructor {} symbol2
 +    %type <type>   symbol3
 +    %%
 +    exp: "a";
 +
 +*** Useless destructors or printers
 +
 +  Bison now warns about useless destructors or printers.  In the following
 +  example, the printer for <type1>, and the destructor for <type2> are
 +  useless: all symbols of <type1> (token1) already have a printer, and all
 +  symbols of type <type2> (token2) already have a destructor.
 +
 +    %token <type1> token1
 +           <type2> token2
 +           <type3> token3
 +           <type4> token4
 +    %printer    {} token1 <type1> <type3>
 +    %destructor {} token2 <type2> <type4>
 +
 +*** Conflicts
 +
 +  The warnings and error messages about shift/reduce and reduce/reduce
 +  conflicts have been normalized.  For instance on the following foo.y file:
 +
 +    %glr-parser
 +    %%
 +    exp: exp '+' exp | '0' | '0';
 +
 +  compare the previous version of bison:
 +
 +    $ bison foo.y
 +    foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
 +    $ bison -Werror foo.y
 +    bison: warnings being treated as errors
 +    foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
 +
 +  with the new behavior:
 +
 +    $ bison foo.y
 +    foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 +    foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
 +    $ bison -Werror foo.y
 +    foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
 +    foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
 +
 +  When %expect or %expect-rr is used, such as with bar.y:
 +
 +    %expect 0
 +    %glr-parser
 +    %%
 +    exp: exp '+' exp | '0' | '0';
 +
 +  Former behavior:
 +
 +    $ bison bar.y
 +    bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
 +    bar.y: expected 0 shift/reduce conflicts
 +    bar.y: expected 0 reduce/reduce conflicts
 +
 +  New one:
 +
 +    $ bison bar.y
 +    bar.y: error: shift/reduce conflicts: 1 found, 0 expected
 +    bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
 +
 +** Additional yylex/yyparse arguments
 +
 +  The new directive %param declares additional arguments to both yylex and
 +  yyparse.  The %lex-param, %parse-param, and %param directives support one
 +  or more arguments.  Instead of
 +
 +    %lex-param   {arg1_type *arg1}
 +    %lex-param   {arg2_type *arg2}
 +    %parse-param {arg1_type *arg1}
 +    %parse-param {arg2_type *arg2}
 +
 +  one may now declare
 +
 +    %param {arg1_type *arg1} {arg2_type *arg2}
 +
 +** Java skeleton improvements
 +
 +  The constants for token names were moved to the Lexer interface.  Also, it
 +  is possible to add code to the parser's constructors using "%code init"
 +  and "%define init_throws".
 +
 +** C++ skeletons improvements
 +
 +*** The parser header is no longer mandatory (lalr1.cc, glr.cc)
 +
 +  Using %defines is now optional.  Without it, the needed support classes
 +  are defined in the generated parser, instead of additional files (such as
 +  location.hh, position.hh and stack.hh).
 +
 +*** Locations are no longer mandatory (lalr1.cc, glr.cc)
 +
 +  Both lalr1.cc and glr.cc no longer require %location.
 +
 +*** syntax_error exception (lalr1.cc)
 +
 +  The C++ parser features a syntax_error exception, which can be
 +  thrown from the scanner or from user rules to raise syntax errors.
 +  This facilitates reporting errors caught in sub-functions (e.g.,
 +  rejecting too large integral literals from a conversion function
 +  used by the scanner, or rejecting invalid combinations from a
 +  factory invoked by the user actions).
 +
 +** Variable api.token.prefix
 +
 +  The variable api.token.prefix changes the way tokens are identified in
 +  the generated files.  This is especially useful to avoid collisions
 +  with identifiers in the target language.  For instance
 +
 +    %token FILE for ERROR
 +    %define api.token.prefix "TOK_"
 +    %%
 +    start: FILE for ERROR;
 +
 +  will generate the definition of the symbols TOK_FILE, TOK_for, and
 +  TOK_ERROR in the generated sources.  In particular, the scanner must
 +  use these prefixed token names, although the grammar itself still
 +  uses the short names (as in the sample rule given above).
 +
 +** Renamed %define variables
 +
 +  The following variables have been renamed for consistency.  Backward
 +  compatibility is ensured, but upgrading is recommended.
 +
 +    lr.default-reductions      -> lr.default-reduction
 +    lr.keep-unreachable-states -> lr.keep-unreachable-state
 +    namespace                  -> api.namespace
 +
 +** Variable parse.error
 +
 +  This variable controls the verbosity of error messages.  The use of the
 +  %error-verbose directive is deprecated in favor of "%define parse.error
 +  verbose".
 +
 +** Semantic predicates
 +
 +  The new, experimental, semantic-predicate feature allows actions of the
 +  form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
 +  YYERROR) if the expression evaluates to 0, and are evaluated immediately
 +  in GLR parsers, rather than being deferred.  The result is that they allow
 +  the programmer to prune possible parses based on the values of run-time
 +  expressions.
 +
 +** The directive %expect-rr is now an error in non GLR mode
 +
 +  It used to be an error only if used in non GLR mode, _and_ if there are
 +  reduce/reduce conflicts.
 +
 +* Noteworthy changes in release ?.? (????-??-??) [?]
 +
  ** Changes in the format of error messages
  
    This used to be the format of many error reports:
    The reductions are now explicitly represented as transitions to other
    diamond shaped nodes.
  
- * Noteworthy changes in release ?.? (????-??-??) [?]
+ * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
  
    We consider compiler warnings about Bison generated parsers to be bugs.
    Rather than working around them in your own project, please consider
  
  * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
  
 -  Bison no longer executes user-specified M4 code when processing a grammar.
 + Bison no longer executes user-specified M4 code when processing a grammar.
  
  ** Future Changes
  
  
  * Noteworthy changes in release 2.6 (2012-07-19) [stable]
  
 -** Future Changes
 +** Future changes
  
    The next major release of Bison will drop support for the following
    deprecated features.  Please report disagreements to bug-bison@gnu.org.
@@@ -2215,8 -1975,8 +2215,8 @@@ along with this program.  If not, see <
   LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
   LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
   LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
 - LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp calc yyo fval Wmaybe
 - LocalWords:  yyvsp pragmas noreturn java's
 + LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
 + LocalWords:  TOK calc yyo fval Wconflicts
  
  Local Variables:
  mode: outline
diff --combined configure.ac
index 8a297ff52ac8e8ae8731b2ceda8ff08879601517,83e20acb01ade45da8f32b2fd046315dd6bd1a16..aec681ad5d3d726a4e373e9a0797de84cb291827
@@@ -45,9 -45,7 +45,9 @@@ AC_CONFIG_MACRO_DIR([m4]
  # releases, we want to be able run make dist without being required to
  # add a bogus NEWS entry.  In that case, the version string
  # automatically contains a dash, which we also let disable gnits.
 -AM_INIT_AUTOMAKE([1.11.1 dist-xz silent-rules]
 +AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
 +                 color-tests parallel-tests
 +                 silent-rules]
                   m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
                             [gnu], [gnits]))
  AM_SILENT_RULES([yes])
@@@ -73,7 -71,6 +73,7 @@@ if test "$enable_gcc_warnings" = yes; t
    warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
      -Wshadow -Wstrict-prototypes'
    warn_cxx='-Wnoexcept'
 +
    AC_LANG_PUSH([C])
    # Clang supports many of GCC's -W options, but only issues warnings
    # on the ones it does not recognize.  In that case, gl_WARN_ADD
@@@ -117,6 -114,7 +117,7 @@@ f
  
  BISON_TEST_FOR_WORKING_C_COMPILER
  BISON_TEST_FOR_WORKING_CXX_COMPILER
+ BISON_C_COMPILER_POSIXLY_CORRECT
  
  AC_ARG_ENABLE([yacc],
    [AC_HELP_STRING([--disable-yacc],
    , [enable_yacc=yes])
  case $enable_yacc in
  yes)
 -  YACC_SCRIPT=yacc
 -  YACC_LIBRARY=liby.a;;
 +  YACC_SCRIPT=src/yacc
 +  YACC_LIBRARY=lib/liby.a;;
  *)
    YACC_SCRIPT=
    YACC_LIBRARY=;;
@@@ -184,7 -182,7 +185,7 @@@ AC_CONFIG_FILES([etc/bench.pl], [chmod 
  
  # Initialize the test suite.
  AC_CONFIG_TESTDIR(tests)
 -AC_CONFIG_FILES([tests/Makefile tests/atlocal])
 +AC_CONFIG_FILES([tests/atlocal])
  AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
  AC_CHECK_PROGS([VALGRIND], [valgrind])
  case $VALGRIND:$host_os in
@@@ -201,10 -199,17 +202,10 @@@ AM_MISSING_PROG([AUTOM4TE], [autom4te]
  # Needed by tests/atlocal.in.
  AC_SUBST([GCC])
  
 -gt_JAVACOMP([1.3])
 +gt_JAVACOMP([1.3], [1.4])
  gt_JAVAEXEC
  
  AC_CONFIG_FILES([Makefile
 -               build-aux/Makefile
 -               po/Makefile.in
 -               data/Makefile
 -               etc/Makefile
 -               examples/Makefile
 -                  examples/calc++/Makefile
 -               lib/Makefile src/Makefile
 -               doc/Makefile
 -                 doc/yacc.1])
 +                 po/Makefile.in
 +                 doc/yacc.1])
  AC_OUTPUT
diff --combined m4/c-working.m4
index fbc6da446b5f5096d3b4803a2cb4af092746280f,0db60f764725b461540896ce320702ebab842adc..ee84acf9f34ecce0947b103b78fe99c95c047791
@@@ -21,7 -21,51 +21,51 @@@ AC_DEFUN([BISON_TEST_FOR_WORKING_C_COMP
    AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM(
         [[#include <limits.h>
 -       int test_array[CHAR_BIT];]])],
 +         int test_array[CHAR_BIT];]])],
      [],
      [AC_MSG_FAILURE([cannot compile a simple C program])])
  ])
+ # BISON_CHECK_WITH_POSIXLY_CORRECT(CODE)
+ # --------------------------------------
+ # Run the Autoconf CODE with POSIXLY_CORRECT set to 1, and restored to
+ # its initial value afterwards.
+ AC_DEFUN([BISON_CHECK_WITH_POSIXLY_CORRECT],
+ [gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
+ case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
+   xx) gl_had_POSIXLY_CORRECT=exported ;;
+   x)  gl_had_POSIXLY_CORRECT=yes      ;;
+   *)  gl_had_POSIXLY_CORRECT=         ;;
+ esac
+ POSIXLY_CORRECT=1
+ export POSIXLY_CORRECT
+ $1
+ case $gl_had_POSIXLY_CORRECT in
+   exported) ;;
+   yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
+   *) AS_UNSET([POSIXLY_CORRECT]) ;;
+ esac
+ ])
+ # BISON_C_COMPILER_POSIXLY_CORRECT
+ # --------------------------------
+ # Whether the compiler supports -g in POSIXLY_CORRECT mode.  clang-2.9
+ # on OS X does not, because "clang-mp-2.9 -o test -g test.c" launches
+ # "/usr/bin/dsymutil test -o test.dSYM" which fails with "error:
+ # unable to open executable '-o'".
+ #
+ # Sets C_COMPILER_POSIXLY_CORRECT to true/false.
+ AC_DEFUN([BISON_C_COMPILER_POSIXLY_CORRECT],
+ [AC_CACHE_CHECK([whether $CC supports POSIXLY_CORRECT=1],
+                 [bison_cv_cc_supports_posixly_correct],
+ [BISON_CHECK_WITH_POSIXLY_CORRECT(
+ [AC_LANG_PUSH([C])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM],
+                 [bison_cv_cc_supports_posixly_correct=yes],
+                 [bison_cv_cc_supports_posixly_correct=no])
+ AC_LANG_POP([C])])])
+ case $bison_cv_cc_supports_posixly_correct in
+   yes) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [true]) ;;
+   no)  AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [false]);;
+ esac
+ ])
diff --combined tests/actions.at
index 7b220a280ce4918e9efdca56fbabe678dd534354,ec88cb9b36f52b9499782753b00be1b57fd3fb68..01fecc6349fa295cd6723815793f273f2a410872
@@@ -1,4 -1,4 +1,4 @@@
 -# Executing Actions.                               -*- Autotest -*-
 +e# Executing Actions.                               -*- Autotest -*-
  
  # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  
@@@ -30,7 -30,7 +30,7 @@@ AT_SETUP([Mid-rule actions]
  
  AT_BISON_OPTION_PUSHDEFS
  AT_DATA_GRAMMAR([[input.y]],
 -[[%error-verbose
 +[[%define parse.error verbose
  %debug
  %{
  ]AT_YYERROR_DECLARE[
@@@ -75,7 -75,7 +75,7 @@@ AT_CLEANU
  
  # AT_TEST(SKELETON-NAME, DIRECTIVES)
  # ----------------------------------
- # Check the the initial location is correct.
+ # Check that the initial location is correct.
  m4_pushdef([AT_TEST],
  [AT_SETUP([Initial location: $1 $2])
  
@@@ -150,7 -150,7 +150,7 @@@ AT_SETUP([Exotic Dollars]
  
  AT_BISON_OPTION_PUSHDEFS
  AT_DATA_GRAMMAR([[input.y]],
 -[[%error-verbose
 +[[%define parse.error verbose
  %debug
  %{
  ]AT_YYERROR_DECLARE[
@@@ -206,7 -206,7 +206,7 @@@ AT_PARSER_CHECK([./input], 0
  AT_DATA_GRAMMAR([[input.y]],
  [[
  %{
 -#include <stdio.h>
 +# include <stdio.h>
  ]AT_YYERROR_DECLARE[
  ]AT_YYLEX_DECLARE[
    typedef struct { int val; } stype;
@@@ -333,7 -333,7 +333,7 @@@ input
        V(input, $$, @$, ": /* Nothing */\n");
      }
  | line input /* Right recursive to load the stack so that popping at
 -              END can be exercised.  */
 +                END can be exercised.  */
      {
        $$ = 2;
        V(input, $$, @$, ": ");
@@@ -374,7 -374,7 +374,7 @@@ line
        $$ = -1;
        V(line,  $$, @$, ": ");
        V('(',   $1, @1, " ");
 -      fprintf (stderr, "error (@%d-%d) ", RANGE (@2));
 +      fprintf (stderr, "error (@%d-%d) ", RANGE(@2));
        V(')',   $3, @3, "\n");
      }
  ;
@@@ -630,7 -630,7 +630,7 @@@ m4_define([AT_CHECK_PRINTER_AND_DESTRUC
  
  $3
  _AT_CHECK_PRINTER_AND_DESTRUCTOR($[1], $[2], $[3], $[4],
 -[%error-verbose
 +[%define parse.error verbose
  %debug
  %verbose
  %locations
@@@ -641,13 -641,13 +641,13 @@@ AT_CLEANU
  
  
  AT_CHECK_PRINTER_AND_DESTRUCTOR([])
 -AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union])
 +AT_CHECK_PRINTER_AND_DESTRUCTOR([], [with union])
  
  AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
 -AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union])
 +AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [with union])
  
  AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
 -AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union])
 +AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union])
  
  
  
  AT_SETUP([Default tagless %printer and %destructor])
  AT_BISON_OPTION_PUSHDEFS([%locations])
  AT_DATA_GRAMMAR([[input.y]],
 -[[%error-verbose
 +[[%define parse.error verbose
  %debug
  %locations
  
@@@ -711,10 -711,7 +711,10 @@@ main (void
  }
  ]])
  
 -AT_BISON_CHECK([-o input.c input.y])
 +AT_BISON_CHECK([-o input.c input.y], [], [],
 +[[input.y:23.3-5: warning: useless %destructor for type <*> [-Wother]
 +input.y:23.3-5: warning: useless %printer for type <*> [-Wother]
 +]])
  AT_COMPILE([input])
  AT_PARSER_CHECK([./input], 1,
  [[<> destructor for 'd' @ 4.
@@@ -762,7 -759,7 +762,7 @@@ AT_CLEANU
  AT_SETUP([Default tagged and per-type %printer and %destructor])
  AT_BISON_OPTION_PUSHDEFS
  AT_DATA_GRAMMAR([[input.y]],
 -[[%error-verbose
 +[[%define parse.error verbose
  %debug
  
  %{
@@@ -826,10 -823,7 +826,10 @@@ main (void
  }
  ]])
  
 -AT_BISON_CHECK([-o input.c input.y])
 +AT_BISON_CHECK([-o input.c input.y], [], [],
 +[[input.y:22.3-4: warning: useless %destructor for type <> [-Wother]
 +input.y:22.3-4: warning: useless %printer for type <> [-Wother]
 +]])
  AT_COMPILE([input])
  AT_PARSER_CHECK([./input], 1,
  [[<*>/<field2>/e destructor.
@@@ -888,16 -882,16 +888,16 @@@ AT_CLEANU
  
  AT_SETUP([Default %printer and %destructor for user-defined end token])
  
 -# _AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(TYPED)
 -# -------------------------------------------------------------
 -m4_define([_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN],
 +# AT_TEST(TYPED)
 +# --------------
 +m4_pushdef([AT_TEST],
  [m4_if($1, 0,
    [m4_pushdef([kind], []) m4_pushdef([not_kind], [*])],
    [m4_pushdef([kind], [*]) m4_pushdef([not_kind], [])])
  
  AT_BISON_OPTION_PUSHDEFS([%locations])
  AT_DATA_GRAMMAR([[input]]$1[[.y]],
 -[[%error-verbose
 +[[%define parse.error verbose
  %debug
  %locations
  
@@@ -958,17 -952,8 +958,17 @@@ main (void
  ]])
  AT_BISON_OPTION_POPDEFS
  
 -AT_BISON_CHECK([-o input$1.c input$1.y])
 +AT_BISON_CHECK([-o input$1.c input$1.y], [], [],
 +[m4_if([$1], [0],
 +[[input0.y:23.3-5: warning: useless %destructor for type <*> [-Wother]
 +input0.y:23.3-5: warning: useless %printer for type <*> [-Wother]
 +]],
 +[[input1.y:23.3-4: warning: useless %destructor for type <> [-Wother]
 +input1.y:23.3-4: warning: useless %printer for type <> [-Wother]
 +]])])
 +
  AT_COMPILE([input$1])
 +
  AT_PARSER_CHECK([./input$1], 0,
  [[<]]kind[[> for 'E' @ 1.
  <]]kind[[> for 'S' @ 1.
@@@ -991,10 -976,8 +991,10 @@@ m4_popdef([kind]
  m4_popdef([not_kind])
  ])
  
 -_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(0)
 -_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN(1)
 +AT_TEST(0)
 +AT_TEST(1)
 +
 +m4_popdef([AT_TEST])
  
  AT_CLEANUP
  
@@@ -1054,10 -1037,7 +1054,10 @@@ main (void
  ]])
  AT_BISON_OPTION_POPDEFS
  
 -AT_BISON_CHECK([-o input.c input.y])
 +AT_BISON_CHECK([-o input.c input.y], [], [],
 +[[input.y:21.6-8: warning: useless %destructor for type <*> [-Wother]
 +input.y:21.6-8: warning: useless %printer for type <*> [-Wother]
 +]])
  AT_COMPILE([input])
  AT_PARSER_CHECK([./input], [1], [],
  [[Starting parse
@@@ -1156,10 -1136,7 +1156,10 @@@ main (void
  ]])
  AT_BISON_OPTION_POPDEFS
  
 -AT_BISON_CHECK([-o input.c input.y])
 +AT_BISON_CHECK([-o input.c input.y], [], [],
 +[[input.y:22.3-4: warning: useless %destructor for type <> [-Wother]
 +input.y:22.3-4: warning: useless %printer for type <> [-Wother]
 +]])
  AT_COMPILE([input])
  
  AT_CLEANUP
@@@ -1216,10 -1193,8 +1216,10 @@@ main (void
  AT_BISON_OPTION_POPDEFS
  
  AT_BISON_CHECK([-o input.c input.y], 0,,
 -[[input.y:33.3-23: warning: unset value: $$
 -input.y:30.3-35.37: warning: unused value: $3
 +[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
 +input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
 +input.y:33.3-23: warning: unset value: $$ [-Wother]
 +input.y:30.3-35.37: warning: unused value: $3 [-Wother]
  ]])
  
  AT_COMPILE([input])
@@@ -1320,9 -1295,8 +1320,9 @@@ AT_CHECK_ACTION_LOCATIONS([[%printer]]
  ## Qualified $$ in actions.  ##
  ## ------------------------- ##
  
 -# Check that we can used qualified $$ (v.g., $<type>$) not only in
 -# rule actions, but also where $$ is valid: %printer and %destructor.
 +# Check that we can use qualified $$ (v.g., $<type>$) not only in rule
 +# actions, but also where $$ is valid: %destructor/%printer and
 +# %initial-action.
  #
  # FIXME: Not actually checking %destructor, but it's the same code as
  # %printer...
  m4_pushdef([AT_TEST],
  [AT_SETUP([[Qualified $$ in actions: $1]])
  
 -AT_BISON_OPTION_PUSHDEFS([%locations %skeleton "$1"])
 +AT_BISON_OPTION_PUSHDEFS([%skeleton "$1"])
  
  AT_DATA_GRAMMAR([[input.y]],
  [[%skeleton "$1"
 -%defines   // FIXME: Mandated by lalr1.cc in Bison 2.6.
 -%locations // FIXME: Mandated by lalr1.cc in Bison 2.6.
  %debug
  %code requires
  {
@@@ -1414,7 -1390,10 +1414,7 @@@ AT_FULL_COMPILE([[input]]
  AT_PARSER_CHECK([./input], 0, [], [stderr])
  # Don't be too picky on the traces, GLR is not exactly the same.  Keep
  # only the lines from the printer.
 -#
 -# Don't care about locations.  FIXME: remove their removal when Bison
 -# supports C++ without locations.
 -AT_CHECK([[sed -ne 's/([-0-9.]*: /(/;/ival:/p' stderr]], 0,
 +AT_CHECK([[sed -ne '/ival:/p' stderr]], 0,
  [[Reading a token: Next token is token UNTYPED (ival: 10, fval: 0.1)
  Shifting token UNTYPED (ival: 10, fval: 0.1)
  Reading a token: Next token is token INT (ival: 20, fval: 0.2)
@@@ -1452,37 -1431,37 +1452,37 @@@ AT_DATA([input.y]
  start: test2 test1 test0 testc;
  
  test2
 -: 'a' { semi;                 /* TEST:N:2 */ }
 -| 'b' { if (0) {no_semi}      /* TEST:N:2 */ }
 -| 'c' { if (0) {semi;}                /* TEST:N:2 */ }
 -| 'd' { semi;   no_semi               /* TEST:Y:2 */ }
 -| 'e' { semi(); no_semi()     /* TEST:Y:2 */ }
 -| 'f' { semi[]; no_semi[]     /* TEST:Y:2 */ }
 -| 'g' { semi++; no_semi++     /* TEST:Y:2 */ }
 -| 'h' { {no_semi} no_semi     /* TEST:Y:2 */ }
 -| 'i' { {semi;}   no_semi     /* TEST:Y:2 */ }
 +: 'a' { semi;                   /* TEST:N:2 */ }
 +| 'b' { if (0) {no_semi}        /* TEST:N:2 */ }
 +| 'c' { if (0) {semi;}          /* TEST:N:2 */ }
 +| 'd' { semi;   no_semi         /* TEST:Y:2 */ }
 +| 'e' { semi(); no_semi()       /* TEST:Y:2 */ }
 +| 'f' { semi[]; no_semi[]       /* TEST:Y:2 */ }
 +| 'g' { semi++; no_semi++       /* TEST:Y:2 */ }
 +| 'h' { {no_semi} no_semi       /* TEST:Y:2 */ }
 +| 'i' { {semi;}   no_semi       /* TEST:Y:2 */ }
  ;
  test1
 -  : 'a' { semi;                       // TEST:N:1 ;
 -} | 'b' { if (0) {no_semi}    // TEST:N:1 ;
 -} | 'c' { if (0) {semi;}      // TEST:N:1 ;
 -} | 'd' { semi;   no_semi     // TEST:Y:1 ;
 -} | 'e' { semi(); no_semi()   // TEST:Y:1 ;
 -} | 'f' { semi[]; no_semi[]   // TEST:Y:1 ;
 -} | 'g' { semi++; no_semi++   // TEST:Y:1 ;
 -} | 'h' { {no_semi} no_semi   // TEST:Y:1 ;
 -} | 'i' { {semi;}   no_semi   // TEST:Y:1 ;
 +  : 'a' { semi;                 // TEST:N:1 ;
 +} | 'b' { if (0) {no_semi}      // TEST:N:1 ;
 +} | 'c' { if (0) {semi;}        // TEST:N:1 ;
 +} | 'd' { semi;   no_semi       // TEST:Y:1 ;
 +} | 'e' { semi(); no_semi()     // TEST:Y:1 ;
 +} | 'f' { semi[]; no_semi[]     // TEST:Y:1 ;
 +} | 'g' { semi++; no_semi++     // TEST:Y:1 ;
 +} | 'h' { {no_semi} no_semi     // TEST:Y:1 ;
 +} | 'i' { {semi;}   no_semi     // TEST:Y:1 ;
  } ;
  test0
 -  : 'a' { semi;                       // TEST:N:1 {}
 -} | 'b' { if (0) {no_semi}    // TEST:N:1 {}
 -} | 'c' { if (0) {semi;}      // TEST:N:1 {}
 -} | 'd' { semi;   no_semi     // TEST:Y:1 {}
 -} | 'e' { semi(); no_semi()   // TEST:Y:1 {}
 -} | 'f' { semi[]; no_semi[]   // TEST:Y:1 {}
 -} | 'g' { semi++; no_semi++   // TEST:Y:1 {}
 -} | 'h' { {no_semi} no_semi   // TEST:Y:1 {}
 -} | 'i' { {semi;}   no_semi   // TEST:Y:1 {}
 +  : 'a' { semi;                 // TEST:N:1 {}
 +} | 'b' { if (0) {no_semi}      // TEST:N:1 {}
 +} | 'c' { if (0) {semi;}        // TEST:N:1 {}
 +} | 'd' { semi;   no_semi       // TEST:Y:1 {}
 +} | 'e' { semi(); no_semi()     // TEST:Y:1 {}
 +} | 'f' { semi[]; no_semi[]     // TEST:Y:1 {}
 +} | 'g' { semi++; no_semi++     // TEST:Y:1 {}
 +} | 'h' { {no_semi} no_semi     // TEST:Y:1 {}
 +} | 'i' { {semi;}   no_semi     // TEST:Y:1 {}
  } ;
  
  testc
@@@ -1499,42 -1478,42 +1499,42 @@@ string;"
  AT_BISON_OPTION_POPDEFS
  
  AT_BISON_CHECK([[-o input.c input.y]], [0], [],
 -[[input.y:8.48: warning: a ';' might be needed at the end of action code
 -input.y:8.48: warning: future versions of Bison will not add the ';'
 -input.y:9.48: warning: a ';' might be needed at the end of action code
 -input.y:9.48: warning: future versions of Bison will not add the ';'
 -input.y:10.48: warning: a ';' might be needed at the end of action code
 -input.y:10.48: warning: future versions of Bison will not add the ';'
 -input.y:11.48: warning: a ';' might be needed at the end of action code
 -input.y:11.48: warning: future versions of Bison will not add the ';'
 -input.y:12.48: warning: a ';' might be needed at the end of action code
 -input.y:12.48: warning: future versions of Bison will not add the ';'
 -input.y:13.48: warning: a ';' might be needed at the end of action code
 -input.y:13.48: warning: future versions of Bison will not add the ';'
 -input.y:20.1: warning: a ';' might be needed at the end of action code
 -input.y:20.1: warning: future versions of Bison will not add the ';'
 -input.y:21.1: warning: a ';' might be needed at the end of action code
 -input.y:21.1: warning: future versions of Bison will not add the ';'
 -input.y:22.1: warning: a ';' might be needed at the end of action code
 -input.y:22.1: warning: future versions of Bison will not add the ';'
 -input.y:23.1: warning: a ';' might be needed at the end of action code
 -input.y:23.1: warning: future versions of Bison will not add the ';'
 -input.y:24.1: warning: a ';' might be needed at the end of action code
 -input.y:24.1: warning: future versions of Bison will not add the ';'
 -input.y:25.1: warning: a ';' might be needed at the end of action code
 -input.y:25.1: warning: future versions of Bison will not add the ';'
 -input.y:31.1: warning: a ';' might be needed at the end of action code
 -input.y:31.1: warning: future versions of Bison will not add the ';'
 -input.y:32.1: warning: a ';' might be needed at the end of action code
 -input.y:32.1: warning: future versions of Bison will not add the ';'
 -input.y:33.1: warning: a ';' might be needed at the end of action code
 -input.y:33.1: warning: future versions of Bison will not add the ';'
 -input.y:34.1: warning: a ';' might be needed at the end of action code
 -input.y:34.1: warning: future versions of Bison will not add the ';'
 -input.y:35.1: warning: a ';' might be needed at the end of action code
 -input.y:35.1: warning: future versions of Bison will not add the ';'
 -input.y:36.1: warning: a ';' might be needed at the end of action code
 -input.y:36.1: warning: future versions of Bison will not add the ';'
 +[[input.y:8.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:8.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:9.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:9.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:10.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:10.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:11.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:11.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:12.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:12.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:13.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:13.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:20.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:20.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:21.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:21.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:22.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:22.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:23.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:23.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:24.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:24.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:25.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:25.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:31.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:31.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:32.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:32.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:33.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:33.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:34.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:34.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:35.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:35.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
 +input.y:36.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
 +input.y:36.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
  ]])
  
  AT_MATCHES_CHECK([input.c], [[/\* TEST:N:2 \*/ \}$]],       [[3]])
diff --combined tests/atlocal.in
index e350d137b23905cb445e4db3653c2028ca8034a9,5e3cb723a48837d92e3782cc56616ab3b4b82587..16e6fda89ef75ab6b0a22f04270aa3ef79fe2e69
@@@ -1,4 -1,4 +1,4 @@@
 -# @configure_input@                                   -*- shell-script -*-
 +# @configure_input@                                     -*- shell-script -*-
  # Configurable variable values for Bison test suite.
  
  # Copyright (C) 2000-2012 Free Software Foundation, Inc.
@@@ -62,9 -62,8 +62,9 @@@ CONF_JAVAC='@CONF_JAVAC@
  # Empty if no Java VM was found
  CONF_JAVA='@CONF_JAVA@'
  
 -# We need egrep.
 +# We need egrep and perl.
  : ${EGREP='@EGREP@'}
 +: ${PERL='@PERL@'}
  
  # Use simple quotes (lib/quote.c).
  LC_CTYPE=C
@@@ -79,9 -78,14 +79,18 @@@ LIBS="$abs_top_builddir/lib/libbison.a 
  # Empty if no xsltproc was found
  : ${XSLTPROC='@XSLTPROC@'}
  
 -: ${PERL='@PERL@'}
 -
+ # Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
+ # as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
+ # the environment variable.
+ : ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
+ if env | grep '^POSIXLY_CORRECT=' >/dev/null; then
+   POSIXLY_CORRECT_IS_EXPORTED=true
+ else
+   POSIXLY_CORRECT_IS_EXPORTED=false
+ fi
 +
 +# Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known.
 +if "$at_arg_compile_c_with_cxx"; then
 +  CC=$CXX
 +  CFLAGS=$CXXFLAGS
 +fi
diff --combined tests/local.at
index d120712d3bc27a60be23b7a57f725439fc63e7f1,88e797f5a272b354046a0a2da6ace722f71a1651..fb74fafc6c50de3b191b7b346efffb339a8c1bf3
@@@ -109,7 -109,7 +109,7 @@@ m4_define([AT_BISON_OPTION_PUSHDEFS]
  # --------------------------------------------------
  # This macro works around the impossibility to define macros
  # inside macros, because issuing `[$1]' is not possible in M4 :(.
 -# This sucks hard, GNU M4 should really provide M5 like $$1.
 +# This sucks hard, GNU M4 should really provide M5-like $$1.
  m4_define([_AT_BISON_OPTION_PUSHDEFS],
  [m4_if([$1$2], $[1]$[2], [],
         [m4_fatal([$0: Invalid arguments: $@])])dnl
@@@ -142,8 -142,7 +142,8 @@@ m4_pushdef([AT_LOCATION_TYPE_IF]
  m4_pushdef([AT_PARAM_IF],
  [m4_bmatch([$3], [%parse-param], [$1], [$2])])
  # Comma-terminated list of formals parse-parameters.
 -# E.g., %parse-param { int x } {int y} -> "int x, int y, ".
 +# E.g., %parse-param { int x } %parse-param {int y} -> "int x, int y, ".
 +# FIXME: Support grouped parse-param.
  m4_pushdef([AT_PARSE_PARAMS])
  m4_bpatsubst([$3], [%parse-param { *\([^{}]*[^{} ]\) *}],
               [m4_append([AT_PARSE_PARAMS], [\1, ])])
@@@ -160,11 -159,6 +160,11 @@@ m4_pushdef([AT_NAME_PREFIX]
  [m4_bmatch([$3], [\(%define api\.prefix\|%name-prefix\) ".*"],
             [m4_bregexp([$3], [\(%define api\.prefix\|%name-prefix\) "\([^""]*\)"], [\2])],
             [yy])])
 +m4_pushdef([AT_TOKEN_CTOR_IF],
 +[m4_bmatch([$3], [%define api.token.constructor], [$1], [$2])])
 +m4_pushdef([AT_TOKEN_PREFIX],
 +[m4_bmatch([$3], [%define api.token.prefix ".*"],
 +           [m4_bregexp([$3], [%define api.token.prefix "\(.*\)"], [\1])])])
  m4_pushdef([AT_API_prefix],
  [m4_bmatch([$3], [%define api\.prefix ".*"],
             [m4_bregexp([$3], [%define api\.prefix "\([^""]*\)"], [\1])],
@@@ -174,20 -168,20 +174,20 @@@ m4_pushdef([AT_API_PREFIX]
  # yyerror receives the location if %location & %pure & (%glr or %parse-param).
  m4_pushdef([AT_YYERROR_ARG_LOC_IF],
  [AT_GLR_OR_PARAM_IF([AT_PURE_AND_LOC_IF([$1], [$2])],
 -                  [$2])])
 +                    [$2])])
  # yyerror always sees the locations (when activated), except if
  # (yacc & pure & !param).  FIXME: This is wrong.  See the manual.
  m4_pushdef([AT_YYERROR_SEES_LOC_IF],
  [AT_LOCATION_IF([AT_YACC_IF([AT_PURE_IF([AT_PARAM_IF([$1], [$2])],
 -                                      [$1])],
 -                          [$1])],
 -              [$2])])
 +                                        [$1])],
 +                            [$1])],
 +                [$2])])
  
  # The interface is pure: either because %define api.pure, or because we
  # are using the C++ parsers.
  m4_pushdef([AT_PURE_LEX_IF],
  [AT_PURE_IF([$1],
 -          [AT_SKEL_CC_IF([$1], [$2])])])
 +            [AT_SKEL_CC_IF([$1], [$2])])])
  
  m4_pushdef([AT_YYSTYPE],
  [AT_SKEL_CC_IF([AT_NAME_PREFIX[::parser::semantic_type]],
@@@ -201,15 -195,15 +201,15 @@@ AT_PURE_LEX_IF
  [m4_pushdef([AT_LOC], [(*llocp)])
   m4_pushdef([AT_VAL], [(*lvalp)])
   m4_pushdef([AT_YYLEX_FORMALS],
 -          [AT_YYSTYPE *lvalp[]AT_LOCATION_IF([, AT_YYLTYPE *llocp])])
 +            [AT_YYSTYPE *lvalp[]AT_LOCATION_IF([, AT_YYLTYPE *llocp])])
   m4_pushdef([AT_YYLEX_ARGS],
 -          [lvalp[]AT_LOCATION_IF([, llocp])])
 +            [lvalp[]AT_LOCATION_IF([, llocp])])
   m4_pushdef([AT_USE_LEX_ARGS],
 -          [(void) lvalp;AT_LOCATION_IF([(void) llocp])])
 +            [(void) lvalp;AT_LOCATION_IF([(void) llocp])])
   m4_pushdef([AT_YYLEX_PRE_FORMALS],
 -          [AT_YYLEX_FORMALS, ])
 +            [AT_YYLEX_FORMALS, ])
   m4_pushdef([AT_YYLEX_PRE_ARGS],
 -          [AT_YYLEX_ARGS, ])
 +            [AT_YYLEX_ARGS, ])
  ],
  [m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
   m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
@@@ -228,8 -222,6 +228,8 @@@ AT_SKEL_CC_IF
      [AT_LOC_PUSHDEF([begin.line], [begin.column], [end.line], [end.column])])],
    [AT_LOC_PUSHDEF([first_line], [first_column], [last_line], [last_column])])
  
 +
 +AT_GLR_IF([AT_KEYWORDS([glr])])
  ])# _AT_BISON_OPTION_PUSHDEFS
  
  
@@@ -251,8 -243,6 +251,8 @@@ m4_popdef([AT_YYERROR_SEES_LOC_IF]
  m4_popdef([AT_YYERROR_ARG_LOC_IF])
  m4_popdef([AT_API_PREFIX])
  m4_popdef([AT_API_prefix])
 +m4_popdef([AT_TOKEN_PREFIX])
 +m4_popdef([AT_TOKEN_CTOR_IF])
  m4_popdef([AT_NAME_PREFIX])
  m4_popdef([AT_GLR_OR_PARAM_IF])
  m4_popdef([AT_PURE_AND_LOC_IF])
@@@ -402,11 -392,13 +402,11 @@@ AT_YYERROR_SEES_LOC_IF([
  }]],
  [c++], [[/* A C++ error reporting function.  */
  void
 -]AT_NAME_PREFIX[::parser::error (const location_type& l, const std::string& m)
 -{
 -  (void) l;
 -  std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << std::endl;
 +]AT_NAME_PREFIX[::parser::error (]AT_LOCATION_IF([[const location_type& l, ]])[const std::string& m)
 +{  std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << std::endl;
  }]],
  [java], [AT_LOCATION_IF([[public void yyerror (Calc.Location l, String s)
 -  {
 +{
      if (l == null)
        System.err.println (s);
      else
@@@ -453,6 -445,10 +453,6 @@@ m4_define([AT_BISON_CHECK]
  [m4_null_if([$2], [AT_BISON_CHECK_XML($@)])
  AT_BISON_CHECK_NO_XML($@)])
  
 -m4_define([AT_BISON_WERROR_MSG],
 -          [[bison: warnings being treated as errors]])
 -
 -
  # AT_BISON_CHECK_(BISON_ARGS, [OTHER_AT_CHECK_ARGS])
  # --------------------------------------------------
  # Low-level macro to run bison once.
@@@ -472,12 -468,8 +472,8 @@@ m4_define([AT_BISON_CHECK_WARNINGS_]
  [[# Defining POSIXLY_CORRECT causes bison to complain if options are
  # added after the grammar file name, so skip these checks in that
  # case.
- #
- # Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
- # as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
- # the environment variable.
- if env | grep '^POSIXLY_CORRECT=' >/dev/null; then :; else
+ if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
 -  ]AT_SAVE_SPECIAL_FILES[
 +          ]AT_SAVE_SPECIAL_FILES[
  
    # To avoid expanding it repeatedly, store specified stdout.
    ]AT_DATA([expout], [$3])[
  
    # Build expected stderr up to and including the "warnings being
    # treated as errors" message.
 -  ]AT_DATA([[at-bison-check-warnings]], [$4])[
 -  at_bison_check_first=`sed -n \
 -    '/: warning: /{=;q;}' at-bison-check-warnings`
 -  : ${at_bison_check_first:=1}
 -  at_bison_check_first_tmp=`sed -n \
 -    '/conflicts: [0-9].*reduce$/{=;q;}' at-bison-check-warnings`
 -  : ${at_bison_check_first_tmp:=1}
 -  if test $at_bison_check_first_tmp -lt $at_bison_check_first; then
 -    at_bison_check_first=$at_bison_check_first_tmp
 -  fi
 -  if test $at_bison_check_first -gt 1; then
 -    sed -n "1,`expr $at_bison_check_first - 1`"p \
 -      at-bison-check-warnings > experr
 -  fi
 -  echo ']AT_BISON_WERROR_MSG[' >> experr
 -
 -  # Finish building expected stderr and check.  Unlike warnings,
 -  # complaints cause bison to exit early.  Thus, with -Werror, bison
 -  # does not necessarily report all warnings that it does without
 -  # -Werror, but it at least reports one.
 -  at_bison_check_last=`sed -n '$=' stderr`
 -  : ${at_bison_check_last:=1}
 -  at_bison_check_last=`expr $at_bison_check_last - 1`
 -  sed -n "$at_bison_check_first,$at_bison_check_last"p \
 -    at-bison-check-warnings >> experr
 -  ]AT_CHECK([[sed 's,.*/\(]AT_BISON_WERROR_MSG[\)$,\1,' \
 -              stderr 1>&2]], [[0]], [[]], [experr])[
 +  ]AT_DATA([[experr]], [$4])[
 +  $PERL -pi -e 's{(.*): warning: (.*)\[-W(.*)\]$}
 +                 {$][1: error: $][2\@<:@-Werror=$][3@:>@}' experr
 +  ]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
  
    # Now check --warnings=error.
    cp stderr experr
@@@ -532,10 -547,10 +528,10 @@@ m4_define([AT_BISON_CHECK_XML]
    # Don't combine these Bison invocations since we want to be sure that
    # --report=all isn't required to get the full XML file.
    AT_BISON_CHECK_([[--report=all --report-file=xml-tests/test.output \
 -                  --graph=xml-tests/test.dot ]]AT_BISON_ARGS,
 -                  [[0]], [ignore], [ignore])
 +             --graph=xml-tests/test.dot ]]AT_BISON_ARGS,
 +           [[0]], [ignore], [ignore])
    AT_BISON_CHECK_([[--xml=xml-tests/test.xml ]]AT_BISON_ARGS,
 -                 [[0]], [ignore], [ignore])
 +           [[0]], [ignore], [ignore])
    m4_popdef([AT_BISON_ARGS])dnl
    [cp xml-tests/test.output expout]
    AT_CHECK([[$XSLTPROC \
@@@ -578,13 -593,16 +574,16 @@@ m4_define([AT_QUELL_VALGRIND]
  # otherwise pass "-c"; this is a hack.  The default SOURCES is OUTPUT
  # with trailing .o removed, and ".c" appended.
  m4_define([AT_COMPILE],
- [AT_CHECK(m4_join([ ],
+ [AT_CHECK([case $POSIXLY_CORRECT_IS_EXPORTED:$C_COMPILER_POSIXLY_CORRECT in
+   true:false) echo 'cannot compile properly with POSIXLY_CORRECT' && exit 77;;
+ esac])
+ AT_CHECK(m4_join([ ],
                    [$CC $CFLAGS $CPPFLAGS],
                    [m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
                    [-o $1],
                    [m4_default([$2], [m4_bpatsubst([$1], [\.o$]).c])],
                    [m4_bmatch([$1], [[.]], [], [$LIBS])]),
 -         0, [ignore], [ignore])])
 +           0, [ignore], [ignore])])
  
  # AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc])
  # ---------------------------------------------
@@@ -603,7 -621,7 +602,7 @@@ AT_CHECK(m4_join([ ]
                   [-o $1],
                   [m4_default([$2], [m4_bpatsubst([$1], [\.o$]).cc])],
                   [m4_bmatch([$1], [[.]], [], [$LIBS])]),
 -       0, [ignore], [ignore])])
 +         0, [ignore], [ignore])])
  
  # AT_JAVA_COMPILE(SOURCES)
  # ------------------------
@@@ -643,23 -661,23 +642,23 @@@ m4_define([AT_FULL_COMPILE]
  [java],
    [AT_BISON_CHECK([-o $1.java $1.y])
     AT_LANG_COMPILE([$1],
 -                   m4_join([ ],
 -                           [$1.java],
 -                           m4_ifval($2, [[$1-$2.java]]),
 +                    m4_join([ ],
 +                            [$1.java],
 +                            m4_ifval($2, [[$1-$2.java]]),
                             m4_ifval($3, [[$1-$3.java]])))],
  [c++],
    [AT_BISON_CHECK([-o $1.cc $1.y])
     AT_LANG_COMPILE([$1],
 -                   m4_join([ ],
 -                           [$1.cc],
 -                           m4_ifval($2, [[$1-$2.cc]]),
 +                     m4_join([ ],
 +                             [$1.cc],
 +                             m4_ifval($2, [[$1-$2.cc]]),
                             m4_ifval($3, [[$1-$3.cc]])))],
  [c],
    [AT_BISON_CHECK([-o $1.c $1.y])
     AT_LANG_COMPILE([$1],
 -                   m4_join([ ],
 -                           [$1.c],
 -                           m4_ifval($2, [[$1-$2.c]]),
 +                  m4_join([ ],
 +                          [$1.c],
 +                          m4_ifval($2, [[$1-$2.c]]),
                             m4_ifval($3, [[$1-$3.c]])))])
  ])