Module Name:    src
Committed By:   rillig
Date:           Tue Jul  6 19:08:28 UTC 2021

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

Log Message:
lint: do not allow _Alignas (from C11) or __packed after a label


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 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.261 src/usr.bin/xlint/lint1/cgram.y:1.262
--- src/usr.bin/xlint/lint1/cgram.y:1.261	Tue Jul  6 18:28:08 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Jul  6 19:08:28 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.261 2021/07/06 18:28:08 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.262 2021/07/06 19:08:28 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.261 2021/07/06 18:28:08 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.262 2021/07/06 19:08:28 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -123,7 +123,7 @@ anonymize(sym_t *s)
 }
 %}
 
-%expect 166
+%expect 164
 
 %union {
 	val_t	*y_val;
@@ -1407,7 +1407,7 @@ statement:			/* C99 6.8 */
 	;
 
 labeled_statement:		/* C99 6.8.1 */
-	  label type_attribute_opt statement
+	  label gcc_attribute_list_opt statement
 	;
 
 label:
@@ -1976,8 +1976,6 @@ comma_opt:
 
 /* GCC extensions */
 
-/* TODO: split into type_attribute and gcc_attribute */
-
 type_attribute_list:
 	  type_attribute
 	| type_attribute_list type_attribute
@@ -1992,6 +1990,16 @@ type_attribute:
 	| T_NORETURN
 	;
 
+gcc_attribute_list_opt:
+	  /* empty */
+	| gcc_attribute_list
+	;
+
+gcc_attribute_list:
+	  gcc_attribute
+	| gcc_attribute_list gcc_attribute
+	;
+
 /* https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html */
 gcc_attribute:
 	  T_ATTRIBUTE T_LPAREN T_LPAREN {

Reply via email to