Compare commits

..
9 Commits
Author SHA1 Message Date
Akim Demaille 6675d36e25 version 3.7
* NEWS: Record release date.
2020-07-23 19:58:16 +02:00
Akim Demaille d0bec3175f style: avoid warnings with GCC 4.6
With have a clash with the "max" function.

    src/counterexample.c: In function 'visited_hasher':
    src/counterexample.c:720:48: error: declaration of 'max' shadows a global declaration [-Werror=shadow]
    src/counterexample.c:116:12: error: shadowed declaration is here [-Werror=shadow]

* src/counterexample.c (visited_hasher): Alpha conversion.
2020-07-23 19:55:24 +02:00
Akim Demaille 79e68b6c4d doc: fix definition of -Wall
* doc/bison.texi (Diagnostics): here.
2020-07-23 09:17:18 +02:00
Akim Demaille 5cb74cacd8 gnulib: update
* bootstrap.conf: We need stpncpy.
2020-07-23 06:56:25 +02:00
Akim Demaille 9c8e6e05b6 tests: fixes
Fix 6b78e50cef, "cex: make "rerun with
'-Wcex'" a note instead of a warning"

* tests/conflicts.at (-W versus %expect and %expect-rr): Fix
expectations.
2020-07-23 06:33:30 +02:00
Akim Demaille 431774d1f6 cex: update NEWS for 3.7
* NEWS: Update to the current style of cex display.
2020-07-22 07:36:02 +02:00
Akim Demaille 7d5474e979 doc: catch up with the current display of cex
Unfortunately I found no way to use the ↳ glyph in Texinfo, so I used
@arrow{} instead, which has a different width, so we have to have all
the examples doubled, once for TeX, another for the rest of the world.

* doc/bison.texi: Use the current display in the examples.
* doc/calc.y, doc/ids.y, doc/if-then-else.y, doc/sequence.y: New.
2020-07-22 07:36:02 +02:00
Akim Demaille 6b78e50cef cex: make "rerun with '-Wcex'" a note instead of a warning
Currently the suggestion to rerun is a -Wother warning:

    warning: 2 shift/reduce conflicts [-Wconflicts-sr]
    warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]

Instead, let's attach it as a subnote of the diagnostic (in the
current case, -Wconflicts-sr):

    warning: 2 shift/reduce conflicts [-Wconflicts-sr]
    note: rerun with option '-Wcounterexamples' to generate conflict counterexamples

