mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
errors: introduce the -Werror=CATEGORY option
This new option is a lot more flexible than the previous one. Its details will be discussed in the NEWS and info file, in a forthcoming change. If no category is specified (ie: used as simply "-Werror"), the functionality is the same as before. * src/complain.c (errors_flag): New variable. (set_warning_issued): Accept warning categories as an argument. * src/complain.h (Wall): Better definition. * src/getargs.c (flags_argmatch): Support for the new format. (usage): Update -Werror to -Werror[=CATEGORY] format. * src/complain.c (errors_flag): New variable. (set_warning_issued): Accept warning categories as an argument. * src/complain.h (Wall): Better definition. * src/getargs.c (flags_argmatch): Support for the new format. (usage): Update -Werror to -Werror=[CATEGORY] format. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
committed by
Akim Demaille
parent
11b192127c
commit
9503b0a4a8
@@ -32,6 +32,8 @@
|
||||
warnings warnings_flag =
|
||||
Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother;
|
||||
|
||||
warnings errors_flag;
|
||||
|
||||
bool complaint_issued;
|
||||
static unsigned *indent_ptr = 0;
|
||||
|
||||
@@ -141,7 +143,7 @@ complains (const location *loc, warnings flags, const char *message,
|
||||
}
|
||||
else if (warnings_flag & Wyacc)
|
||||
{
|
||||
set_warning_issued ();
|
||||
set_warning_issued (Wyacc);
|
||||
error_message (loc, flags,
|
||||
indent_ptr && *indent_ptr ? NULL : _("warning"),
|
||||
message, args);
|
||||
@@ -149,7 +151,7 @@ complains (const location *loc, warnings flags, const char *message,
|
||||
}
|
||||
else if (warnings_flag & flags)
|
||||
{
|
||||
set_warning_issued ();
|
||||
set_warning_issued (flags);
|
||||
error_message (loc, flags,
|
||||
indent_ptr && *indent_ptr ? NULL : _("warning"),
|
||||
message, args);
|
||||
@@ -191,10 +193,10 @@ void complain_at_indent (location loc, warnings flags, unsigned *indent,
|
||||
`--------------------------------*/
|
||||
|
||||
void
|
||||
set_warning_issued (void)
|
||||
set_warning_issued (warnings warning)
|
||||
{
|
||||
static bool warning_issued = false;
|
||||
if (!warning_issued && (warnings_flag & Werror))
|
||||
if (!warning_issued && (warning & warnings_flag & errors_flag))
|
||||
{
|
||||
fprintf (stderr, "%s: warnings being treated as errors\n", program_name);
|
||||
complaint_issued = true;
|
||||
|
||||
Reference in New Issue
Block a user