diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-06-10 08:11:56 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-06-10 09:51:39 +0200 |
commit | b0bb4cde2e66735137739f20dd3c97947e71a101 (patch) | |
tree | 7ca5d5ef2d51b1c386fb79c24128d9071f724045 /tests/glr-regression.at | |
parent | d2acc4b4014ad7447c29ce56095f28d22ed12978 (diff) | |
download | bison-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/glr-regression.at')
-rw-r--r-- | tests/glr-regression.at | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/glr-regression.at b/tests/glr-regression.at index 8257088b..fede248d 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -89,6 +89,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr1.c -rall glr-regr1.y]], 0, [], [[glr-regr1.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] +glr-regr1.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr1]) AT_PARSER_CHECK([[glr-regr1 BPBPB]], 0, @@ -213,6 +214,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr2a.c -rall glr-regr2a.y]], 0, [], [[glr-regr2a.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] +glr-regr2a.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr2a]) @@ -348,6 +350,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr3.c -rall glr-regr3.y]], 0, [], [[glr-regr3.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] glr-regr3.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr3.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr3]) @@ -444,6 +447,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr4.c -rall glr-regr4.y]], 0, [], [[glr-regr4.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr4.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr4]) @@ -501,6 +505,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr5.c -rall glr-regr5.y]], 0, [], [[glr-regr5.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr5.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr5]) @@ -550,6 +555,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr6.c -rall glr-regr6.y]], 0, [], [[glr-regr6.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr6.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr6]) @@ -640,6 +646,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr7.c -rall glr-regr7.y]], 0, [], [[glr-regr7.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr7.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr7]) @@ -730,6 +737,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr8.c -rall glr-regr8.y]], 0, [], [[glr-regr8.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr8.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr8]) @@ -811,6 +819,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr9.c -rall glr-regr9.y]], 0, [], [[glr-regr9.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr9.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr9]) @@ -868,6 +877,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr10.c -rall glr-regr10.y]], 0, [], [[glr-regr10.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr10.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr10]) @@ -927,6 +937,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr11.c -rall glr-regr11.y]], 0, [], [[glr-regr11.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr11.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr11]) @@ -1049,6 +1060,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr12.c -rall glr-regr12.y]], 0, [], [[glr-regr12.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] glr-regr12.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr12.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr12]) @@ -1380,6 +1392,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr14.c -rall glr-regr14.y]], 0, [], [[glr-regr14.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr14.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr14]) @@ -1474,6 +1487,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr15.c -rall glr-regr15.y]], 0, [], [[glr-regr15.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr15.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr15]) @@ -1535,6 +1549,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr16.c -rall glr-regr16.y]], 0, [], [[glr-regr16.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +glr-regr16.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr16]) @@ -1610,6 +1625,7 @@ AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr17.c -rall glr-regr17.y]], 0, [], [[glr-regr17.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr] +glr-regr17.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([glr-regr17]) @@ -1703,6 +1719,7 @@ d: /* nada. */; AT_BISON_CHECK([[-o input.c input.y]], 0, [], [[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] +input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother] ]]) AT_COMPILE([input]) |