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:
Theophile Ranquet
2012-09-27 10:52:45 +00:00
committed by Akim Demaille
parent 11b192127c
commit 9503b0a4a8
4 changed files with 45 additions and 25 deletions

View File

@@ -35,16 +35,22 @@ typedef enum
Wdeprecated = 1 << 4, /**< Obsolete constructs. */
Wother = 1 << 5, /**< All other warnings. */
Werror = 1 << 10, /**< Warnings are treated as errors. */
Werror = 1 << 10, /** This bit is no longer used. */
complaint = 1 << 11, /**< All complaints. */
fatal = 1 << 12, /**< All fatal errors. */
silent = 1 << 13, /**< Do not display the warning type. */
Wall = ~Werror /**< All above warnings. */
/**< All above warnings. */
Wall = ~complaint & ~fatal & ~silent
} warnings;
/** What warnings are issued. */
extern warnings warnings_flag;
/** What warnings are made errors. */
extern warnings errors_flag;
/** Display a "[-Wyacc]" like message on stderr. */
void warnings_print_categories (warnings warn_flags);
@@ -56,7 +62,7 @@ void warnings_print_categories (warnings warn_flags);
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 (void);
void set_warning_issued (warnings warning);
/** Make a complaint, but don't specify any location. */
void complain (warnings flags, char const *message, ...)