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: resolve shift/reduce conflict in n...



details:   https://anonhg.NetBSD.org/src/rev/94262ac1f22e
branches:  trunk
changeset: 984553:94262ac1f22e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 11 18:22:02 2021 +0000

description:
lint: resolve shift/reduce conflict in notype_direct_decl

When a notype_direct_decl was followed by a type_attribute_list, and the
next token was another type_attribute, the parser could either continue
the current type_attribute_list or start a new one.  Either way has the
same effect since type_attribute_list has no associated action.

This reduces the conflicts by 4, one for each of T_ALIGNAS, T_ATTRIBUTE,
T_NORETURN, T_PACKED.  There are several other conflicts involving these
4 tokens, but they are harder to fix.

No functional change.

diffstat:

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

diffs (37 lines):

diff -r 8c2e39595a3a -r 94262ac1f22e usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jul 11 18:03:47 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jul 11 18:22:02 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.310 2021/07/11 18:03:47 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.311 2021/07/11 18:22:02 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.310 2021/07/11 18:03:47 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.311 2021/07/11 18:22:02 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -124,7 +124,7 @@
 
 %}
 
-%expect 172
+%expect 168
 
 %union {
        val_t   *y_val;
@@ -979,7 +979,7 @@
                end_declaration_level();
                block_level--;
          }
-       | notype_direct_decl type_attribute_list
+       | notype_direct_decl type_attribute
        ;
 
 type_direct_decl:



Home | Main Index | Thread Index | Old Index