warnings: factoring: complaints

* src/complain.c (error_message): Accept warning categories (an integer) as
argument.
Location is a 'const location *' instead of 'location *'.
(ERROR_MESSAGE): Delete it.
* src/complain.c, src/complain.h (complains): New function.
(complain, complain_at, complain_at_indent): Generic functions for
complaints. Call 'complains'.
(warn_at, warn_at_indent, warn, yacc_at, midrule_value_at)
(fatal_at, fatal): Delete them. Adjust dependencies.
* src/complain.h (enum warnings): New fields 'complaint' and 'fatal'.
* bootstrap.conf (XGETTEXT_OPTIONS): Adjust.
This commit is contained in:
Victor Santet
2012-06-28 16:44:21 +02:00
committed by Akim Demaille
parent d0f11c1b62
commit 6fb8b25619
17 changed files with 310 additions and 364 deletions

View File

@@ -773,7 +773,8 @@ add_param (param_type type, char *decl, location loc)
}
if (! name_start)
complain_at (loc, _("missing identifier in parameter declaration"));
complain_at (loc, complaint,
_("missing identifier in parameter declaration"));
else
{
char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
@@ -793,7 +794,7 @@ version_check (location const *loc, char const *version)
{
if (strverscmp (version, PACKAGE_VERSION) > 0)
{
complain_at (*loc, "require bison %s, but have %s",
complain_at (*loc, complaint, "require bison %s, but have %s",
version, PACKAGE_VERSION);
exit (EX_MISMATCH);
}
@@ -802,7 +803,7 @@ version_check (location const *loc, char const *version)
static void
gram_error (location const *loc, char const *msg)
{
complain_at (*loc, "%s", msg);
complain_at (*loc, complaint, "%s", msg);
}
char const *