updates: insert/remove %empty

* src/reader.c (grammar_rule_check_and_complete): Generate fixits for
adding/removing %empty.
* tests/actions.at, tests/diagnostics.at, tests/existing.at: Adjust.
This commit is contained in:
Akim Demaille
2019-04-23 22:13:28 +02:00
parent 0ee5ac5367
commit 971e72514f
4 changed files with 22 additions and 4 deletions

View File

@@ -134,6 +134,7 @@ AT_BISON_CHECK([-fcaret -Wempty-rule 1.y], [0], [],
[[1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
11 | a: /* empty. */ {};
| ^~
1.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]])
AT_DATA_GRAMMAR([[2.y]],
@@ -151,6 +152,7 @@ AT_BISON_CHECK([-fcaret 2.y], [0], [],
2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule]
13 | c: /* empty. */ {};
| ^~
2.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]])
AT_BISON_CHECK([-fcaret -Wno-empty-rule 2.y], [0])
@@ -229,6 +231,7 @@ two.y:12.3-8: error: %empty on non-empty rule
two.y:13.3-8: error: %empty on non-empty rule
13 | | %empty {} {}
| ^~~~~~
two.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]])
AT_BISON_OPTION_POPDEFS

View File

@@ -112,6 +112,7 @@ input.y:16.2: <warning>warning:</warning> empty rule without %empty [<warning>-W
input.y:17.3: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
17 | e:
| <warning>^</warning>
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
]])
@@ -158,6 +159,7 @@ input.y:17.4-17: <warning>warning:</warning> empty rule without %empty [<warning
input.y:18.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
18 | h: <warning>{ 🐃 }</warning>
| <warning>^~~~~~~~~~~~~~</warning>
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
]])
@@ -180,6 +182,7 @@ b: {}
11 | a: <warning>{}</warning>
| <warning>^~</warning>
/dev/stdout:1.4-5: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
/dev/stdout: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
]])

View File

@@ -457,6 +457,7 @@ input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wpre
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]],
dnl LAST-STATE
@@ -1428,6 +1429,7 @@ input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wp
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]],
dnl LAST-STATE
@@ -2096,6 +2098,7 @@ input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprec
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence]
input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]],
dnl LAST-STATE