* src/conflicts.c (conflicts_print): Do that.
Adjust the test suite.
2020-07-21 18:57:56 +02:00
Akim Demaille 28769d608e maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-07-20 07:58:03 +02:00
18 changed files with 460 additions and 175 deletions
+1 -1
View File
@@ -1 +1 @@
3.6.92
3.6.93
+115 -66
View File
@@ -1,36 +1,6 @@
GNU Bison NEWS
* Noteworthy changes in release 3.6.93 (2020-07-20) [beta]
** Bug fixes
Portability issues.
* Noteworthy changes in release 3.6.92 (2020-07-19) [beta]
Changes in the display of counterexamples.
** Documentation
*** Examples
The bistromathic demonstrates %param and how to quote sources in the error
messages:
> 123 456
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
1 | 123 456
| ^~~
* Noteworthy changes in release 3.6.91 (2020-07-09) [beta]
** Bug fixes
Portability issues.
* Noteworthy changes in release 3.6.90 (2020-07-04) [beta]
* Noteworthy changes in release 3.7 (2020-07-23) [stable]
** Deprecated features
@@ -48,52 +18,114 @@ Changes in the display of counterexamples.
Contributed by Vincent Imbimbo.
When given `--report=counterexamples` or `-Wcounterexamples`, bison will
now output counterexamples for conflicts in the grammar. These are
strings in the grammar which can be parsed in two ways due to the
conflict. For example:
When given `-Wcounterexamples`/`-Wcex`, bison will now output
counterexamples for conflicts.
Shift/reduce conflict on token "/":
Example exp "+" exp • "/" exp
**** Unifying Counterexamples
Unifying counterexamples are strings which can be parsed in two ways due
to the conflict. For example on a grammar that contains the usual
"dangling else" ambiguity:
$ bison else.y
else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
$ bison else.y -Wcex
else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
Example: "if" exp "then" "if" exp "then" exp • "else" exp
Shift derivation
exp
↳ exp "+" exp
exp • "/" exp
Example exp "+" exp • "/" exp
"if" exp "then" exp
↳ "if" exp "then" exp • "else" exp
Example: "if" exp "then" "if" exp "then" exp • "else" exp
Reduce derivation
exp
exp "/" exp
↳ exp "+" exp •
"if" exp "then" exp "else" exp
"if" exp "then" exp •
When Bison is installed with text styling enabled, the example is actually
shown twice, with colors highlighting the ambiguity.
When text styling is enabled, colors are used in the examples and the
derivations to highlight the structure of both analyses. In this case,
This is a shift/reduce conflict caused by none of the operators having
precedence, so the example can be parsed in the two ways shown. When
bison cannot find an example that can be derived in two ways, it instead
generates two examples that are the same up until the dot:
"if" exp "then" [ "if" exp "then" exp • ] "else" exp
First example expr • ID ',' ID $end
Shift derivation
$accept
↳ s $end
↳ a ID
↳ expr
↳ expr • ID ','
Second example expr • ID $end
Reduce derivation
$accept
↳ s $end
↳ a ID
↳ expr •
vs.
"if" exp "then" [ "if" exp "then" exp • "else" exp ]
The counterexamples are "focused", in two different ways. First, they do
not clutter the output with all the derivations from the start symbol,
rather they start on the "conflicted nonterminal". They go straight to the
point. Second, they don't "expand" nonterminal symbols uselessly.
**** Nonunifying Counterexamples
In the case of the dangling else, Bison found an example that can be
parsed in two ways (therefore proving that the grammar is ambiguous).
When it cannot find such an example, it instead generates two examples
that are the same up until the dot:
$ bison foo.y
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
4 | a: expr
| ^~~~
$ bison -Wcex foo.y
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
First example: expr • ID ',' ID $end
Shift derivation
$accept
↳ s $end
↳ a ID
↳ expr
↳ expr • ID ','
Second example: expr • ID $end
Reduce derivation
$accept
↳ s $end
↳ a ID
↳ expr •
foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
4 | a: expr
| ^~~~
In these cases, the parser usually doesn't have enough lookahead to
differentiate the two given examples.
The counterexamples are "focused" in two different ways. First, they do
not clutter the output with all the derivations from the start symbol,
rather they start on the "conflicted nonterminal". They go straight to the
point. Second, they don't "expand" nonterminal symbols uselessly.
**** Reports
Counterexamples are also included in the report when given
`--report=counterexamples`/`-rcex` (or `--report=all`), with more
technical details:
State 7
1 exp: "if" exp "then" exp • [$end, "then", "else"]
2 | "if" exp "then" exp • "else" exp
"else" shift, and go to state 8
"else" [reduce using rule 1 (exp)]
$default reduce using rule 1 (exp)
shift/reduce conflict on token "else":
1 exp: "if" exp "then" exp •
2 exp: "if" exp "then" exp • "else" exp
Example: "if" exp "then" "if" exp "then" exp • "else" exp
Shift derivation
exp
↳ "if" exp "then" exp
↳ "if" exp "then" exp • "else" exp
Example: "if" exp "then" "if" exp "then" exp • "else" exp
Reduce derivation
exp
↳ "if" exp "then" exp "else" exp
↳ "if" exp "then" exp •
*** File prefix mapping
@@ -107,6 +139,11 @@ Changes in the display of counterexamples.
** Changes
*** Diagnostics
When text styling is enabled and the terminal supports it, the warnings
now include hyperlinks to the documentation.
*** Relocatable installation
When installed to be relocatable (via `configure --enable-relocatable`),
@@ -147,6 +184,18 @@ Changes in the display of counterexamples.
Now the parser state can be examined when parsing is finished. The parser
state is reset when starting a new parse.
** Documentation
*** Examples
The bistromathic demonstrates %param and how to quote sources in the error
messages:
> 123 456
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
1 | 123 456
| ^~~
** Bug fixes
*** Include the generated header (yacc.c)
@@ -4412,7 +4461,7 @@ LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
LocalWords: yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
LocalWords: gotos readline Imbimbo Wcounterexamples
LocalWords: gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
Local Variables:
ispell-dictionary: "american"
+1 -1
View File
@@ -44,7 +44,7 @@ gnulib_modules='
realloc-posix
relocatable-prog relocatable-script
rename
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
timevar
unicodeio unistd unistd-safer unlink unlocked-io
update-copyright unsetenv verify
+226 -53
View File
@@ -9889,10 +9889,11 @@ initially developed by Chinawat Isradisaikul and Andrew Myers
As a first example, see the example grammar of @ref{Shift/Reduce}, which
features on shift/reduce conflict:
@c see doc/if-then-else.y
@example
$ @kbd{bison if-then-else.y}
if-then-else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
if-then-else.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
if-then-else.y: @dnotice{note}: rerun with option '-Wcounterexamples' to generate conflict counterexamples
@end example
@noindent
@@ -9900,32 +9901,46 @@ Let's rerun @command{bison} with the option
@option{-Wcex}/@option{-Wcounterexamples}@inlinefmt{info, (the following
output is actually in color)}:
@ifhtml
@ifnottex
@example
Shift/reduce conflict on token "else":
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
if-then-else.y: @dwarning{warning}: shift/reduce conflict on token "else" [@dwarning{-Wcounterexamples}]
@group
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
Shift derivation @yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
Reduce derivation @yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
Example: @yellow{"if" expr "then"} "if" expr "then" stmt"else" stmt
Shift derivation
@yellow{if_stmt}
@yellow{↳ "if" expr "then"} @green{stmt}
@green{↳} @blue{if_stmt}
@blue{↳ "if" expr "then" stmt} @red{•} @blue{"else" stmt}
Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
Reduce derivation
@yellow{if_stmt}
@yellow{↳ "if" expr "then"} @green{stmt} @yellow{"else" stmt}
@green{↳} @blue{if_stmt}
@blue{↳ "if" expr "then" stmt} @red{•}
@end group
@end example
@end ifhtml
@ifnothtml
@smallexample
Shift/reduce conflict on token "else":
@end ifnottex
@iftex
@example
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
if-then-else.y: @dwarning{warning}: shift/reduce conflict on token "else" [@dwarning{-Wcounterexamples}]
@group
Example
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
Example: @yellow{"if" expr "then"} "if" expr "then" stmt • "else" stmt
Shift derivation
@yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
Example
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
@yellow{if_stmt}
@yellow{@arrow{} "if" expr "then"} @green{stmt}
@green{@arrow{}} @blue{if_stmt}
@blue{@arrow{} "if" expr "then" stmt} @red{•} @blue{"else" stmt}
Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
Reduce derivation
@yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
@yellow{if_stmt}
@yellow{@arrow{} "if" expr "then"} @green{stmt} @yellow{"else" stmt}
@green{@arrow{}} @blue{if_stmt}
@blue{@arrow{} "if" expr "then" stmt} @red{•}
@end group
@end smallexample
@end ifnothtml
@end example
@end iftex
This shows two different derivations for one single expression. That
demonstrates that the grammar is ambiguous.
@@ -9935,6 +9950,7 @@ demonstrates that the grammar is ambiguous.
As a more delicate example, consider the example grammar of
@ref{Reduce/Reduce}, which features a reduce/reduce conflict:
@c doc/sequence.y
@example
%%
sequence:
@@ -9950,32 +9966,112 @@ maybeword:
Bison generates the following counterexamples:
@ifnottex
@example
@group
$ @kbd{bison -Wcex sequence.y}
sequence.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
sequence.y: @dwarning{warning}: 2 reduce/reduce conflicts [@dwarning{-Wconflicts-rr}]
Shift/reduce conflict on token "word":
Example @red{•} @green{"word"}
Shift derivation @yellow{sequence @arrow{} [} @green{maybeword @arrow{} [} @red{•} @green{"word" ]} @yellow{]}
Example @red{•} @yellow{"word"}
Reduce derivation @yellow{sequence @arrow{} [} @green{sequence @arrow{} [} @red{•} @green{]} @yellow{"word" ]}
Reduce/reduce conflict on tokens $end, "word":
Example @red{•}
First derivation @yellow{sequence @arrow{} [} @red{•} @yellow{]}
Example @red{•}
Second derivation @yellow{sequence @arrow{} [} @green{maybeword @arrow{} [} @red{•} @green{]} @yellow{]}
Shift/reduce conflict on token "word":
Example @red{•} @green{"word"}
Shift derivation @yellow{sequence @arrow{} [} @green{maybeword @arrow{} [} @red{•} @green{"word" ]} @yellow{]}
Example @red{•} @yellow{"word"}
Reduce derivation @yellow{sequence @arrow{} [} @green{sequence @arrow{} [} @blue{maybeword @arrow{} [} @red{•} @blue{]} @green{]} @yellow{"word" ]}
@end group
@group
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
Example: @red{•} @green{"word"}
Shift derivation
@yellow{sequence}
@yellow{↳} @green{maybeword}
@green{↳} @red{•} @green{"word"}
Example: @red{•} @yellow{"word"}
Reduce derivation
@yellow{sequence}
@yellow{↳} @green{sequence} @yellow{"word"}
@green{↳} @red{•}
@end group
@group
sequence.y: @dwarning{warning}: reduce/reduce conflict on tokens $end, "word" [@dwarning{-Wcounterexamples}]
Example: @red{•}
First reduce derivation
@yellow{sequence}
@yellow{↳} @red{•}
Example: @red{•}
Second reduce derivation
@yellow{sequence}
@yellow{↳} @green{maybeword}
@green{↳} @red{•}
@end group
@group
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
Example: @red{•} @green{"word"}
Shift derivation
@yellow{sequence}
@yellow{↳} @green{maybeword}
@green{↳} @red{•} @green{"word"}
Example: @red{•} @yellow{"word"}
Reduce derivation
@yellow{sequence}
@yellow{↳} @green{sequence} @yellow{"word"}
@green{↳} @blue{maybeword}
@blue{↳} @red{•}
@end group
@group
sequence.y:8.3-45: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
8 | @dwarning{%empty @{ printf ("empty maybeword\n"); @}}
| @dwarning{^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
@end group
@end example
@end ifnottex
@iftex
@example
@group
$ @kbd{bison -Wcex sequence.y}
sequence.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
sequence.y: @dwarning{warning}: 2 reduce/reduce conflicts [@dwarning{-Wconflicts-rr}]
@end group
@group
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
Example: @red{•} @green{"word"}
Shift derivation
@yellow{sequence}
@yellow{@arrow{}} @green{maybeword}
@green{@arrow{}} @red{•} @green{"word"}
Example: @red{•} @yellow{"word"}
Reduce derivation
@yellow{sequence}
@yellow{@arrow{}} @green{sequence} @yellow{"word"}
@green{@arrow{}} @red{•}
@end group
@group
sequence.y: @dwarning{warning}: reduce/reduce conflict on tokens $end, "word" [@dwarning{-Wcounterexamples}]
Example: @red{•}
First reduce derivation
@yellow{sequence}
@yellow{@arrow{}} @red{•}
Example: @red{•}
Second reduce derivation
@yellow{sequence}
@yellow{@arrow{}} @green{maybeword}
@green{@arrow{}} @red{•}
@end group
@group
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
Example: @red{•} @green{"word"}
Shift derivation
@yellow{sequence}
@yellow{@arrow{}} @green{maybeword}
@green{@arrow{}} @red{•} @green{"word"}
Example: @red{•} @yellow{"word"}
Reduce derivation
@yellow{sequence}
@yellow{@arrow{}} @green{sequence} @yellow{"word"}
@green{@arrow{}} @blue{maybeword}
@blue{@arrow{}} @red{•}
@end group
@group
sequence.y:8.3-45: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
8 | @dwarning{%empty @{ printf ("empty maybeword\n"); @}}
| @dwarning{^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
@end group
@end example
@end iftex
Each of these three conflicts, again, prove that the grammar is ambiguous.
For instance, the second conflict (the reduce/reduce one) shows that the
@@ -9989,6 +10085,7 @@ that are the same up until the dot. Most notably, this will happen when
your grammar requires a stronger parser (more lookahead, LR instead of
LALR). The following example isn't LR(1):
@c doc/ids.y
@example
%token ID
%%
@@ -9999,13 +10096,58 @@ expr: %empty | expr ID ','
@command{bison} reports:
@smallexample
Shift/reduce conflict on token ID:
First example @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
Shift derivation @yellow{$accept @arrow{} [} @green{s @arrow{} [} @blue{a @arrow{} [} @purple{expr @arrow{} [ expr} @red{•} @purple{ID ',' ]} @blue{]} @green{ID ]} @yellow{$end ]}
Second example @blue{expr} @red{•} @green{ID} @yellow{$end}
Reduce derivation @yellow{$accept @arrow{} [} @green{s @arrow{} [} @blue{a @arrow{} [ expr} @red{•} @blue{]} @green{ID ]} @yellow{$end ]}
@end smallexample
@ifnottex
@example
ids.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
ids.y: @dwarning{warning}: shift/reduce conflict on token ID [@dwarning{-Wcounterexamples}]
@group
First example: @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
Shift derivation
@yellow{$accept}
@yellow{↳} @green{s} @yellow{$end}
@green{↳} @blue{a} @green{ID}
@blue{↳} @purple{expr}
@purple{↳ expr} @red{•} @purple{ID ','}
Second example: @blue{expr} @red{•} @green{ID} @yellow{$end}
Reduce derivation
@yellow{$accept}
@yellow{↳} @green{s} @yellow{$end}
@green{↳} @blue{a} @green{ID}
@blue{↳ expr} @red{•}
@end group
@group
ids.y:4.4-7: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
4 | a: expr
| ^~~~
@end group
@end example
@end ifnottex
@iftex
@example
ids.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
ids.y: @dwarning{warning}: shift/reduce conflict on token ID [@dwarning{-Wcounterexamples}]
@group
First example: @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
Shift derivation
@yellow{$accept}
@yellow{@arrow{}} @green{s} @yellow{$end}
@green{@arrow{}} @blue{a} @green{ID}
@blue{@arrow{}} @purple{expr}
@purple{@arrow{} expr} @red{•} @purple{ID ','}
Second example: @blue{expr} @red{•} @green{ID} @yellow{$end}
Reduce derivation
@yellow{$accept}
@yellow{@arrow{}} @green{s} @yellow{$end}
@green{@arrow{}} @blue{a} @green{ID}
@blue{@arrow{} expr} @red{•}
@end group
@group
ids.y:4.4-7: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
4 | a: expr
| ^~~~
@end group
@end example
@end iftex
This conflict is caused by the parser not having enough information to know
the difference between these two examples. The parser would need an
@@ -10041,6 +10183,7 @@ by default. As a consequence, the verbose output file is called
The following grammar file, @file{calc.y}, will be used in the sequel:
@c doc/calc.y
@example
@group
%union
@@ -10084,7 +10227,7 @@ calc.y:19.1-7: @dwarning{warning}: nonterminal useless in grammar: useless [@dwa
19 | @dwarning{useless: STR;}
| @dwarning{^~~~~~~}
calc.y: @dwarning{warning}: 7 shift/reduce conflicts [@dwarning{-Wconflicts-sr}]
calc.y: @dwarning{warning}: rerun with option '-Wcounterexamples' to generate conflict counterexamples [@dwarning{-Wother}]
calc.y: @dnotice{note}: rerun with option '-Wcounterexamples' to generate conflict counterexamples
@end smallexample
Going back to the calc example, when given @option{--report=state},
@@ -10396,15 +10539,44 @@ When given @option{--report=counterexamples}, @command{bison} will generate
counterexamples within the report, augmented with the corresponding items
(@pxref{Counterexamples}).
@ifnottex
@example
Shift/reduce conflict on token '/':
shift/reduce conflict on token '/':
1 exp: exp '+' exp •
4 exp: exp • '/' exp
Example @yellow{exp '+'} @green{exp} @red{•} @green{'/' exp}
Shift derivation @yellow{exp @arrow{} [ exp '+'} @green{exp @arrow{} [ exp} @red{•} @green{'/' exp ]} @yellow{]}
Example @green{exp '+' exp} @red{•} @yellow{'/' exp}
Reduce derivation @yellow{exp @arrow{} [} @green{exp @arrow{} [ exp '+' exp} @red{•} @green{]} @yellow{'/' exp ]}
@group
Example: exp '+' exp • '/' exp
Shift derivation
exp
↳ exp '+' exp
↳ exp • '/' exp
Example: exp '+' exp • '/' exp
Reduce derivation
exp
↳ exp '/' exp
↳ exp '+' exp •
@end group
@end example
@end ifnottex
@iftex
@example
shift/reduce conflict on token '/':
1 exp: exp '+' exp •
4 exp: exp • '/' exp
@group
Example: exp '+' exp • '/' exp
Shift derivation
exp
@arrow{} exp '+' exp
@arrow{} exp • '/' exp
Example: exp '+' exp • '/' exp
Reduce derivation
exp
@arrow{} exp '/' exp
@arrow{} exp '+' exp •
@end group
@end example
@end iftex
This shows two separate derivations in the grammar for the same @code{exp}:
@samp{e1 + e2 / e3}. The derivations show how your rules would parse the
@@ -11414,7 +11586,8 @@ releases of Bison may move warnings from this category to new, more specific
categories.
@item @anchor{Wall}all
All the warnings except @code{dangling-alias} and @code{yacc}.
All the warnings except @code{counterexamples}, @code{dangling-alias} and
@code{yacc}.
@item @anchor{Wnone}none
Turn off all the warnings.
@@ -15854,7 +16027,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
@c LocalWords: TokenKind Automake's rtti Wcounterexamples Chinawat PLDI
@c LocalWords: Isradisaikul tcite pcite rgbGreen colorGreen rgbYellow Wcex
@c LocalWords: colorYellow rgbRed colorRed rgbBlue colorBlue rgbPurple
@c LocalWords: colorPurple ifhtml ifnothtml situ rcex
@c LocalWords: colorPurple ifhtml ifnothtml situ rcex MERCHANTABILITY Wnone
@c Local Variables:
@c ispell-dictionary: "american"
+23
View File
@@ -0,0 +1,23 @@
%union
{
int ival;
const char *sval;
}
%token <ival> NUM
%nterm <ival> exp
%token <sval> STR
%nterm <sval> useless
%left '+' '-'
%left '*'
%%
exp:
exp '+' exp
| exp '-' exp
| exp '*' exp
| exp '/' exp
| NUM
;
useless: STR;
+5
View File
@@ -0,0 +1,5 @@
%token ID
%%
s: a ID
a: expr
expr: %empty | expr ID ','
+13
View File
@@ -0,0 +1,13 @@
%%
stmt:
expr
| if_stmt
;
if_stmt:
"if" expr "then" stmt
| "if" expr "then" stmt "else" stmt
;
expr:
"identifier"
+10
View File
@@ -0,0 +1,10 @@
%%
sequence:
%empty
| maybeword
| sequence "word"
;
maybeword:
%empty
| "word"
;
+1 -1
Submodule gnulib updated: cf6d5db127...ac34618e85
+12 -8
View File
@@ -686,7 +686,8 @@ conflicts_print (void)
expected_rr_conflicts = -1;
}
bool has_unexpected_conflicts = false;
// The warning flags used to emit a diagnostic, if we did.
warnings unexpected_conflicts_warning = Wnone;
/* The following two blocks scream for factoring, but i18n support
would make it ugly. */
{
@@ -703,7 +704,8 @@ conflicts_print (void)
complain (NULL, complaint,
_("shift/reduce conflicts: %d found, %d expected"),
total, expected);
has_unexpected_conflicts = true;
if (total)
unexpected_conflicts_warning = complaint;
}
}
else if (total)
@@ -713,7 +715,7 @@ conflicts_print (void)
"%d shift/reduce conflicts",
total),
total);
has_unexpected_conflicts = true;
unexpected_conflicts_warning = Wconflicts_sr;
}
}
@@ -731,7 +733,8 @@ conflicts_print (void)
complain (NULL, complaint,
_("reduce/reduce conflicts: %d found, %d expected"),
total, expected);
has_unexpected_conflicts = true;
if (total)
unexpected_conflicts_warning = complaint;
}
}
else if (total)
@@ -741,15 +744,16 @@ conflicts_print (void)
"%d reduce/reduce conflicts",
total),
total);
has_unexpected_conflicts = true;
unexpected_conflicts_warning = Wconflicts_rr;
}
}
if (warning_is_enabled (Wcounterexamples))
report_counterexamples ();
else if (has_unexpected_conflicts)
complain (NULL, Wother,
_("rerun with option '-Wcounterexamples' to generate conflict counterexamples"));
else if (unexpected_conflicts_warning != Wnone)
subcomplain (NULL, unexpected_conflicts_warning,
_("rerun with option '-Wcounterexamples'"
" to generate conflict counterexamples"));
}
void
+3 -3
View File
@@ -717,10 +717,10 @@ ssb_equals (const search_state_bundle *s1, const search_state_bundle *s2)
typedef gl_list_t ssb_list;
static size_t
visited_hasher (const search_state *ss, size_t max)
visited_hasher (const search_state *ss, size_t maximum)
{
return (parse_state_hasher (ss->states[0], max)
+ parse_state_hasher (ss->states[1], max)) % max;
return (parse_state_hasher (ss->states[0], maximum)
+ parse_state_hasher (ss->states[1], maximum)) % maximum;
}
static bool
+2 -3
View File
@@ -193,9 +193,8 @@ all_spaces (const char *s)
//
// This function implements this.
//
// When COND is true, put S on OUT, preceeded by *PADDING white
// spaces. Otherwise add the width to *PADDING. Return the width of
// S.
// When COND is true, put S on OUT, preceded by *PADDING white spaces.
// Otherwise add the width to *PADDING. Return the width of S.
static int
fputs_if (bool cond, FILE *out, int *padding, const char *s)
{
+27 -17
View File
@@ -726,7 +726,7 @@ AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]],
[[0]], [[]],
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([[input]])
AT_PARSER_CHECK([[input]], [[1]], [[]],
@@ -737,7 +737,7 @@ AT_PARSER_CHECK([[input]], [[1]], [[]],
AT_BISON_CHECK([[-Dlr.type=canonical-lr -Dparse.lac=full \
-o input.c input.y]], [[0]], [[]],
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([[input]])
AT_PARSER_CHECK([[input]], [[1]], [[]],
@@ -748,7 +748,7 @@ AT_PARSER_CHECK([[input]], [[1]], [[]],
AT_BISON_CHECK([[-Dlr.type=ielr -Dparse.lac=full -o input.c input.y]],
[[0]], [[]],
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([[input]])
AT_PARSER_CHECK([[input]], [[1]], [[]],
@@ -773,7 +773,7 @@ exp: exp OP exp | NUM;
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
# Check the contents of the report.
@@ -1032,7 +1032,7 @@ cond:
AT_BISON_CHECK([-o input.c input.y], 0, [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -1137,7 +1137,7 @@ id : '0';
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -1272,7 +1272,7 @@ exp: exp OP exp | NUM;
AT_BISON_CHECK([-o input.c input.y], 1, [],
[[input.y: error: shift/reduce conflicts: 1 found, 0 expected
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_CLEANUP
@@ -1309,7 +1309,7 @@ exp: exp OP exp | NUM;
AT_BISON_CHECK([-o input.c input.y], 1, [],
[[input.y: error: shift/reduce conflicts: 1 found, 2 expected
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_CLEANUP
@@ -1329,7 +1329,7 @@ a: 'a';
AT_BISON_CHECK([-o input.c input.y], 1, [],
[[input.y: error: reduce/reduce conflicts: 1 found, 0 expected
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_CLEANUP
@@ -1530,7 +1530,7 @@ e: e '+' e
AT_BISON_CHECK([-Wall -o input.c input.y], 0, [],
[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence]
]])
@@ -1638,7 +1638,7 @@ reported_conflicts:
AT_BISON_CHECK([[--report=all input.y]], 0, [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother]
input.y:21.4: warning: rule useless in parser due to conflicts [-Wother]
@@ -1838,7 +1838,7 @@ AT_CHECK([[cat input.y >> input-keep.y]])
AT_BISON_CHECK([[input-keep.y]], 0, [],
[[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
input-keep.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input-keep.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother]
input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother]
@@ -2038,7 +2038,7 @@ exp: 'a' | 'a';
AT_BISON_CHECK([[2.y]], [[0]], [],
[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
2.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -2075,15 +2075,14 @@ B: ;
AT_BISON_CHECK([[sr-rr.y]], [[0]], [[]],
[[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
sr-rr.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_BISON_CHECK([[-Wno-conflicts-sr sr-rr.y]], [[0]], [[]],
[[sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
sr-rr.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]],
[[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
sr-rr.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
]])
[
@@ -2140,19 +2139,30 @@ for gram in sr-rr sr rr; do
]AT_BISON_CHECK([[-Werror $file]])[
else
{
issue_note=false
if test -z "$sr_exp_i" && test "$sr_count" -ne 0; then
echo "warning: $sr_count shift/reduce conflicts"
issue_note=true
elif test "$sr_exp_i" -ne "$sr_count"; then
echo "error: shift/reduce conflicts: $sr_count found, $sr_exp_i expected"
if test "$sr_count" -ne 0; then
issue_note=true
fi
fi
if test -z "$rr_exp_i" && test "$rr_count" -ne 0; then
echo "warning: $rr_count reduce/reduce conflicts"
issue_note=true
elif test "$rr_exp_i" -ne "$rr_count"; then
echo "error: reduce/reduce conflicts: $rr_count found, $rr_exp_i expected"
if test "$rr_count" -ne 0; then
issue_note=true
fi
fi
if $issue_note; then
echo "note: rerun with option '-Wcounterexamples' to generate conflict counterexamples"
fi
} | sed -e "s/^/$file: /" > experr
]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[
echo "$file: error: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Werror=other]" >> experr
]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[
fi
done
+2 -2
View File
@@ -434,7 +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: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
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]
@@ -1419,7 +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: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
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]
+17 -17
View File
@@ -89,7 +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]
glr-regr1.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr1])
AT_PARSER_CHECK([[glr-regr1 BPBPB]], 0,
@@ -214,7 +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]
glr-regr2a.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr2a])
@@ -350,7 +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]
glr-regr3.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr3])
@@ -447,7 +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]
glr-regr4.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr4])
@@ -505,7 +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]
glr-regr5.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr5])
@@ -555,7 +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]
glr-regr6.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr6])
@@ -646,7 +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]
glr-regr7.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr7])
@@ -737,7 +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]
glr-regr8.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr8])
@@ -819,7 +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]
glr-regr9.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr9])
@@ -877,7 +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]
glr-regr10.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr10])
@@ -937,7 +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]
glr-regr11.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr11])
@@ -1060,7 +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]
glr-regr12.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr12])
@@ -1392,7 +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]
glr-regr14.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr14])
@@ -1487,7 +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]
glr-regr15.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr15])
@@ -1549,7 +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]
glr-regr16.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr16])
@@ -1625,7 +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]
glr-regr17.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([glr-regr17])
@@ -1719,7 +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]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]])
AT_COMPILE([input])
-1
View File
@@ -2887,7 +2887,6 @@ input.y:13.1-14: note: previous definition
input.y:14.16-29: warning: %define variable 'parse.error' redefined [-Wother]
input.y:13.16-29: note: previous definition
input.y: error: reduce/reduce conflicts: 0 found, 42 expected
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
]])
+1 -1
View File
@@ -1300,7 +1300,7 @@ dnl INPUT
dnl BISON-STDERR
[AT_COND_CASE([[LALR]],
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
]], [])],
dnl TABLES
+1 -1
View File
@@ -285,7 +285,7 @@ term: 'n'
AT_BISON_CHECK([[-fcaret input.y]], [], [],
[[input.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:2.14-17: warning: rule useless in parser due to conflicts [-Wother]
2 | expr: term | term | term | term | term | term
| ^~~~