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: demonstrate missing su...
details: https://anonhg.NetBSD.org/src/rev/46a190693407
branches: trunk
changeset: 1027654:46a190693407
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Dec 14 18:26:39 2021 +0000
description:
tests/lint: demonstrate missing support for anonymous members
diffstat:
tests/usr.bin/xlint/lint1/msg_102.c | 28 +++++++++++++++++++++++++---
tests/usr.bin/xlint/lint1/msg_102.exp | 3 ++-
2 files changed, 27 insertions(+), 4 deletions(-)
diffs (43 lines):
diff -r 1cc13841ef01 -r 46a190693407 tests/usr.bin/xlint/lint1/msg_102.c
--- a/tests/usr.bin/xlint/lint1/msg_102.c Tue Dec 14 16:55:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_102.c Tue Dec 14 18:26:39 2021 +0000
@@ -1,7 +1,29 @@
-/* $NetBSD: msg_102.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_102.c,v 1.3 2021/12/14 18:26:39 rillig Exp $ */
# 3 "msg_102.c"
// Test for message: illegal member use: %s [102]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+// Anonymous members are defined in C11 6.7.2.1p2.
+
+struct bit_fields_and_bits {
+ union {
+ struct {
+ unsigned bit_0:1;
+ unsigned bit_1:1;
+ };
+ unsigned bits;
+ };
+};
+
+static inline _Bool
+eq(const struct bit_fields_and_bits *a, const struct bit_fields_and_bits *b)
+{
+ /*
+ * TODO: Once this is fixed, enable lint in
+ * external/mit/xorg/lib/dri.old/Makefile again.
+ */
+ /* TODO: Add support for C11 anonymous struct and union members. */
+ /* expect+2: error: illegal member use: bits [102] */
+ /* expect+1: error: illegal member use: bits [102] */
+ return a->bits == b->bits;
+}
diff -r 1cc13841ef01 -r 46a190693407 tests/usr.bin/xlint/lint1/msg_102.exp
--- a/tests/usr.bin/xlint/lint1/msg_102.exp Tue Dec 14 16:55:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_102.exp Tue Dec 14 18:26:39 2021 +0000
@@ -1,1 +1,2 @@
-msg_102.c(6): error: syntax error ':' [249]
+msg_102.c(28): error: illegal member use: bits [102]
+msg_102.c(28): error: illegal member use: bits [102]
Home |
Main Index |
Thread Index |
Old Index