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: test __attribute__ wit...
details: https://anonhg.NetBSD.org/src/rev/eed5a59def34
branches: trunk
changeset: 984849:eed5a59def34
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 25 18:34:44 2021 +0000
description:
tests/lint: test __attribute__ with enum
diffstat:
tests/usr.bin/xlint/lint1/gcc_attribute_enum.c | 51 +++++++++++++++++------
tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp | 6 ++
2 files changed, 44 insertions(+), 13 deletions(-)
diffs (74 lines):
diff -r 3762274a411b -r eed5a59def34 tests/usr.bin/xlint/lint1/gcc_attribute_enum.c
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c Sun Jul 25 18:01:03 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c Sun Jul 25 18:34:44 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcc_attribute_enum.c,v 1.1 2021/07/06 17:33:07 rillig Exp $ */
+/* $NetBSD: gcc_attribute_enum.c,v 1.2 2021/07/25 18:34:44 rillig Exp $ */
# 3 "gcc_attribute_enum.c"
/*
@@ -7,16 +7,41 @@
* https://gcc.gnu.org/onlinedocs/gcc/Enumerator-Attributes.html
*/
-enum Planet {
- Mercury,
- Venus,
- Earth,
- Mars,
- Jupiter,
- Saturn,
- Uranus,
- Neptune,
- /* https://en.wikipedia.org/wiki/Pluto_(planet) */
- /*FIXME*//* expect+1: error: syntax error '__attribute__' [249] */
- Pluto __attribute__((__deprecated__ /* since August 2006 */))
+/*
+ * Attributes in enum-specifier.
+ *
+ * See GCC, c-parser.c, function c_parser_enum_specifier.
+ */
+
+/* expect+1: syntax error '__attribute__' [249] */
+enum __attribute__(()) tag;
+
+/* expect+2: syntax error '__attribute__' [249] */
+/* expect+1: syntax error '{' [249] */
+enum __attribute__(()) tag_with_declaration {
+ TAG_WITH_DECL
+} __attribute__(());
+/* expect-1: syntax error ';' [249] */
+
+/* expect+1: syntax error '{' [249] */
+enum __attribute__(()) {
+ ONLY_DECL
+} __attribute__(());
+/* expect-1: syntax error ';' [249] */
+/* expect-2: error: cannot recover from previous errors [224] */
+
+/*
+ * Attributes in enumerator.
+ *
+ * See GCC, c-parser.c, function c_parser_enum_specifier.
+ */
+
+enum {
+ NO_INIT_FIRST __attribute__(()),
+ NO_INIT__LAST __attribute__(())
};
+
+enum {
+ INIT_FIRST __attribute__(()) = 1,
+ INIT__LAST __attribute__(()) = 2
+};
diff -r 3762274a411b -r eed5a59def34 tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp Sun Jul 25 18:01:03 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp Sun Jul 25 18:34:44 2021 +0000
@@ -1,1 +1,7 @@
+gcc_attribute_enum.c(17): error: syntax error '__attribute__' [249]
gcc_attribute_enum.c(21): error: syntax error '__attribute__' [249]
+gcc_attribute_enum.c(21): error: syntax error '{' [249]
+gcc_attribute_enum.c(23): error: syntax error ';' [249]
+gcc_attribute_enum.c(27): error: syntax error '{' [249]
+gcc_attribute_enum.c(29): error: syntax error ';' [249]
+gcc_attribute_enum.c(29): error: cannot recover from previous errors [224]
Home |
Main Index |
Thread Index |
Old Index