-Werror: fix for rules useless in parser after conflicts.

* NEWS (2.4.3): Document fix.
* src/complain.c (error_message): Extend to handle incomplete
error messages so warn and warn_at can be used in more cases.
* src/gram.c (grammar_rules_useless_report): Use warn_at so that
-Werror is always obeyed.
* src/reduce.c (reduce_print): Use warn so that the "warnings
being treated as errors" message is printed consistently before
the first warning message.  This makes testing easier.
* tests/local.at (AT_BISON_WERROR_MSG): New macro.
(AT_BISON_CHECK_NO_XML): Extend to check -Werror and
--warnings=error when warnings appear in bison's stderr.
(cherry picked from commit 954474bfa1)
This commit is contained in:
Joel E. Denny
2010-08-01 18:51:46 -04:00
parent 20be2f9227
commit 2bfcac9a2b
6 changed files with 106 additions and 24 deletions

View File

@@ -38,7 +38,10 @@ static unsigned *indent_ptr = 0;
* \param loc the location, defaulting to the current file,
* or the program name.
* \param prefix put before the message (e.g., "warning").
* \param message the error message, a printf format string.
* \param message the error message, a printf format string. Iff it
* ends with ": ", then no trailing newline is printed,
* and the caller should print the remaining
* newline-terminated message to stderr.
* \param args the arguments of the format string.
*/
static
@@ -68,8 +71,13 @@ error_message (location *loc,
fprintf (stderr, "%s: ", prefix);
vfprintf (stderr, message, args);
putc ('\n', stderr);
fflush (stderr);
{
size_t l = strlen (message);
if (l < 2 || message[l-2] != ':' || message[l-1] != ' ') {
putc ('\n', stderr);
fflush (stderr);
}
}
}
/** Wrap error_message() with varargs handling. */