mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +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:
@@ -451,6 +451,10 @@ grammar_current_rule_prec_set (symbol *precsym, location loc)
|
||||
void
|
||||
grammar_current_rule_empty_set (location loc)
|
||||
{
|
||||
/* If %empty is used and -Wno-empty-rule is not, then enable
|
||||
-Wempty-rule. */
|
||||
if (warning_is_unset (Wempty_rule))
|
||||
warning_argmatch ("empty-rule", 0, 0);
|
||||
if (current_rule->percent_empty_loc.start.file)
|
||||
complain (&loc, complaint, _("only one %s allowed per rule"), "%empty");
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user