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: reduce grammar conflicts for GCC a...



details:   https://anonhg.NetBSD.org/src/rev/f99228242b33
branches:  trunk
changeset: 1022143:f99228242b33
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jul 06 05:12:44 2021 +0000

description:
lint: reduce grammar conflicts for GCC attributes

In all but one case, the use of type_attribute_list introduced an
unnecessary ambiguity in the grammar.  It appeared in a place where it
could be repeated either by the type_attribute_list or by the enclosing
rule.  Both variants have the same effect.

No functional change.

diffstat:

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

diffs (64 lines):

diff -r f839c324be5c -r f99228242b33 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Jul 06 04:48:17 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Jul 06 05:12:44 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.254 2021/07/06 04:48:17 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 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.254 2021/07/06 04:48:17 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.255 2021/07/06 05:12:44 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -123,7 +123,7 @@
 }
 %}
 
-%expect 182
+%expect 166
 
 %union {
        val_t   *y_val;
@@ -690,7 +690,7 @@
        | T_SCLASS {
                add_storage_class($1);
          }
-       | type_attribute_list
+       | type_attribute
        ;
 
 clrtyp_typespec:
@@ -1090,7 +1090,7 @@
                end_declaration_level();
                block_level--;
          }
-       | notype_direct_decl type_attribute_list
+       | notype_direct_decl type_attribute
        ;
 
 type_direct_decl:
@@ -1114,7 +1114,7 @@
                end_declaration_level();
                block_level--;
          }
-       | type_direct_decl type_attribute_list
+       | type_direct_decl type_attribute
        ;
 
 /*
@@ -1492,7 +1492,7 @@
                end_declaration_level();
                block_level--;
          }
-       | direct_abstract_declarator type_attribute_list
+       | direct_abstract_declarator type_attribute
        ;
 
 non_expr_statement:



Home | Main Index | Thread Index | Old Index