warnings: use the regular interface for s/r and r/r conflicts

The current routines used to display s/r and r/r conflicts are both
inconvenient from the programmer point of view (they do not use the
warning infrastructure) and for the user (the messages are rather
terse, not necessarily pleasant to read, and because they don't use
the same routines, they look different).

It was due to the belief (dating back to the initial checked-in
version of Bison) that, at some point, POSIX Yacc mandated the format
for these messages.  Today, the Open Group's manual page for Yacc,
<http://pubs.opengroup.org/onlinepubs/009695399/utilities/yacc.html>,
explicitly states that the format of these messages is unspecified.
See commit be7280480c and
<http://lists.gnu.org/archive/html/bison-patches/2002-12/msg00027.html>.

For a discussion on the chosen warning format, see
http://lists.gnu.org/archive/html/bison-patches/2012-09/msg00039.html

In an effort to factor the handling of errors and warnings, use the
Bison warning routines to report these messages.

* src/conflicts.c (conflicts_print): Rewrite with clearer sections
about S/R and then R/R conflicts.
(conflict_report): Remove, inlined in its sole
caller...
(conflicts_output): here.
* tests/conflicts.at, tests/existing.at, tests/glr-regression.at,
* tests/reduce.at, tests/regression.at: Adjust the expected results.
* NEWS: Update.
This commit is contained in:
Akim Demaille
2012-09-21 17:21:01 +02:00
parent 6c094ad0e3
commit d87ea54cf6
7 changed files with 205 additions and 159 deletions

47
NEWS
View File

@@ -67,6 +67,53 @@ GNU Bison NEWS
%printer {} token1 <type1> <type3> %printer {} token1 <type1> <type3>
%destructor {} token2 <type2> <type4> %destructor {} token2 <type2> <type4>
*** Conflicts
The warnings and error messages about shift/reduce and reduce/reduce
conflicts have been normalized. For instance on the following foo.y file:
%glr-parser
%%
exp: exp '+' exp | '0' | '0';
compare the previous version of bison:
$ bison foo.y
foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
$ bison -Werror foo.y
bison: warnings being treated as errors
foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
with the new behavior:
$ bison foo.y
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
$ bison -Werror foo.y
bison: warnings being treated as errors
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
When %expect or %expect-rr is used, such as with bar.y:
%expect 0
%glr-parser
%%
exp: exp '+' exp | '0' | '0';
Former behavior:
$ bison bar.y
bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
bar.y: expected 0 shift/reduce conflicts
bar.y: expected 0 reduce/reduce conflicts
New one:
$ bison bar.y
bar.y: shift/reduce conflicts: 1 found, 0 expected
bar.y: reduce/reduce conflicts: 2 found, 0 expected
** Additional yylex/yyparse arguments ** Additional yylex/yyparse arguments
The new directive %param declares additional arguments to both yylex and The new directive %param declares additional arguments to both yylex and

View File

