* otherwise \a variable. */
static
char const *
-muscle_percent_variable_update (char const *variable)
+muscle_percent_variable_update (char const *variable, location variable_loc)
{
typedef struct
{
{ "lr.keep_unreachable_states", "lr.keep-unreachable-states", },
{ "namespace", "api.namespace", },
};
+ char const *res = variable;
int i;
- for (i = 0; i < sizeof conversion / sizeof *conversion; ++i)
+ for (i = 0; i < ARRAY_CARDINALITY (conversion); ++i)
if (STREQ (conversion[i].obsolete, variable))
- return conversion[i].updated;
- return variable;
+ {
+ res = conversion[i].updated;
+ complain_at (variable_loc, Wdeprecated,
+ _("deprecated %%define variable name: %s, use %s"),
+ quote (variable), quote_n (1, res));
+ break;
+ }
+ return res;
}
void
char const *how_name;
/* Permit certain names with underscores for backward compatibility. */
- variable = muscle_percent_variable_update (variable);
+ variable = muscle_percent_variable_update (variable, variable_loc);
name = UNIQSTR_CONCAT ("percent_define(", variable, ")");
loc_name = UNIQSTR_CONCAT ("percent_define_loc(", variable, ")");
&& muscle_find_const (name))
{
muscle_percent_define_how how_old = atoi (muscle_find_const (how_name));
+ unsigned i = 0;
if (how_old == MUSCLE_PERCENT_DEFINE_F)
return;
- complain_at (variable_loc, complaint, _("%%define variable %s redefined"),
- quote (variable));
- location loc = muscle_percent_define_get_loc (variable);
- complain_at (loc, complaint, _("previous definition"));
+ complain_at_indent (variable_loc, complaint, &i,
+ _("%%define variable %s redefined"),
+ quote (variable));
+ i += SUB_INDENT;
+ complain_at_indent (muscle_percent_define_get_loc (variable),
+ complaint, &i,
+ _("previous definition"));
}
MUSCLE_INSERT_STRING (name, value);
}
if (!*values)
{
+ unsigned i = 0;
location loc = muscle_percent_define_get_loc (*variablep);
- complain_at (loc, complaint,
- _("invalid value for %%define variable %s: %s"),
- quote (*variablep), quote_n (1, value));
+ complain_at_indent
+ (loc, complaint, &i,
+ _("invalid value for %%define variable %s: %s"),
+ quote (*variablep), quote_n (1, value));
+ i += SUB_INDENT;
for (values = variablep + 1; *values; ++values)
- complain_at (loc, complaint, _("accepted value: %s"),
- quote (*values));
+ complain_at_indent (loc, complaint, &i, _("accepted value: %s"),
+ quote (*values));
}
else
{