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: remove 6 conflicts from the gramma...



details:   https://anonhg.NetBSD.org/src/rev/74442f70c642
branches:  trunk
changeset: 1022214:74442f70c642
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 09 20:51:27 2021 +0000

description:
lint: remove 6 conflicts from the grammar, in type_direct_decl

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diffs (66 lines):

diff -r b9585b6a4603 -r 74442f70c642 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Jul 09 20:36:34 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Fri Jul 09 20:51:27 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.276 2021/07/09 20:36:34 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.277 2021/07/09 20:51:27 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.276 2021/07/09 20:36:34 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.277 2021/07/09 20:51:27 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -123,7 +123,7 @@
 }
 %}
 
-%expect 156
+%expect 150
 
 %union {
        val_t   *y_val;
@@ -949,9 +949,12 @@
        ;
 
 type_decl:
-         type_direct_decl
-       | pointer type_direct_decl {
-               $$ = add_pointer($2, $1);
+       /* TODO: removing type_attribute_list_opt here removes another 16 conflicts */
+         type_attribute_list_opt type_direct_decl {
+               $$ = $2;
+         }
+       | pointer type_attribute_list_opt type_direct_decl {
+               $$ = add_pointer($3, $1);
          }
        ;
 
@@ -976,11 +979,6 @@
        | notype_direct_decl type_attribute
        ;
 
-/*
- * XXX: shift/reduce conflict, caused by:
- *     type_attribute type_direct_decl
- *     type_direct_decl type_attribute
- */
 type_direct_decl:
          identifier {
                $$ = declarator_name(getsym($1));
@@ -988,9 +986,6 @@
        | T_LPAREN type_decl T_RPAREN {
                $$ = $2;
          }
-       | type_attribute type_direct_decl {
-               $$ = $2;
-         }
        | type_direct_decl T_LBRACK T_RBRACK {
                $$ = add_array($1, false, 0);
          }



Home | Main Index | Thread Index | Old Index