Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: fix shift/reduce conflict for dang...



details:   https://anonhg.NetBSD.org/src/rev/ee573d397891
branches:  trunk
changeset: 1022291:ee573d397891
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 11 19:01:37 2021 +0000

description:
lint: fix shift/reduce conflict for dangling else

The following line no longer occurs in the yacc output:
257: shift/reduce conflict (shift 427, reduce 270) on T_ELSE

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r f2fe7fccb892 -r ee573d397891 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jul 11 18:58:13 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jul 11 19:01:37 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.311 2021/07/11 18:22:02 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.312 2021/07/11 19:01:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.311 2021/07/11 18:22:02 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.312 2021/07/11 19:01:37 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -124,7 +124,7 @@
 
 %}
 
-%expect 168
+%expect 167
 
 %union {
        val_t   *y_val;
@@ -257,6 +257,8 @@
 %token                 T_AT_WARN_UNUSED_RESULT
 %token                 T_AT_WEAK
 
+%left  T_THEN
+%left  T_ELSE
 %left  T_COMMA
 %right T_ASSIGN T_OPASSIGN
 %right T_QUEST T_COLON
@@ -1486,7 +1488,7 @@
        ;
 
 selection_statement:           /* C99 6.8.4 */
-         if_without_else {
+         if_without_else %prec T_THEN {
                save_warning_flags();
                if2();
                if3(false);



Home | Main Index | Thread Index | Old Index