@@ -505,22 +505,6 @@ count_rr_conflicts (bool one_per_token)
return res; return res;
} }
/*--------------------------------------------------------.
| Report the number of conflicts, using the Yacc format. |
`--------------------------------------------------------*/
static void
conflict_report (FILE *out, size_t src_num, size_t rrc_num)
{
if (src_num && rrc_num)
fprintf (out, _("conflicts: %zd shift/reduce, %zd reduce/reduce\n"),
src_num, rrc_num);
else if (src_num)
fprintf (out, _("conflicts: %zd shift/reduce\n"), src_num);
else if (rrc_num)
fprintf (out, _("conflicts: %zd reduce/reduce\n"), rrc_num);
}
/*-----------------------------------------------------------. /*-----------------------------------------------------------.
| Output the detailed description of states with conflicts. | | Output the detailed description of states with conflicts. |
@@ -536,10 +520,17 @@ conflicts_output (FILE *out)
state *s = states[i]; state *s = states[i];
if (conflicts[i]) if (conflicts[i])
{ {
int src = count_state_sr_conflicts (s);
int rrc = count_state_rr_conflicts (s, true);
fprintf (out, _("State %d "), i); fprintf (out, _("State %d "), i);
conflict_report (out, if (src && rrc)
count_state_sr_conflicts (s), fprintf (out,
count_state_rr_conflicts (s, true)); _("conflicts: %d shift/reduce, %d reduce/reduce\n"),
src, rrc);
else if (src)
fprintf (out, _("conflicts: %d shift/reduce\n"), src);
else if (rrc)
fprintf (out, _("conflicts: %d reduce/reduce\n"), rrc);
printed_sth = true; printed_sth = true;
} }
} }
@@ -568,64 +559,57 @@ conflicts_total_count (void)
void void
conflicts_print (void) conflicts_print (void)
{ {
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
not set, and then we want 0 SR, or else it is specified, in which
case we want equality. */
bool src_ok;
bool rrc_ok;
int src_expected;
int rrc_expected;
int src_total = count_sr_conflicts ();
int rrc_total = count_rr_conflicts (true);
if (! glr_parser && expected_rr_conflicts != -1) if (! glr_parser && expected_rr_conflicts != -1)
{ {
complain (Wother, _("%%expect-rr applies only to GLR parsers")); complain (Wother, _("%%expect-rr applies only to GLR parsers"));
expected_rr_conflicts = -1; expected_rr_conflicts = -1;
} }
src_expected = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts; /* Screams for factoring, but almost useless because of the
rrc_expected = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts; different strings to translate. */
src_ok = src_total == src_expected; {
rrc_ok = rrc_total == rrc_expected; int total = count_sr_conflicts ();
// If %expect is not used, but %expect-rr is, then expect 0 sr.
int expected =
(expected_sr_conflicts == -1 && expected_rr_conflicts != -1)
? 0
: expected_sr_conflicts;
if (expected != -1)
{
if (expected != total)
complain (complaint,
_("shift/reduce conflicts: %d found, %d expected"),
total, expected);
}
else if (total)
complain (Wconflicts_sr,
ngettext ("%d shift/reduce conflict",
"%d shift/reduce conflicts",
total),
total);
}
/* If there are as many RR conflicts and SR conflicts as {
expected, then there is nothing to report. */ int total = count_rr_conflicts (true);
if (rrc_ok & src_ok) // If %expect-rr is not used, but %expect is, then expect 0 rr.
return; int expected =
(expected_rr_conflicts == -1 && expected_sr_conflicts != -1)
/* Report the total number of conflicts on STDERR. */ ? 0
if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1) : expected_rr_conflicts;
{ if (expected != -1)
if (!(warnings_flag & Wconflicts_sr)) {
src_total = 0; if (expected != total)
if (!(warnings_flag & Wconflicts_rr)) complain (complaint,
rrc_total = 0; _("reduce/reduce conflicts: %d found, %d expected"),
} total, expected);
if (src_total | rrc_total) }
{ else if (total)
if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1) complain (Wconflicts_rr,
set_warning_issued (); ngettext ("%d reduce/reduce conflict",
if (! yacc_flag) "%d reduce/reduce conflicts",
fprintf (stderr, "%s: ", current_file); total),
conflict_report (stderr, src_total, rrc_total); total);
} }
if (expected_sr_conflicts != -1 || expected_rr_conflicts != -1)
{
if (! src_ok)
complain (complaint, ngettext ("expected %d shift/reduce conflict",
"expected %d shift/reduce conflicts",
src_expected),
src_expected);
if (! rrc_ok)
complain (complaint, ngettext ("expected %d reduce/reduce conflict",
"expected %d reduce/reduce conflicts",
rrc_expected),
rrc_expected);
}
} }

View File

