summaryrefslogtreecommitdiff
path: root/src/conflicts.c
diff options
context:
space:
mode:
authorJoel E. Denny <joeldenny@joeldenny.org>2011-03-27 22:38:32 -0400
committerJoel E. Denny <joeldenny@joeldenny.org>2011-04-09 13:01:41 -0400
commit786743d5eb46abd8510d0362f558e5271d080fd7 (patch)
tree04c810bb8b9a58155d92aeae34d9f7c377b8e792 /src/conflicts.c
parente4a148796a4af75b8728f5c4ec7d01a0cc654a27 (diff)
downloadbison-786743d5eb46abd8510d0362f558e5271d080fd7.tar.gz
Add -Wconflicts-sr and -Wconflicts-rr.
Thus, conflict reports are now affected by -Werror and -Wnone (unless %expect or %expect-rr is specified). Reported by George Neuner at <http://lists.gnu.org/archive/html/bug-bison/2010-08/msg00002.html>. * NEWS (2.5): Document. * doc/bison.texinfo (Bison Options): Document. * src/complain.c, src/complain.h (set_warning_issued): Export function. * src/conflicts.c (conflicts_print): Suppress conflict report based on -Wno-conflicts-sr and -Wno-conflicts-rr, and treat conflicts as errors if -Werror. * src/getargs.c (warnings_flag): Initialize with warnings_conflicts_sr and warnings_conflicts_rr as well. (warnings_args, warnings_types): Add entries for warnings_conflicts_sr and warnings_conflicts_rr. (usage): Update. * src/getargs.h (enum warnings): Add entries for warnings_conflicts_sr and warnings_conflicts_rr. * tests/conflicts.at (-W versus %expect and %expect-rr): New test group. * tests/local.at (AT_BISON_CHECK_NO_XML): Update now that the conflict report can produce a "warnings being treated as errors" message. Also, check that stderr is now fully scrubbed by -Wnone when the exit status is 0. (cherry picked from commit 6f8bdce25df5669b0b200c2a3848a1c08a44eb79)
Diffstat (limited to 'src/conflicts.c')
-rw-r--r--src/conflicts.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/conflicts.c b/src/conflicts.c
index 96034989..c676e33c 100644
--- a/src/conflicts.c
+++ b/src/conflicts.c
@@ -599,8 +599,17 @@ conflicts_print (void)
return;
/* Report the total number of conflicts on STDERR. */
+ if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
+ {
+ if (!(warnings_flag & warnings_conflicts_sr))
+ src_total = 0;
+ if (!(warnings_flag & warnings_conflicts_rr))
+ rrc_total = 0;
+ }
if (src_total | rrc_total)
{
+ if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
+ set_warning_issued ();
if (! yacc_flag)
fprintf (stderr, "%s: ", current_file);
conflict_report (stderr, src_total, rrc_total);