diagnostics: remove redundancy

Don't repeat the name of the warning in the sub messages.  E.g.,
remove the second "[-Wother]" in the following message

    foo.y:2.1-27: warning: %define variable 'parse.error' redefined [-Wother]
     %define parse.error verbose
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    foo.y:1.1-27:     previous definition [-Wother]
     %define parse.error verbose
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

* src/complain.c (error_message): Don't print the warning type when
it's indented.
Adjust test cases.
This commit is contained in:
Akim Demaille
2019-01-21 20:03:19 +01:00
parent 7b3368a155
commit 27104acdbe
2 changed files with 10 additions and 7 deletions

View File

@@ -279,15 +279,18 @@ error_message (const location *loc, warnings flags, const char *prefix,
*indent_ptr = pos;
else if (*indent_ptr > pos)
fprintf (stderr, "%*s", *indent_ptr - pos, "");
indent_ptr = 0;
indent_ptr = NULL;
}
if (prefix)
fprintf (stderr, "%s: ", prefix);
vfprintf (stderr, message, args);
if (! (flags & silent))
/* Print the type of warning, only if this is not a sub message
(in which case the prefix is null). */
if (! (flags & silent) && prefix)
warnings_print_categories (flags, stderr);
{
size_t l = strlen (message);
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')