Module Name: src
Committed By: rillig
Date: Sun Jul 11 19:01:37 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/usr.bin/xlint/lint1/cgram.y
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.311 src/usr.bin/xlint/lint1/cgram.y:1.312
--- src/usr.bin/xlint/lint1/cgram.y:1.311 Sun Jul 11 18:22:02 2021
+++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 11 19:01:37 2021
@@ -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 @@ anonymize(sym_t *s)
%}
-%expect 168
+%expect 167
%union {
val_t *y_val;
@@ -257,6 +257,8 @@ anonymize(sym_t *s)
%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 @@ expression_statement: /* C99 6.8.3 */
;
selection_statement: /* C99 6.8.4 */
- if_without_else {
+ if_without_else %prec T_THEN {
save_warning_flags();
if2();
if3(false);