diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2013-02-16 09:23:48 +0100 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2013-02-18 10:01:28 +0100 |
commit | 42d101da8dff74111b409fb92bd2b0853067d857 (patch) | |
tree | d4f9917dec665439e686f73966f77ef438d5775c /tests/actions.at | |
parent | f68a49ed4942714616e692f0fa2a8315368bae3b (diff) | |
download | bison-42d101da8dff74111b409fb92bd2b0853067d857.tar.gz |
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.
Diffstat (limited to 'tests/actions.at')
-rw-r--r-- | tests/actions.at | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/actions.at b/tests/actions.at index 1f6630a9..d91fc17f 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -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 ## ------------------------ ## |