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/54640472a1d7
branches:  trunk
changeset: 954128:54640472a1d7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Mar 29 22:24:34 2021 +0000

description:
tests/lint: test initialization of union in traditional C

diffstat:

 tests/usr.bin/xlint/lint1/msg_238.c   |  19 +++++++++++++++----
 tests/usr.bin/xlint/lint1/msg_238.exp |   2 +-
 2 files changed, 16 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 311ebc6748be -r 54640472a1d7 tests/usr.bin/xlint/lint1/msg_238.c
--- a/tests/usr.bin/xlint/lint1/msg_238.c       Mon Mar 29 22:07:00 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_238.c       Mon Mar 29 22:24:34 2021 +0000
@@ -1,7 +1,18 @@
-/*     $NetBSD: msg_238.c,v 1.3 2021/02/22 15:09:50 rillig Exp $       */
+/*     $NetBSD: msg_238.c,v 1.4 2021/03/29 22:24:34 rillig Exp $       */
 # 3 "msg_238.c"
 
-// Test for message: initialization of union is illegal in traditional C [238]
+/* Test for message: initialization of union is illegal in traditional C [238] */
+
+/* lint1-flags: -tw */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+struct {
+       int x;
+} s = {
+       3
+};
+
+union {
+       int x;
+} u = {                                /* expect: 238 */
+       3
+};
diff -r 311ebc6748be -r 54640472a1d7 tests/usr.bin/xlint/lint1/msg_238.exp
--- a/tests/usr.bin/xlint/lint1/msg_238.exp     Mon Mar 29 22:07:00 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_238.exp     Mon Mar 29 22:24:34 2021 +0000
@@ -1,1 +1,1 @@
-msg_238.c(6): error: syntax error ':' [249]
+msg_238.c(16): warning: initialization of union is illegal in traditional C [238]



Home | Main Index | Thread Index | Old Index