Module Name: src
Committed By: rillig
Date: Tue Jul 6 18:43:27 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute.c
Log Message:
tests/lint: add test for empty __attribute__(())
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/gcc_attribute.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.7 src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.8
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.7 Tue Jul 6 17:33:07 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.c Tue Jul 6 18:43:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gcc_attribute.c,v 1.7 2021/07/06 17:33:07 rillig Exp $ */
+/* $NetBSD: gcc_attribute.c,v 1.8 2021/07/06 18:43:27 rillig Exp $ */
# 3 "gcc_attribute.c"
/*
@@ -65,3 +65,22 @@ func(
__attribute__((__noreturn__))
__attribute__((__noreturn__))
);
+
+/*
+ * https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html says that the
+ * attribute-list is a "possibly empty comma-separated sequence of
+ * attributes".
+ *
+ * No matter whether this particular example is interpreted as an empty list
+ * or a list containing a single empty attribute, the result is the same in
+ * both cases.
+ */
+void one_empty_attribute(void)
+ __attribute__((/* none */));
+
+/*
+ * https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html further says that
+ * each individual attribute may be "Empty. Empty attributes are ignored".
+ */
+void two_empty_attributes(void)
+ __attribute__((/* none */, /* still none */));