mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
diagnostics: "-Werror -Wno-error=foo" must not emit errors
Currently "-Werror -Wno-error=foo" still turns "foo" warnings into errors. Reported by Alexandre Duret-Lutz. See http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html. * src/complain.c (errority, errority_flag): New. (complain_init): Initialize the latter. (warning_argmatch): Extract the loop iterating on the flag's bits. Set and unset errority_flag here. (warnings_argmatch): -Wno-error is not the same as -Wno-error=everything: we must remember if category foo was explicitly turned in an error/warning via -W(no-)error=foo. (warning_severity): Use errority_flag. * tests/input.at (Symbols): Just check --yacc, not -Wyacc, that's the job of tests on -W. (-Werror is not affected by -Wnone and -Wall): Rename as... (-Werror combinations): this. Tests more combinations of -W, -W(no-)error, and -W(no-)error=foo. * tests/local.at (AT_BISON_CHECK_WARNINGS): Don't expect -Werror to turn runs that issue warnings into runs with errors, as the warnings might be enforced as warnings by -Wno-error=foo, in which case -Werror does not change anything. * doc/bison.texi (Bison Options): Try to be clearer about how -W(no-)error and -W(no-)error=foo interact.
This commit is contained in:
@@ -956,15 +956,9 @@ without_period: "WITHOUT.PERIOD";
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
# POSIX Yacc accept periods, but not dashes.
|
||||
AT_BISON_CHECK([--yacc -Wno-error input.y], [], [],
|
||||
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
|
||||
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
|
||||
]])
|
||||
|
||||
# So warn about them.
|
||||
AT_BISON_CHECK([-Wyacc input.y], [], [],
|
||||
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
|
||||
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
|
||||
AT_BISON_CHECK([--yacc input.y], [1], [],
|
||||
[[input.y:9.8-16: error: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Werror=yacc]
|
||||
input.y:20.8-16: error: POSIX Yacc forbids dashes in symbol names: with-dash [-Werror=yacc]
|
||||
]])
|
||||
|
||||
# Dashes are fine for GNU Bison.
|
||||
@@ -1768,11 +1762,11 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## --------------------------------------------- ##
|
||||
## -Werror is not affected by -Wnone and -Wall. ##
|
||||
## --------------------------------------------- ##
|
||||
## ---------------------- ##
|
||||
## -Werror combinations. ##
|
||||
## ---------------------- ##
|
||||
|
||||
AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
|
||||
AT_SETUP([[-Werror combinations]])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%%
|
||||
@@ -1798,6 +1792,18 @@ AT_BISON_CHECK([[-Werror,no-all,other input.y]], [[1]], [[]],
|
||||
[[input.y:2.15: error: stray '$' [-Werror=other]
|
||||
]])
|
||||
|
||||
# Check that -Wno-error keeps warnings enabled, but non fatal.
|
||||
AT_BISON_CHECK([[-Werror -Wno-error=other input.y]], [[0]], [[]],
|
||||
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Wno-error=other -Werror input.y]], [[0]], [[]],
|
||||
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Werror=other -Wno-other input.y]], [[0]], [[]],
|
||||
[[]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
@@ -635,9 +635,12 @@ m4_define([AT_BISON_CHECK_],
|
||||
# ----------------------------------------------------------
|
||||
# Check that warnings (if some are expected) are correctly
|
||||
# turned into errors with -Werror, etc.
|
||||
#
|
||||
# When -Wno-error is used, the rules are really different, don't try.
|
||||
m4_define([AT_BISON_CHECK_WARNINGS],
|
||||
[m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
|
||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||
m4_bregexp([$1], [-Wno-error=]), [-1],
|
||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||
|
||||
m4_define([AT_BISON_CHECK_WARNINGS_],
|
||||
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
|
||||
|
||||
Reference in New Issue
Block a user