Module Name:    src
Committed By:   rillig
Date:           Tue Jul  6 05:12:44 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 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.254 src/usr.bin/xlint/lint1/cgram.y:1.255
--- src/usr.bin/xlint/lint1/cgram.y:1.254	Tue Jul  6 04:48:17 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 05:12:44 2021
@@ -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 @@ anonymize(sym_t *s)
 }
 %}
 
-%expect 182
+%expect 166
 
 %union {
 	val_t	*y_val;
@@ -690,7 +690,7 @@ declmod:
 	| T_SCLASS {
 		add_storage_class($1);
 	  }
-	| type_attribute_list
+	| type_attribute
 	;
 
 clrtyp_typespec:
@@ -1090,7 +1090,7 @@ notype_direct_decl:
 		end_declaration_level();
 		block_level--;
 	  }
-	| notype_direct_decl type_attribute_list
+	| notype_direct_decl type_attribute
 	;
 
 type_direct_decl:
@@ -1114,7 +1114,7 @@ type_direct_decl:
 		end_declaration_level();
 		block_level--;
 	  }
-	| type_direct_decl type_attribute_list
+	| type_direct_decl type_attribute
 	;
 
 /*
@@ -1492,7 +1492,7 @@ direct_abstract_declarator:		/* C99 6.7.
 		end_declaration_level();
 		block_level--;
 	  }
-	| direct_abstract_declarator type_attribute_list
+	| direct_abstract_declarator type_attribute
 	;
 
 non_expr_statement:

Reply via email to