mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22: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:
@@ -71,6 +71,18 @@ struct bison_language const *language = &valid_languages[0];
|
||||
|
||||
typedef int* (xargmatch_fn) (const char *context, const char *arg);
|
||||
|
||||
void
|
||||
set_yacc (location loc)
|
||||
{
|
||||
yacc_loc = loc;
|
||||
if (getenv ("POSIXLY_CORRECT"))
|
||||
muscle_percent_define_insert ("posix",
|
||||
loc,
|
||||
muscle_keyword, "",
|
||||
MUSCLE_PERCENT_DEFINE_D);
|
||||
}
|
||||
|
||||
|
||||
/** Decode an option's key.
|
||||
*
|
||||
* \param opt option being decoded.
|
||||
@@ -631,8 +643,7 @@ static struct option const long_options[] =
|
||||
};
|
||||
|
||||
/* Build a location for the current command line argument. */
|
||||
static
|
||||
location
|
||||
static location
|
||||
command_line_location (void)
|
||||
{
|
||||
location res;
|
||||
@@ -835,7 +846,7 @@ getargs (int argc, char *argv[])
|
||||
|
||||
case 'y':
|
||||
warning_argmatch ("yacc", 0, 0);
|
||||
yacc_loc = loc;
|
||||
set_yacc (loc);
|
||||
break;
|
||||
|
||||
case COLOR_OPTION:
|
||||
|
||||
Reference in New Issue
Block a user