@@ -498,7 +498,7 @@ AT_BISON_OPTION_POPDEFS
# Show canonical LR's failure. # Show canonical LR's failure.
AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]], AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]],
[[0]], [[]], [[0]], [[]],
[[input.y: conflicts: 2 shift/reduce [[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
]]) ]])
AT_COMPILE([[input]]) AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]], [[1]], [[]], AT_PARSER_CHECK([[./input]], [[1]], [[]],
@@ -508,7 +508,7 @@ AT_PARSER_CHECK([[./input]], [[1]], [[]],
# It's corrected by LAC. # It's corrected by LAC.
AT_BISON_CHECK([[-Dlr.type=canonical-lr -Dparse.lac=full \ AT_BISON_CHECK([[-Dlr.type=canonical-lr -Dparse.lac=full \
-o input.c input.y]], [[0]], [[]], -o input.c input.y]], [[0]], [[]],
[[input.y: conflicts: 2 shift/reduce [[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
]]) ]])
AT_COMPILE([[input]]) AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]], [[1]], [[]], AT_PARSER_CHECK([[./input]], [[1]], [[]],
@@ -518,7 +518,7 @@ AT_PARSER_CHECK([[./input]], [[1]], [[]],
# IELR is sufficient when LAC is used. # IELR is sufficient when LAC is used.
AT_BISON_CHECK([[-Dlr.type=ielr -Dparse.lac=full -o input.c input.y]], AT_BISON_CHECK([[-Dlr.type=ielr -Dparse.lac=full -o input.c input.y]],
[[0]], [[]], [[0]], [[]],
[[input.y: conflicts: 2 shift/reduce [[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
]]) ]])
AT_COMPILE([[input]]) AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]], [[1]], [[]], AT_PARSER_CHECK([[./input]], [[1]], [[]],
@@ -542,8 +542,8 @@ exp: exp OP exp | NUM;
]]) ]])
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [], AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
[input.y: conflicts: 1 shift/reduce [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
]) ]])
# Check the contents of the report. # Check the contents of the report.
AT_CHECK([cat input.output], [], AT_CHECK([cat input.output], [],
@@ -784,7 +784,7 @@ cond:
]]) ]])
AT_BISON_CHECK([-o input.c input.y], 0, [], AT_BISON_CHECK([-o input.c input.y], 0, [],
[[input.y: conflicts: 1 shift/reduce [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y:12.3-18: warning: rule useless in parser due to conflicts: cond: cond "then" cond [-Wother] input.y:12.3-18: warning: rule useless in parser due to conflicts: cond: cond "then" cond [-Wother]
]]) ]])
@@ -828,7 +828,7 @@ id : '0';
]]) ]])
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [], AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
[[input.y: conflicts: 1 reduce/reduce [[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y:4.6-8: warning: rule useless in parser due to conflicts: id: '0' [-Wother] input.y:4.6-8: warning: rule useless in parser due to conflicts: id: '0' [-Wother]
]]) ]])
@@ -945,9 +945,8 @@ exp: exp OP exp | NUM;
]]) ]])
AT_BISON_CHECK([-o input.c input.y], 1, [], AT_BISON_CHECK([-o input.c input.y], 1, [],
[input.y: conflicts: 1 shift/reduce [[input.y: shift/reduce conflicts: 1 found, 0 expected
input.y: expected 0 shift/reduce conflicts ]])
])
AT_CLEANUP AT_CLEANUP
@@ -982,9 +981,8 @@ exp: exp OP exp | NUM;
]]) ]])
AT_BISON_CHECK([-o input.c input.y], 1, [], AT_BISON_CHECK([-o input.c input.y], 1, [],
[input.y: conflicts: 1 shift/reduce [[input.y: shift/reduce conflicts: 1 found, 2 expected
input.y: expected 2 shift/reduce conflicts ]])
])
AT_CLEANUP AT_CLEANUP
@@ -1002,9 +1000,8 @@ a: 'a';
]]) ]])
AT_BISON_CHECK([-o input.c input.y], 1, [], AT_BISON_CHECK([-o input.c input.y], 1, [],
[input.y: conflicts: 1 reduce/reduce [[input.y: reduce/reduce conflicts: 1 found, 0 expected
input.y: expected 0 reduce/reduce conflicts ]])
])
AT_CLEANUP AT_CLEANUP
@@ -1046,7 +1043,7 @@ e: e '+' e
]]) ]])
AT_BISON_CHECK([-o input.c input.y], 0, [], AT_BISON_CHECK([-o input.c input.y], 0, [],
[[input.y: conflicts: 4 shift/reduce [[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
]]) ]])
AT_CLEANUP AT_CLEANUP
@@ -1148,7 +1145,8 @@ reported_conflicts:
]]) ]])
AT_BISON_CHECK([[--report=all input.y]], 0, [], AT_BISON_CHECK([[--report=all input.y]], 0, [],
[[input.y: conflicts: 1 shift/reduce, 1 reduce/reduce [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y:12.5-20: warning: rule useless in parser due to conflicts: resolved_conflict: 'a' unreachable1 [-Wother] input.y:12.5-20: warning: rule useless in parser due to conflicts: resolved_conflict: 'a' unreachable1 [-Wother]
input.y:20.5-20: warning: rule useless in parser due to conflicts: unreachable1: 'a' unreachable2 [-Wother] input.y:20.5-20: warning: rule useless in parser due to conflicts: unreachable1: 'a' unreachable2 [-Wother]
input.y:21.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ [-Wother] input.y:21.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ [-Wother]
@@ -1300,7 +1298,8 @@ AT_DATA([[input-keep.y]],
AT_CHECK([[cat input.y >> input-keep.y]]) AT_CHECK([[cat input.y >> input-keep.y]])
AT_BISON_CHECK([[input-keep.y]], 0, [], AT_BISON_CHECK([[input-keep.y]], 0, [],
[[input-keep.y: conflicts: 2 shift/reduce, 2 reduce/reduce [[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
input-keep.y:22.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ [-Wother] input-keep.y:22.4: warning: rule useless in parser due to conflicts: unreachable1: /* empty */ [-Wother]
input-keep.y:26.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ [-Wother] input-keep.y:26.16: warning: rule useless in parser due to conflicts: unreachable2: /* empty */ [-Wother]
input-keep.y:32.5-7: warning: rule useless in parser due to conflicts: reported_conflicts: 'a' [-Wother] input-keep.y:32.5-7: warning: rule useless in parser due to conflicts: reported_conflicts: 'a' [-Wother]
@@ -1483,7 +1482,7 @@ exp: 'a' | 'a';
AT_BISON_CHECK([[2.y]], [[0]], [], AT_BISON_CHECK([[2.y]], [[0]], [],
[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother] [[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
2.y: conflicts: 1 reduce/reduce 2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2.y:3.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother] 2.y:3.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
]]) ]])
@@ -1518,17 +1517,27 @@ B: ;
]]) ]])
AT_BISON_CHECK([[sr-rr.y]], [[0]], [[]], AT_BISON_CHECK([[sr-rr.y]], [[0]], [[]],
[[sr-rr.y: conflicts: 1 shift/reduce, 1 reduce/reduce [[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]]) ]])
AT_BISON_CHECK([[-Wno-conflicts-sr sr-rr.y]], [[0]], [[]], AT_BISON_CHECK([[-Wno-conflicts-sr sr-rr.y]], [[0]], [[]],
[[sr-rr.y: conflicts: 1 reduce/reduce [[sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]]) ]])
AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]], AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]],
[[sr-rr.y: conflicts: 1 shift/reduce [[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
]]) ]])
[for gram in sr-rr sr rr; do [
# This is piece of code is rather complex for a simple task: try every
# combinaison of (0 or 1 real SR) x (0 or 1 real RR) x (don't %expect
# or %expect 0, 1, or 2 SR) x (don't %expect-rr or %expect-rr 0, 1, or 2
# RR).
# Number and types of genuine conflicts in the grammar.
for gram in sr-rr sr rr; do
# Number of expected s/r conflicts.
for sr_exp_i in '' 0 1 2; do for sr_exp_i in '' 0 1 2; do
# Number of expected r/r conflicts.
for rr_exp_i in '' 0 1 2; do for rr_exp_i in '' 0 1 2; do
test -z "$sr_exp_i" && test -z "$rr_exp_i" && continue test -z "$sr_exp_i" && test -z "$rr_exp_i" && continue
@@ -1551,36 +1560,38 @@ AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]],
echo "$directives" > $file echo "$directives" > $file
cat $gram.y >> $file cat $gram.y >> $file
# Count actual conflicts. # Number of found conflicts.
conflicts= case $gram in
sr_count=0 (sr) sr_count=1; rr_count=0;;
rr_count=0 (rr) sr_count=0; rr_count=1;;
if test $gram = sr || test $gram = sr-rr; then (sr-rr) sr_count=1; rr_count=1;;
conflicts="1 shift/reduce" esac
sr_count=1
fi # Update number of expected conflicts: if %expect is given then
if test $gram = rr || test $gram = sr-rr; then # %expect-rr defaults to 0, and vice-versa. Leave empty if
if test -n "$conflicts"; then # nothing expected.
conflicts="$conflicts, " case $sr_exp_i:$rr_exp_i in
fi ?:) rr_exp_i=0;;
conflicts="${conflicts}1 reduce/reduce" :?) sr_exp_i=0;;
rr_count=1 esac
fi
# Run tests. # Run tests.
if test $sr_count -eq $sr_exp && test $rr_count -eq $rr_exp; then if test $sr_count -eq $sr_exp && test $rr_count -eq $rr_exp; then
]AT_BISON_CHECK([[-Wnone $file]])[ ]AT_BISON_CHECK([[-Wnone $file]])[
]AT_BISON_CHECK([[-Werror $file]])[ ]AT_BISON_CHECK([[-Werror $file]])[
else else
echo "$file: conflicts: $conflicts" > experr {
if test $sr_count -ne $sr_exp; then if test -z "$sr_exp_i" && test "$sr_count" -ne 0; then
if test $sr_exp -ne 1; then s=s; else s= ; fi echo "warning: $sr_count shift/reduce conflicts"
echo "$file: expected $sr_exp shift/reduce conflict$s" >> experr elif test "$sr_exp_i" -ne "$sr_count"; then
fi echo "shift/reduce conflicts: $sr_count found, $sr_exp_i expected"
if test $rr_count -ne $rr_exp; then fi
if test $rr_exp -ne 1; then s=s; else s= ; fi if test -z "$rr_exp_i" && test "$rr_count" -ne 0; then
echo "$file: expected $rr_exp reduce/reduce conflict$s" >> experr echo "warning: $rr_count reduce/reduce conflicts"
fi elif test "$rr_exp_i" -ne "$rr_count"; then
echo "reduce/reduce conflicts: $rr_count found, $rr_exp_i expected"
fi
} | sed -e "s/^/$file: /" > experr
]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[ ]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[
]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[ ]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[
fi fi

View File

@@ -424,8 +424,8 @@ dnl don't like even `print $!4;'.
dnl BISON-STDERR dnl BISON-STDERR
[AT_COND_CASE([[canonical LR]], [AT_COND_CASE([[canonical LR]],
[[input.y: conflicts: 265 shift/reduce]], [[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
[[input.y: conflicts: 65 shift/reduce]])[ [[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
]], ]],
dnl LAST-STATE dnl LAST-STATE
@@ -1365,8 +1365,10 @@ dnl INPUT
dnl BISON-STDERR dnl BISON-STDERR
[AT_COND_CASE([[canonical LR]], [AT_COND_CASE([[canonical LR]],
[[input.y: conflicts: 1876 shift/reduce, 144 reduce/reduce]], [[input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr]
[[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce]])[ 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]]])[
]], ]],
dnl LAST-STATE dnl LAST-STATE

View File

@@ -93,8 +93,8 @@ yylex (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr1.c glr-regr1.y]], 0, [], AT_BISON_CHECK([[-o glr-regr1.c glr-regr1.y]], 0, [],
[glr-regr1.y: conflicts: 1 shift/reduce [[glr-regr1.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
]) ]])
AT_COMPILE([glr-regr1]) AT_COMPILE([glr-regr1])
AT_PARSER_CHECK([[echo BPBPB | ./glr-regr1]], 0, AT_PARSER_CHECK([[echo BPBPB | ./glr-regr1]], 0,
[[E -> 'B' [[E -> 'B'
@@ -208,8 +208,8 @@ main (int argc, char **argv)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr2a.c glr-regr2a.y]], 0, [], AT_BISON_CHECK([[-o glr-regr2a.c glr-regr2a.y]], 0, [],
[glr-regr2a.y: conflicts: 2 shift/reduce [[glr-regr2a.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
]) ]])
AT_COMPILE([glr-regr2a]) AT_COMPILE([glr-regr2a])
AT_PARSER_CHECK([[echo s VARIABLE_1 t v x q | ./glr-regr2a]], 0, AT_PARSER_CHECK([[echo s VARIABLE_1 t v x q | ./glr-regr2a]], 0,
@@ -325,8 +325,9 @@ main(int argc, char* argv[])
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr3.c glr-regr3.y]], 0, [], AT_BISON_CHECK([[-o glr-regr3.c glr-regr3.y]], 0, [],
[glr-regr3.y: conflicts: 1 shift/reduce, 1 reduce/reduce [[glr-regr3.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
]) glr-regr3.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]])
AT_COMPILE([glr-regr3]) AT_COMPILE([glr-regr3])
AT_PARSER_CHECK([[echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3]], AT_PARSER_CHECK([[echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3]],
@@ -417,8 +418,8 @@ merge (YYSTYPE s1, YYSTYPE s2)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr4.c glr-regr4.y]], 0, [], AT_BISON_CHECK([[-o glr-regr4.c glr-regr4.y]], 0, [],
[glr-regr4.y: conflicts: 1 reduce/reduce [[glr-regr4.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr4]) AT_COMPILE([glr-regr4])
AT_PARSER_CHECK([[./glr-regr4]], 0, AT_PARSER_CHECK([[./glr-regr4]], 0,
@@ -477,8 +478,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr5.c glr-regr5.y]], 0, [], AT_BISON_CHECK([[-o glr-regr5.c glr-regr5.y]], 0, [],
[glr-regr5.y: conflicts: 1 reduce/reduce [[glr-regr5.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr5]) AT_COMPILE([glr-regr5])
AT_PARSER_CHECK([[./glr-regr5]], 0, [], AT_PARSER_CHECK([[./glr-regr5]], 0, [],
@@ -529,8 +530,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr6.c glr-regr6.y]], 0, [], AT_BISON_CHECK([[-o glr-regr6.c glr-regr6.y]], 0, [],
[glr-regr6.y: conflicts: 1 reduce/reduce [[glr-regr6.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr6]) AT_COMPILE([glr-regr6])
AT_PARSER_CHECK([[./glr-regr6]], 0, AT_PARSER_CHECK([[./glr-regr6]], 0,
@@ -618,8 +619,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr7.c glr-regr7.y]], 0, [], AT_BISON_CHECK([[-o glr-regr7.c glr-regr7.y]], 0, [],
[glr-regr7.y: conflicts: 2 reduce/reduce [[glr-regr7.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr7]) AT_COMPILE([glr-regr7])
AT_PARSER_CHECK([[./glr-regr7]], 2, [], AT_PARSER_CHECK([[./glr-regr7]], 2, [],
@@ -712,8 +713,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr8.c glr-regr8.y]], 0, [], AT_BISON_CHECK([[-o glr-regr8.c glr-regr8.y]], 0, [],
[glr-regr8.y: conflicts: 1 reduce/reduce [[glr-regr8.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr8]) AT_COMPILE([glr-regr8])
AT_PARSER_CHECK([[./glr-regr8]], 0, AT_PARSER_CHECK([[./glr-regr8]], 0,
@@ -792,8 +793,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr9.c glr-regr9.y]], 0, [], AT_BISON_CHECK([[-o glr-regr9.c glr-regr9.y]], 0, [],
[glr-regr9.y: conflicts: 1 reduce/reduce [[glr-regr9.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr9]) AT_COMPILE([glr-regr9])
AT_PARSER_CHECK([[./glr-regr9]], 0, [], AT_PARSER_CHECK([[./glr-regr9]], 0, [],
@@ -848,8 +849,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr10.c glr-regr10.y]], 0, [], AT_BISON_CHECK([[-o glr-regr10.c glr-regr10.y]], 0, [],
[glr-regr10.y: conflicts: 1 reduce/reduce [[glr-regr10.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr10]) AT_COMPILE([glr-regr10])
AT_PARSER_CHECK([[./glr-regr10]], 0, [], []) AT_PARSER_CHECK([[./glr-regr10]], 0, [], [])
@@ -906,8 +907,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr11.c glr-regr11.y]], 0, [], AT_BISON_CHECK([[-o glr-regr11.c glr-regr11.y]], 0, [],
[glr-regr11.y: conflicts: 1 reduce/reduce [[glr-regr11.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr11]) AT_COMPILE([glr-regr11])
AT_PARSER_CHECK([[./glr-regr11]], 0, [], []) AT_PARSER_CHECK([[./glr-regr11]], 0, [], [])
@@ -1027,8 +1028,9 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr12.c glr-regr12.y]], 0, [], AT_BISON_CHECK([[-o glr-regr12.c glr-regr12.y]], 0, [],
[glr-regr12.y: conflicts: 1 shift/reduce, 1 reduce/reduce [[glr-regr12.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
]) glr-regr12.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]])
AT_COMPILE([glr-regr12]) AT_COMPILE([glr-regr12])
AT_PARSER_CHECK([[./glr-regr12]], 0, [], []) AT_PARSER_CHECK([[./glr-regr12]], 0, [], [])
@@ -1357,8 +1359,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr14.c glr-regr14.y]], 0, [], AT_BISON_CHECK([[-o glr-regr14.c glr-regr14.y]], 0, [],
[glr-regr14.y: conflicts: 3 reduce/reduce [[glr-regr14.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr14]) AT_COMPILE([glr-regr14])
AT_PARSER_CHECK([[./glr-regr14]], 0, AT_PARSER_CHECK([[./glr-regr14]], 0,
@@ -1450,8 +1452,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr15.c glr-regr15.y]], 0, [], AT_BISON_CHECK([[-o glr-regr15.c glr-regr15.y]], 0, [],
[glr-regr15.y: conflicts: 2 reduce/reduce [[glr-regr15.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr15]) AT_COMPILE([glr-regr15])
AT_PARSER_CHECK([[./glr-regr15]], 0, [], AT_PARSER_CHECK([[./glr-regr15]], 0, [],
@@ -1510,8 +1512,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr16.c glr-regr16.y]], 0, [], AT_BISON_CHECK([[-o glr-regr16.c glr-regr16.y]], 0, [],
[glr-regr16.y: conflicts: 1 reduce/reduce [[glr-regr16.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr16]) AT_COMPILE([glr-regr16])
AT_PARSER_CHECK([[./glr-regr16]], 0, [], AT_PARSER_CHECK([[./glr-regr16]], 0, [],
@@ -1595,8 +1597,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr17.c glr-regr17.y]], 0, [], AT_BISON_CHECK([[-o glr-regr17.c glr-regr17.y]], 0, [],
[glr-regr17.y: conflicts: 3 reduce/reduce [[glr-regr17.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
]) ]])
AT_COMPILE([glr-regr17]) AT_COMPILE([glr-regr17])
AT_PARSER_CHECK([[./glr-regr17]], 0, [], AT_PARSER_CHECK([[./glr-regr17]], 0, [],
@@ -1698,8 +1700,8 @@ main (void)
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o input.c input.y]], 0, [], AT_BISON_CHECK([[-o input.c input.y]], 0, [],
[input.y: conflicts: 1 reduce/reduce [[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]) ]])
AT_COMPILE([input]) AT_COMPILE([input])
AT_PARSER_CHECK([[./input]], 1, [], AT_PARSER_CHECK([[./input]], 1, [],

View File

@@ -1191,7 +1191,7 @@ dnl INPUT
dnl BISON-STDERR dnl BISON-STDERR
[AT_COND_CASE([[LALR]], [AT_COND_CASE([[LALR]],
[[input.y: conflicts: 1 reduce/reduce [[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
]], [])], ]], [])],
dnl TABLES dnl TABLES

View File

@@ -1461,7 +1461,7 @@ main (void)
AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \ AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
-Dparse.lac.memory-trace=full \ -Dparse.lac.memory-trace=full \
-t -o input.c input.y]], [[0]], [], -t -o input.c input.y]], [[0]], [],
[[input.y: conflicts: 21 shift/reduce [[input.y: warning: 21 shift/reduce conflicts [-Wconflicts-sr]
]]) ]])
AT_COMPILE([[input]]) AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input > stdout.txt 2> stderr.txt]], [[1]]) AT_PARSER_CHECK([[./input > stdout.txt 2> stderr.txt]], [[1]])
@@ -1537,7 +1537,7 @@ main (void)
AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \ AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
-t -o input.c input.y]], [[0]], [], -t -o input.c input.y]], [[0]], [],
[[input.y: conflicts: 8 shift/reduce [[input.y: warning: 8 shift/reduce conflicts [-Wconflicts-sr]
]]) ]])
AT_COMPILE([[input]]) AT_COMPILE([[input]])
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS