mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
-F/--force-define and relative %define/-D/--define priorities.
* NEWS (2.5): Add documentation to -D/--define entry.
* build-aux/cross-options.pl: Hard-code association of
--force-define with %define.
* doc/bison.texinfo (Decl Summary): In %define entry,
cross-reference command-line options.
(Bison Options): Add documentation to -D/--define entry.
(Option Cross Key): Widen column for --force-define row.
* src/getargs.c (usage): Document -F/--force-define. Realign
options in output.
(short_options, long_options, getargs): Parse -F/--force-define,
and update muscle_percent_define_insert invocations.
* src/muscle-tab.h (muscle_percent_define_how): New enum type.
(muscle_percent_define_insert): Add argument with that type.
* src/muscle-tab.c (muscle_percent_define_insert): Implement
-F/--force-define behavior and priorities.
(muscle_percent_define_ensure): Update
muscle_percent_define_insert invocation.
* src/parse-gram.y (prologue_declaration): Update
muscle_percent_define_insert invocations.
* tests/input.at (`%define, --define'): Rename to...
(`%define, --define, --force-define'): ... this and extend.
(cherry picked from commit 34d4193815)
Conflicts:
src/getargs.c
src/parse-gram.c
src/parse-gram.h
src/parse-gram.y
This commit is contained in:
@@ -401,12 +401,14 @@ do { \
|
||||
|
||||
void
|
||||
muscle_percent_define_insert (char const *variable, location variable_loc,
|
||||
char const *value)
|
||||
char const *value,
|
||||
muscle_percent_define_how how)
|
||||
{
|
||||
char *variable_tr = NULL;
|
||||
char const *name;
|
||||
char const *loc_name;
|
||||
char const *syncline_name;
|
||||
char const *how_name;
|
||||
|
||||
/* Permit certain names with underscores for backward compatibility. */
|
||||
if (0 == strcmp (variable, "api.push_pull")
|
||||
@@ -421,22 +423,33 @@ muscle_percent_define_insert (char const *variable, location variable_loc,
|
||||
MUSCLE_USER_NAME_CONVERT (loc_name, "percent_define_loc(", variable, ")");
|
||||
MUSCLE_USER_NAME_CONVERT (syncline_name,
|
||||
"percent_define_syncline(", variable, ")");
|
||||
MUSCLE_USER_NAME_CONVERT (how_name, "percent_define_how(", variable, ")");
|
||||
|
||||
if (muscle_find_const (name))
|
||||
/* Command-line options are processed before the grammar file. */
|
||||
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
|
||||
&& muscle_find_const (name))
|
||||
{
|
||||
muscle_percent_define_how how_old =
|
||||
atoi (muscle_find_const (how_name));
|
||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||
{
|
||||
free (variable_tr);
|
||||
return;
|
||||
}
|
||||
warn_at (variable_loc, _("%s `%s' redefined"),
|
||||
"%define variable", variable);
|
||||
warn_at (muscle_percent_define_get_loc (variable),
|
||||
_("previous definition"));
|
||||
_("previous definition"));
|
||||
}
|
||||
MUSCLE_INSERT_STRING (name, value);
|
||||
|
||||
MUSCLE_INSERT_STRING (name, value);
|
||||
muscle_insert (loc_name, "");
|
||||
muscle_location_grow (loc_name, variable_loc);
|
||||
muscle_insert (syncline_name, "");
|
||||
muscle_syncline_grow (syncline_name, variable_loc);
|
||||
muscle_user_name_list_grow ("percent_define_user_variables", variable,
|
||||
variable_loc);
|
||||
MUSCLE_INSERT_INT (how_name, how);
|
||||
|
||||
free (variable_tr);
|
||||
}
|
||||
@@ -455,12 +468,14 @@ muscle_percent_define_ensure (char const *variable, location loc,
|
||||
`%define api.pure' in a backward-compatible manner here. First,
|
||||
don't complain if %pure-parser is specified multiple times. */
|
||||
if (!muscle_find_const (name))
|
||||
muscle_percent_define_insert (variable, loc, val);
|
||||
muscle_percent_define_insert (variable, loc, val,
|
||||
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
|
||||
/* In all cases, use api.pure now so that the backend doesn't complain if
|
||||
the skeleton ignores api.pure, but do warn now if there's a previous
|
||||
conflicting definition from an actual %define. */
|
||||
if (muscle_percent_define_flag_if (variable) != value)
|
||||
muscle_percent_define_insert (variable, loc, val);
|
||||
muscle_percent_define_insert (variable, loc, val,
|
||||
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
Reference in New Issue
Block a user