mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Don't let -Wnone disable -Werror.
Discussed at <http://lists.gnu.org/archive/html/bison-patches/2010-08/msg00009.html>. * NEWS (2.5): Document. * src/getargs.c (flags_argmatch): Accept a new argument that specifies what flags "all" and thus "none" affect. (FLAGS_ARGMATCH): Update flags_argmatch invocation. * tests/input.at (-Werror is not affected by -Wnone and -Wall): New test group.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
|||||||
|
2011-03-27 Joel E. Denny <joeldenny@joeldenny.org>
|
||||||
|
|
||||||
|
Don't let -Wnone disable -Werror.
|
||||||
|
Discussed at
|
||||||
|
<http://lists.gnu.org/archive/html/bison-patches/2010-08/msg00009.html>.
|
||||||
|
* NEWS (2.5): Document.
|
||||||
|
* src/getargs.c (flags_argmatch): Accept a new argument that
|
||||||
|
specifies what flags "all" and thus "none" affect.
|
||||||
|
(FLAGS_ARGMATCH): Update flags_argmatch invocation.
|
||||||
|
* tests/input.at (-Werror is not affected by -Wnone and -Wall):
|
||||||
|
New test group.
|
||||||
|
|
||||||
2011-03-27 Joel E. Denny <joeldenny@joeldenny.org>
|
2011-03-27 Joel E. Denny <joeldenny@joeldenny.org>
|
||||||
|
|
||||||
* NEWS (2.5): Document fix for -Wno-CATEGORY.
|
* NEWS (2.5): Document fix for -Wno-CATEGORY.
|
||||||
|
|||||||
7
NEWS
7
NEWS
@@ -309,6 +309,13 @@ Bison News
|
|||||||
|
|
||||||
bison -Wall,no-yacc gram.y
|
bison -Wall,no-yacc gram.y
|
||||||
|
|
||||||
|
*** The "none" category no longer disables a preceding "error":
|
||||||
|
|
||||||
|
For example, for the following command line, Bison now reports
|
||||||
|
errors instead of warnings for incompatibilities with POSIX Yacc:
|
||||||
|
|
||||||
|
bison -Werror,none,yacc gram.y
|
||||||
|
|
||||||
* Changes in version 2.4.3 (2010-08-05):
|
* Changes in version 2.4.3 (2010-08-05):
|
||||||
|
|
||||||
** Bison now obeys -Werror and --warnings=error for warnings about
|
** Bison now obeys -Werror and --warnings=error for warnings about
|
||||||
|
|||||||
@@ -86,18 +86,19 @@ char *program_name;
|
|||||||
* \param option option being decoded.
|
* \param option option being decoded.
|
||||||
* \param keys array of valid subarguments.
|
* \param keys array of valid subarguments.
|
||||||
* \param values array of corresponding (int) values.
|
* \param values array of corresponding (int) values.
|
||||||
|
* \param all the all value.
|
||||||
* \param flags the flags to update
|
* \param flags the flags to update
|
||||||
* \param args comma separated list of effective subarguments to decode.
|
* \param args comma separated list of effective subarguments to decode.
|
||||||
* If 0, then activate all the flags.
|
* If 0, then activate all the flags.
|
||||||
*
|
*
|
||||||
* If VALUE != 0 then KEY sets flags and no-KEY clears them.
|
* If VALUE != 0 then KEY sets flags and no-KEY clears them.
|
||||||
* If VALUE == 0 then KEY clears all flags and no-KEY sets all flags.
|
* If VALUE == 0 then KEY clears all flags from \c all and no-KEY sets all
|
||||||
* Thus no-none = all and no-all = none.
|
* flags from \c all. Thus no-none = all and no-all = none.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
flags_argmatch (const char *option,
|
flags_argmatch (const char *option,
|
||||||
const char * const keys[], const int values[],
|
const char * const keys[], const int values[],
|
||||||
int *flags, char *args)
|
int all, int *flags, char *args)
|
||||||
{
|
{
|
||||||
if (args)
|
if (args)
|
||||||
{
|
{
|
||||||
@@ -107,20 +108,24 @@ flags_argmatch (const char *option,
|
|||||||
int no = strncmp (args, "no-", 3) == 0 ? 3 : 0;
|
int no = strncmp (args, "no-", 3) == 0 ? 3 : 0;
|
||||||
int value = XARGMATCH (option, args + no, keys, values);
|
int value = XARGMATCH (option, args + no, keys, values);
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
|
{
|
||||||
if (no)
|
if (no)
|
||||||
*flags = ~0;
|
*flags |= all;
|
||||||
else
|
else
|
||||||
*flags = 0;
|
*flags &= ~all;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if (no)
|
if (no)
|
||||||
*flags &= ~value;
|
*flags &= ~value;
|
||||||
else
|
else
|
||||||
*flags |= value;
|
*flags |= value;
|
||||||
|
}
|
||||||
args = strtok (NULL, ",");
|
args = strtok (NULL, ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*flags = ~0;
|
*flags |= all;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Decode a set of sub arguments.
|
/** Decode a set of sub arguments.
|
||||||
@@ -130,11 +135,12 @@ flags_argmatch (const char *option,
|
|||||||
*
|
*
|
||||||
* \arg FlagName_args the list of keys.
|
* \arg FlagName_args the list of keys.
|
||||||
* \arg FlagName_types the list of values.
|
* \arg FlagName_types the list of values.
|
||||||
|
* \arg FlagName_all the all value.
|
||||||
* \arg FlagName_flag the flag to update.
|
* \arg FlagName_flag the flag to update.
|
||||||
*/
|
*/
|
||||||
#define FLAGS_ARGMATCH(FlagName, Args) \
|
#define FLAGS_ARGMATCH(FlagName, Args) \
|
||||||
flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \
|
flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \
|
||||||
&FlagName ## _flag, Args)
|
FlagName ## _all, &FlagName ## _flag, Args)
|
||||||
|
|
||||||
|
|
||||||
/*----------------------.
|
/*----------------------.
|
||||||
@@ -579,10 +585,7 @@ getargs (int argc, char *argv[])
|
|||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'W':
|
case 'W':
|
||||||
if (optarg)
|
|
||||||
FLAGS_ARGMATCH (warnings, optarg);
|
FLAGS_ARGMATCH (warnings, optarg);
|
||||||
else
|
|
||||||
warnings_flag |= warnings_all;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
|
|||||||
@@ -1308,3 +1308,36 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
## --------------------------------------------- ##
|
||||||
|
## -Werror is not affected by -Wnone and -Wall. ##
|
||||||
|
## --------------------------------------------- ##
|
||||||
|
|
||||||
|
AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
|
||||||
|
|
||||||
|
AT_DATA([[input.y]],
|
||||||
|
[[%%
|
||||||
|
foo-bar: ;
|
||||||
|
]])
|
||||||
|
|
||||||
|
# -Werror is not enabled by -Wall or equivalent.
|
||||||
|
AT_BISON_CHECK([[-Wall input.y]], [[0]], [[]],
|
||||||
|
[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
|
||||||
|
]])
|
||||||
|
AT_BISON_CHECK([[-W input.y]], [[0]], [[]],
|
||||||
|
[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
|
||||||
|
]])
|
||||||
|
AT_BISON_CHECK([[-Wno-none input.y]], [[0]], [[]],
|
||||||
|
[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
|
||||||
|
]])
|
||||||
|
|
||||||
|
# -Werror is not disabled by -Wnone or equivalent.
|
||||||
|
AT_BISON_CHECK([[-Werror,none,yacc input.y]], [[1]], [[]], [[stderr]])
|
||||||
|
AT_CHECK([[sed 's/^.*bison:/bison:/' stderr]], [[0]],
|
||||||
|
[[bison: warnings being treated as errors
|
||||||
|
input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
|
||||||
|
]])
|
||||||
|
[mv stderr experr]
|
||||||
|
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|||||||
Reference in New Issue
Block a user