Module Name: src
Committed By: rillig
Date: Fri Apr 29 07:02:40 UTC 2022
Modified Files:
src/usr.bin/xlint/lint1: cgram.y
Log Message:
lint: only allow GCC attribute in null statement
The only indented usage in that position is a fallthrough statement, as
a replacement for a /* FALLTHROUGH */ comment. There is no point in
using _Noreturn or _Alignas as a statement.
Ideally, instead of gcc_attribute, the grammar would allow
gcc_attribute_list here (as always with GCC attributes), but that would
have introduced a reduce/reduce conflict, due to the attributes in the
middle of labeled_statement.
To generate a diff of this commit:
cvs rdiff -u -r1.404 -r1.405 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.404 src/usr.bin/xlint/lint1/cgram.y:1.405
--- src/usr.bin/xlint/lint1/cgram.y:1.404 Fri Apr 29 06:40:51 2022
+++ src/usr.bin/xlint/lint1/cgram.y Fri Apr 29 07:02:40 2022
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.404 2022/04/29 06:40:51 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.405 2022/04/29 07:02:40 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.404 2022/04/29 06:40:51 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.405 2022/04/29 07:02:40 rillig Exp $");
#endif
#include <limits.h>
@@ -1643,7 +1643,7 @@ statement: /* C99 6.8 */
;
non_expr_statement: /* helper for C99 6.8 */
- type_attribute T_SEMI
+ gcc_attribute /* ((__fallthrough__)) */ T_SEMI
| labeled_statement
| compound_statement
| selection_statement