Module Name: src
Committed By: rillig
Date: Mon Mar 29 22:24:35 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_238.c msg_238.exp
Log Message:
tests/lint: test initialization of union in traditional C
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_238.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_238.exp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/msg_238.c
diff -u src/tests/usr.bin/xlint/lint1/msg_238.c:1.3 src/tests/usr.bin/xlint/lint1/msg_238.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_238.c:1.3 Mon Feb 22 15:09:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_238.c Mon Mar 29 22:24:34 2021
@@ -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] */
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -tw */
+
+struct {
+ int x;
+} s = {
+ 3
+};
+
+union {
+ int x;
+} u = { /* expect: 238 */
+ 3
+};
Index: src/tests/usr.bin/xlint/lint1/msg_238.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_238.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_238.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_238.exp:1.2 Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_238.exp Mon Mar 29 22:24:34 2021
@@ -1 +1 @@
-msg_238.c(6): error: syntax error ':' [249]
+msg_238.c(16): warning: initialization of union is illegal in traditional C [238]