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 initialization of...
details: https://anonhg.NetBSD.org/src/rev/d7d0f37ee8ef
branches: trunk
changeset: 1029108:d7d0f37ee8ef
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Dec 21 21:16:08 2021 +0000
description:
tests/lint: test initialization of incomplete union
The function initialization_lbrace only mentions STRUCT, which looks
suspicious.
diffstat:
tests/usr.bin/xlint/lint1/init.c | 18 +++++++++++++++++-
tests/usr.bin/xlint/lint1/init.exp | 4 ++++
2 files changed, 21 insertions(+), 1 deletions(-)
diffs (38 lines):
diff -r 179582e3551b -r d7d0f37ee8ef tests/usr.bin/xlint/lint1/init.c
--- a/tests/usr.bin/xlint/lint1/init.c Tue Dec 21 21:04:08 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/init.c Tue Dec 21 21:16:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.7 2021/12/17 11:06:15 rillig Exp $ */
+/* $NetBSD: init.c,v 1.8 2021/12/21 21:16:08 rillig Exp $ */
# 3 "init.c"
/*
@@ -72,3 +72,19 @@
do_nothing,
do_nothing,
};
+
+union incomplete_union u1 = {
+ /* expect+1: error: too many struct/union initializers [172] */
+ 1,
+/* expect+1: error: 'u1' has incomplete type 'incomplete union incomplete_union' [31] */
+};
+
+union incomplete_union u2 = {
+ /* expect+1: error: type 'incomplete union incomplete_union' does not have member 'member' [101] */
+ .member = 1,
+/* expect+1: error: 'u2' has incomplete type 'incomplete union incomplete_union' [31] */
+};
+
+union incomplete_union {
+ int num;
+};
diff -r 179582e3551b -r d7d0f37ee8ef tests/usr.bin/xlint/lint1/init.exp
--- a/tests/usr.bin/xlint/lint1/init.exp Tue Dec 21 21:04:08 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/init.exp Tue Dec 21 21:16:08 2021 +0000
@@ -1,1 +1,5 @@
init.c(16): error: empty array declaration: empty_array_with_initializer [190]
+init.c(78): error: too many struct/union initializers [172]
+init.c(80): error: 'u1' has incomplete type 'incomplete union incomplete_union' [31]
+init.c(84): error: type 'incomplete union incomplete_union' does not have member 'member' [101]
+init.c(86): error: 'u2' has incomplete type 'incomplete union incomplete_union' [31]
Home |
Main Index |
Thread Index |
Old Index