diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2021-09-10 06:48:02 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2021-09-11 08:26:10 +0200 |
commit | 5d9ccd5a87f7991c6f52d45e2b57ad0b03e76cf7 (patch) | |
tree | 88ac63f92f4d5d5519faf2d6321324a11aa355a1 /tests | |
parent | ad9b8a069ffaba0e93504b3414be16ba06b035ff (diff) | |
download | bison-5d9ccd5a87f7991c6f52d45e2b57ad0b03e76cf7.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/calc.at | 14 | ||||
-rw-r--r-- | tests/local.at | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/calc.at b/tests/calc.at index 11801543..aeac8418 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -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[" diff --git a/tests/local.at b/tests/local.at index bc43ee1c..adde4e4c 100644 --- a/tests/local.at +++ b/tests/local.at @@ -687,8 +687,8 @@ m4_define([AT_YYERROR_DECLARE_EXTERN(c)], m4_define([AT_YYERROR_DECLARE(c)], [[#include <stdio.h> ]AT_LOCATION_PRINT_DECLARE[ -]AT_YACC_IF([], [[static ]AT_YYERROR_DECLARE_EXTERN])]) - +/* !POSIX */ static ]AT_YYERROR_DECLARE_EXTERN[]dnl +]) # "%define parse.error custom" uses a different format, easy to check. # The "verbose" one can be computed from it (see _AT_CHECK_CALC_ERROR). @@ -733,7 +733,7 @@ yyreport_syntax_error (const yypcontext_t *ctx]AT_PARAM_IF([, AT_PARSE_PARAMS])[ ]])[ /* A C error reporting function. */ -]AT_YACC_IF([], [static])[ +/* !POSIX */ static ]AT_YYERROR_PROTOTYPE[ {]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ |