errors: don't display "warnings treated as errors"

This line doesn't add any meaningful information anymore, the appended
[-Werror=CATEGORY] is enough.  It is actually more insightful, as it
allows to distinguish warnings treated as errors from those that
aren't.  This line is also removed by gcc 4.8.

* src/complain.c (set_warnings_issued): The only action left was
checking if the error bit corresponding to the warning issued was set,
and that function was only called once. Therefore, remove it, and do
its job directly in the caller...
(complains): here.
* src/complains.h: Adjust.
* tests/input.at: Adjust.
* NEWS: Document this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
Theophile Ranquet
2012-09-27 10:52:47 +00:00
committed by Akim Demaille
parent 1048a1c901
commit 46bdb8ec59
4 changed files with 15 additions and 42 deletions

View File

@@ -134,9 +134,8 @@ complains (const location *loc, warnings flags, const char *message,
{
const char* prefix =
flags & (errors_flag | complaint) ? _("error") : _("warning");
if (flags & complaint)
if (flags & (complaint | errors_flag))
complaint_issued = true;
set_warning_issued (flags);
error_message (loc, flags,
indent_ptr && *indent_ptr ? NULL : prefix,
message, args);
@@ -171,20 +170,3 @@ void complain_at_indent (location loc, warnings flags, unsigned *indent,
complains (&loc, flags, message, args);
va_end (args);
}
/*--------------------------------.
| Report a warning, and proceed. |
`--------------------------------*/
void
set_warning_issued (warnings warning)
{
static bool warning_issued = false;
if (!warning_issued && (warning & warnings_flag & errors_flag))
{
fprintf (stderr, "%s: warnings being treated as errors\n", program_name);
complaint_issued = true;
}
warning_issued = true;
}

View File

@@ -21,6 +21,9 @@
# include "location.h"
/* Sub-messages indent. */
#define SUB_INDENT (4)
/*-------------.
| --warnings. |
`-------------*/
@@ -54,16 +57,6 @@ extern warnings errors_flag;
/** Display a "[-Wyacc]" like message on stderr. */
void warnings_print_categories (warnings warn_flags);
/* Sub-messages indent. */
#define SUB_INDENT (4)
/** Record that a warning is about to be issued, and treat it as an
error if <tt>warnings_flag & Werror</tt>. This is exported
only for the sake of Yacc-compatible conflict reports in conflicts.c.
All other warnings should be implemented in complain.c and should use
the normal warning format. */
void set_warning_issued (warnings warning);
/** Make a complaint, but don't specify any location. */
void complain (warnings flags, char const *message, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));