mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 23:33:03 +00:00
yacc: declare yyerror/yylex only when POSIXLY_CORRECT
The recent changes to comply with POSIX are breaking Automake's test suite. Reported by Kiyoshi Kanazawa. <https://lists.gnu.org/r/bug-bison/2021-09/msg00005.html> To limit the impact of POSIX changes, bind them to $POSIXLY_CORRECT. Suggested by Karl Berry. <https://lists.gnu.org/r/bug-bison/2021-09/msg00009.html> The existing `maintainer-check-posix` Make target checks these changes. * src/getargs.h, src/getargs.c (set_yacc): New. Use it. * data/skeletons/bison.m4 (b4_posix_if): New. * data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): Use it. * doc/bison.texi, tests/local.at: Adjust.
This commit is contained in:
@@ -268,7 +268,7 @@ read_integer (]AT_YYLEX_FORMALS[)
|
||||
|
||||
|
||||
m4_define([_AT_DATA_CALC_Y(c)],
|
||||
[AT_DATA_GRAMMAR([calc.y],
|
||||
[AT_DATA_GRAMMAR([calc.y.tmp],
|
||||
[[/* Infix notation calculator--calc */
|
||||
]$4[
|
||||
%code requires
|
||||
@@ -493,6 +493,18 @@ location_print (FILE *o, Span s)
|
||||
[AT_CALC_YYLEX
|
||||
AT_CALC_MAIN])])
|
||||
|
||||
# Remove the generated prototypes.
|
||||
AT_CHECK(
|
||||
[AT_YACC_IF([[
|
||||
if "$POSIXLY_CORRECT_IS_EXPORTED"; then
|
||||
sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y
|
||||
else
|
||||
mv calc.y.tmp calc.y
|
||||
fi
|
||||
]],
|
||||
[[mv calc.y.tmp calc.y]])
|
||||
])
|
||||
|
||||
AT_HEADER_IF([AT_DATA_SOURCE([[calc-lex.]AT_LANG_EXT],
|
||||
[[#include "calc.]AT_LANG_HDR["
|
||||
|
||||
|
||||
Reference in New Issue
Block a user