diff options
author | Theophile Ranquet <theophile.ranquet@gmail.com> | 2012-09-27 10:52:45 +0000 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2012-09-27 11:08:07 +0200 |
commit | 9503b0a4a8928afa0fdab88672f6127ee7e87963 (patch) | |
tree | 1d7d9703784cf8ac339cd389a6cca644f3b2373f /src/complain.c | |
parent | 11b192127cac086338bfaa43f3bab3acda8e3a20 (diff) | |
download | bison-9503b0a4a8928afa0fdab88672f6127ee7e87963.tar.gz |
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>
Diffstat (limited to 'src/complain.c')
-rw-r--r-- | src/complain.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/complain.c b/src/complain.c index 1834120d..849a71c1 100644 --- a/src/complain.c +++ b/src/complain.c @@ -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; |