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: inline grammar rules declmod and q...



details:   https://anonhg.NetBSD.org/src/rev/b9aaf36e928b
branches:  trunk
changeset: 1022261:b9aaf36e928b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 10 21:44:51 2021 +0000

description:
lint: inline grammar rules declmod and qualifier_or_storage_class

The rule declmod had a confusing name since declmods was not exactly a
list of declmod.

Inlining the rules reduces the abstraction level.  There are still some
shift/reduce conflicts in that area, so make the rules as simple as
possible, in order to resolve these conflicts.

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diffs (53 lines):

diff -r f3343373b43e -r b9aaf36e928b usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sat Jul 10 21:08:16 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sat Jul 10 21:44:51 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.303 2021/07/10 21:08:16 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.304 2021/07/10 21:44:51 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.303 2021/07/10 21:08:16 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.304 2021/07/10 21:44:51 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -535,23 +535,22 @@
          add_type_specifier
        | declmods add_type_specifier
        | type_attribute declaration_specifiers
-       | declaration_specifiers declmod
+       | declaration_specifiers add_storage_class
        | declaration_specifiers add_notype_type_specifier
+       | declaration_specifiers add_type_qualifier
+       | declaration_specifiers type_attribute
        ;
 
 declmods:
-         qualifier_or_storage_class
-       | declmods declmod
+         add_storage_class
+       | add_type_qualifier
+       | declmods add_storage_class
+       | declmods add_type_qualifier
+       | declmods type_attribute
        ;
 
-declmod:
-         qualifier_or_storage_class
-       | type_attribute
-       ;
-
-qualifier_or_storage_class:
-         add_type_qualifier
-       | T_SCLASS {
+add_storage_class:
+         T_SCLASS {
                add_storage_class($1);
          }
        ;



Home | Main Index | Thread Index | Old Index