mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
diagnostics: %empty enables -Wempty-rule
* src/complain.h, src/complain.c (warning_is_unset): New. * src/reader.c (grammar_current_rule_empty_set): If enabled -Wempty-rule, if not disabled. * tests/actions.at (Implicitly empty rule): Check this feature. Also check that -Wno-empty-rule does disable this warning.
This commit is contained in:
@@ -84,6 +84,25 @@ AT_BISON_CHECK([-fcaret -Wempty-rule 1.y], [0], [],
|
||||
^^
|
||||
]])
|
||||
|
||||
AT_DATA_GRAMMAR([[2.y]],
|
||||
[[%%
|
||||
exp: a b c;
|
||||
a: /* empty. */ {};
|
||||
b: %empty {};
|
||||
c: /* empty. */ {};
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret 2.y], [0], [],
|
||||
[[2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||
a: /* empty. */ {};
|
||||
^^
|
||||
2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||
c: /* empty. */ {};
|
||||
^^
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -Wno-empty-rule 2.y], [0])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## ------------------------ ##
|
||||
|
||||
Reference in New Issue
Block a user