mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +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 invocation. * 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. * 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.
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user