Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: add test for empty __a...



details:   https://anonhg.NetBSD.org/src/rev/bb58a3fe1a3c
branches:  trunk
changeset: 984425:bb58a3fe1a3c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jul 06 18:43:27 2021 +0000

description:
tests/lint: add test for empty __attribute__(())

diffstat:

 tests/usr.bin/xlint/lint1/gcc_attribute.c |  21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 5b56a7f93b3f -r bb58a3fe1a3c tests/usr.bin/xlint/lint1/gcc_attribute.c
--- a/tests/usr.bin/xlint/lint1/gcc_attribute.c Tue Jul 06 18:28:08 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute.c Tue Jul 06 18:43:27 2021 +0000
@@ -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 @@
     __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 */));



Home | Main Index | Thread Index | Old Index