summaryrefslogtreecommitdiff
path: root/tests/existing.at
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-06-10 08:11:56 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-06-10 09:51:39 +0200
commitb0bb4cde2e66735137739f20dd3c97947e71a101 (patch)
tree7ca5d5ef2d51b1c386fb79c24128d9071f724045 /tests/existing.at
parentd2acc4b4014ad7447c29ce56095f28d22ed12978 (diff)
downloadbison-b0bb4cde2e66735137739f20dd3c97947e71a101.tar.gz
cex: suggest -Wcounterexamples when there are unexpected conflicts
Suggesting -Wcounterexamples when there are conflicts is probably not what the user wants. If she knows her conflicts and has set %expect/%expect-rr appropriately, we shouldn't warn. The commit also swaps the counterexamples and the report of conflicts, into, IMHO, a more natural order: from Shift/reduce conflict on token B: 1: 3 a: A . 1: 8 y: A . B Example A • B C First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ] Example A • B C Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ] input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] to input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] Shift/reduce conflict on token B: 1: 3 a: A . 1: 8 y: A . B Example A • B C First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ] Example A • B C Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ] input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] * src/conflicts.c (rule_conflicts_print): Rename as... (report_rule_expectation_mismatches): this. Move the handling of report_counterexamples to... (conflicts_print): Here. Display this warning when applicable.
Diffstat (limited to 'tests/existing.at')
-rw-r--r--tests/existing.at2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/existing.at b/tests/existing.at
index da6287d5..d0f6cb95 100644
--- a/tests/existing.at
+++ b/tests/existing.at
@@ -434,6 +434,7 @@ input.y:323.10: warning: empty rule without %empty [-Wempty-rule]
]AT_COND_CASE([[canonical LR]],
[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
+input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
@@ -1418,6 +1419,7 @@ input.y:591.18: warning: empty rule without %empty [-Wempty-rule]
input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
+input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]