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: do not allow _Alignas (from C11) o...



details:   https://anonhg.NetBSD.org/src/rev/532e16bb20bb
branches:  trunk
changeset: 984426:532e16bb20bb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jul 06 19:08:28 2021 +0000

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

diffstat:

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

diffs (63 lines):

diff -r bb58a3fe1a3c -r 532e16bb20bb usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Jul 06 18:43:27 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Jul 06 19:08:28 2021 +0000
@@ -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 @@
 }
 %}
 
-%expect 166
+%expect 164
 
 %union {
        val_t   *y_val;
@@ -1407,7 +1407,7 @@
        ;
 
 labeled_statement:             /* C99 6.8.1 */
-         label type_attribute_opt statement
+         label gcc_attribute_list_opt statement
        ;
 
 label:
@@ -1976,8 +1976,6 @@
 
 /* GCC extensions */
 
-/* TODO: split into type_attribute and gcc_attribute */
-
 type_attribute_list:
          type_attribute
        | type_attribute_list type_attribute
@@ -1992,6 +1990,16 @@
        | 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 {



Home | Main Index | Thread Index | Old Index