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:
Akim Demaille
2021-09-10 06:48:02 +02:00
parent ad9b8a069f
commit 5d9ccd5a87
11 changed files with 53 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.7.5.297-b46a. */
/* A Bison parser, made by GNU Bison 3.8. */
/* Bison implementation for Yacc-like parsers in C
@@ -46,10 +46,10 @@
USER NAME SPACE" below. */
/* Identify Bison output, and Bison version. */
#define YYBISON 30705
#define YYBISON 30800
/* Bison version string. */
#define YYBISON_VERSION "3.7.5.297-b46a"
#define YYBISON_VERSION "3.8"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -3129,7 +3129,7 @@ handle_yacc (location const *loc)
const char *directive = "%yacc";
bison_directive (loc, directive);
if (location_empty (yacc_loc))
yacc_loc = *loc;
set_yacc (*loc);
else
duplicate_directive (directive, yacc_loc, *loc);
}