* src/complain.c (complain_at_indent): Rename as...
(complaint_indent): This, and take the location as a pointer.
* src/complain.h, src/muscle-tab.c, src/reader.c, src/scan-code.l,
src/symtab.c: Adjust.
Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
--from-code=UTF-8\\\
--flag=asprintf:2:c-format\\\
--flag=complain:3:c-format\\\
- --flag=complain_at_indent:4:c-format\\\
+ --flag=complain_indent:4:c-format\\\
--flag=unexpected_end:2:c-format\\\
'
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
}
void
-complain (location const* loc, warnings flags, const char *message, ...)
+complain (location const *loc, warnings flags, const char *message, ...)
{
va_list args;
va_start (args, message);
}
void
-complain_at_indent (location loc, warnings flags, unsigned *indent,
- const char *message, ...)
+complain_indent (location const *loc, warnings flags, unsigned *indent,
+ const char *message, ...)
{
va_list args;
indent_ptr = indent;
va_start (args, message);
- complains (&loc, flags, message, args);
+ complains (loc, flags, message, args);
va_end (args);
}
void warnings_print_categories (warnings warn_flags);
/** Make a complaint, with maybe a location. */
-void complain (location const* loc, warnings flags, char const *message, ...)
+void complain (location const *loc, warnings flags, char const *message, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
/** Likewise, but with an \a argc/argv interface. */
void complain_args (location const *loc, warnings w, int argc, char *arg[]);
/** Make a complaint with location and some indentation. */
-void complain_at_indent (location loc, warnings flags, unsigned *indent,
- char const *message, ...)
+void complain_indent (location const *loc, warnings flags, unsigned *indent,
+ char const *message, ...)
__attribute__ ((__format__ (__printf__, 4, 5)));
/** Whether an error was reported. */
unsigned i = 0;
if (how_old == MUSCLE_PERCENT_DEFINE_F)
return;
- complain_at_indent (variable_loc, complaint, &i,
- _("%%define variable %s redefined"),
- quote (variable));
+ complain_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"));
+ location loc = muscle_percent_define_get_loc (variable);
+ complain_indent (&loc, complaint, &i, _("previous definition"));
}
MUSCLE_INSERT_STRING (name, value);
{
unsigned i = 0;
location loc = muscle_percent_define_get_loc (*variablep);
- complain_at_indent
- (loc, complaint, &i,
- _("invalid value for %%define variable %s: %s"),
- quote (*variablep), quote_n (1, value));
+ complain_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_indent (loc, complaint, &i, _("accepted value: %s"),
- quote (*values));
+ complain_indent (&loc, complaint, &i, _("accepted value: %s"),
+ quote (*values));
}
else
{
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
{
unsigned indent = 0;
- complain_at_indent (declaration_loc, complaint, &indent,
- _("result type clash on merge function %s: "
- "<%s> != <%s>"),
- quote (merge_function->name), type,
- merge_function->type);
+ complain_indent (&declaration_loc, complaint, &indent,
+ _("result type clash on merge function %s: "
+ "<%s> != <%s>"),
+ quote (merge_function->name), type,
+ merge_function->type);
indent += SUB_INDENT;
- complain_at_indent (merge_function->type_declaration_location, complaint,
- &indent,
- _("previous declaration"));
+ complain_indent (&merge_function->type_declaration_location, complaint,
+ &indent,
+ _("previous declaration"));
}
merge_function->type = uniqstr_new (type);
merge_function->type_declaration_location = declaration_loc;
const char *at_spec = get_at_spec (var->symbol_index);
if (var->err == 0)
- complain_at_indent (var->loc, silent, &indent,
- _("refers to: %c%s at %s"), dollar_or_at,
- var->id, at_spec);
+ complain_indent (&var->loc, silent, &indent,
+ _("refers to: %c%s at %s"), dollar_or_at,
+ var->id, at_spec);
else
{
static struct obstack msg_buf;
_(", cannot be accessed from mid-rule action at $%d"),
midrule_rhs_index);
- complain_at_indent (id_loc, silent, &indent, "%s",
- obstack_finish0 (&msg_buf));
+ complain_indent (&id_loc, silent, &indent, "%s",
+ obstack_finish0 (&msg_buf));
obstack_free (&msg_buf, 0);
}
}
cp_end - cp : ref_tail_fields - cp;
unsigned indent = 0;
- complain_at_indent (text_loc, complaint, &indent,
- _("invalid reference: %s"), quote (text));
+ complain_indent (&text_loc, complaint, &indent,
+ _("invalid reference: %s"), quote (text));
indent += SUB_INDENT;
if (len == 0)
{
location sym_loc = text_loc;
sym_loc.start.column += 1;
sym_loc.end = sym_loc.start;
- complain_at_indent (sym_loc, complaint, &indent,
- _("syntax error after '%c', expecting integer, "
- "letter, '_', '[', or '$'"),
- dollar_or_at);
+ complain_indent (&sym_loc, complaint, &indent,
+ _("syntax error after '%c', expecting integer, "
+ "letter, '_', '[', or '$'"),
+ dollar_or_at);
}
else if (midrule_rhs_index)
- complain_at_indent (rule->location, complaint, &indent,
- _("symbol not found in production before $%d: "
- "%.*s"),
- midrule_rhs_index, len, cp);
+ complain_indent (&rule->location, complaint, &indent,
+ _("symbol not found in production before $%d: "
+ "%.*s"),
+ midrule_rhs_index, len, cp);
else
- complain_at_indent (rule->location, complaint, &indent,
- _("symbol not found in production: %.*s"),
- len, cp);
+ complain_indent (&rule->location, complaint, &indent,
+ _("symbol not found in production: %.*s"),
+ len, cp);
if (variant_count > 0)
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
unsigned indent = 0;
if (variant_count > 1)
{
- complain_at_indent (text_loc, Wother, &indent,
- _("misleading reference: %s"), quote (text));
+ complain_indent (&text_loc, Wother, &indent,
+ _("misleading reference: %s"), quote (text));
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
dollar_or_at, indent + SUB_INDENT);
}
default:
{
unsigned indent = 0;
- complain_at_indent (text_loc, complaint, &indent,
- _("ambiguous reference: %s"), quote (text));
+ complain_indent (&text_loc, complaint, &indent,
+ _("ambiguous reference: %s"), quote (text));
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
dollar_or_at, indent + SUB_INDENT);
return INVALID_REF;
location second)
{
unsigned i = 0;
- complain_at_indent (second, complaint, &i,
- _("%s redeclaration for %s"), what, s->tag);
+ complain_indent (&second, complaint, &i,
+ _("%s redeclaration for %s"), what, s->tag);
i += SUB_INDENT;
- complain_at_indent (first, complaint, &i,
- _("previous declaration"));
+ complain_indent (&first, complaint, &i,
+ _("previous declaration"));
}
static void
location second)
{
unsigned i = 0;
- complain_at_indent (second, complaint, &i,
- _("%s redeclaration for <%s>"), what, s->tag);
+ complain_indent (&second, complaint, &i,
+ _("%s redeclaration for <%s>"), what, s->tag);
i += SUB_INDENT;
- complain_at_indent (first, complaint, &i,
- _("previous declaration"));
+ complain_indent (&first, complaint, &i,
+ _("previous declaration"));
}
first = second;
second = tmp;
}
- complain_at_indent (second->location, complaint, &i,
- _("user token number %d redeclaration for %s"),
- num, second->tag);
+ complain_indent (&second->location, complaint, &i,
+ _("user token number %d redeclaration for %s"),
+ num, second->tag);
i += SUB_INDENT;
- complain_at_indent (first->location, complaint, &i,
- _("previous declaration for %s"),
- first->tag);
+ complain_indent (&first->location, complaint, &i,
+ _("previous declaration for %s"),
+ first->tag);
}
/*--------------------------------------------------.