mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33: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
@@ -87,9 +87,17 @@ flags_argmatch (const char *option,
|
||||
args = strtok (args, ",");
|
||||
while (args)
|
||||
{
|
||||
int value = all;
|
||||
int *save_flags = flags;
|
||||
int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
|
||||
int value = XARGMATCH (option, args + no, keys, values);
|
||||
if (value == 0)
|
||||
int err = STRPREFIX_LIT ("error", args + no) ? 5 : 0;
|
||||
|
||||
if (err)
|
||||
flags = &errors_flag;
|
||||
if (!err || args[no + err++] != '\0')
|
||||
value = XARGMATCH (option, args + no + err, keys, values);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
if (no)
|
||||
*flags |= all;
|
||||
@@ -101,8 +109,13 @@ flags_argmatch (const char *option,
|
||||
if (no)
|
||||
*flags &= ~value;
|
||||
else
|
||||
*flags |= value;
|
||||
{
|
||||
if (err)
|
||||
warnings_flag |= value;
|
||||
*flags |= value;
|
||||
}
|
||||
}
|
||||
flags = save_flags;
|
||||
args = strtok (NULL, ",");
|
||||
}
|
||||
}
|
||||
@@ -322,16 +335,16 @@ Output:\n\
|
||||
|
||||
fputs (_("\
|
||||
Warning categories include:\n\
|
||||
`midrule-values' unset or unused midrule values\n\
|
||||
`yacc' incompatibilities with POSIX Yacc\n\
|
||||
`conflicts-sr' S/R conflicts (enabled by default)\n\
|
||||
`conflicts-rr' R/R conflicts (enabled by default)\n\
|
||||
`deprecated' obsolete constructs\n\
|
||||
`other' all other warnings (enabled by default)\n\
|
||||
`all' all the warnings\n\
|
||||
`no-CATEGORY' turn off warnings in CATEGORY\n\
|
||||
`none' turn off all the warnings\n\
|
||||
`error' treat warnings as errors\n\
|
||||
`midrule-values' unset or unused midrule values\n\
|
||||
`yacc' incompatibilities with POSIX Yacc\n\
|
||||
`conflicts-sr' S/R conflicts (enabled by default)\n\
|
||||
`conflicts-rr' R/R conflicts (enabled by default)\n\
|
||||
`deprecated' obsolete constructs\n\
|
||||
`other' all other warnings (enabled by default)\n\
|
||||
`all' all the warnings\n\
|
||||
`no-CATEGORY' turn off warnings in CATEGORY\n\
|
||||
`none' turn off all the warnings\n\
|
||||
`error[=CATEGORY]' treat warnings as errors\n\
|
||||
"), stdout);
|
||||
putc ('\n', stdout);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user