Module Name:    src
Committed By:   rillig
Date:           Sun Mar 28 15:12:20 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_188.c msg_188.exp

Log Message:
tests/lint: add test for struct initialization in traditional C


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_188.c \
    src/tests/usr.bin/xlint/lint1/msg_188.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_188.c
diff -u src/tests/usr.bin/xlint/lint1/msg_188.c:1.2 src/tests/usr.bin/xlint/lint1/msg_188.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_188.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_188.c	Sun Mar 28 15:12:20 2021
@@ -1,7 +1,25 @@
-/*	$NetBSD: msg_188.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_188.c,v 1.3 2021/03/28 15:12:20 rillig Exp $	*/
 # 3 "msg_188.c"
 
-// Test for message: no automatic aggregate initialization in traditional C [188]
+/* Test for message: no automatic aggregate initialization in traditional C [188] */
 
-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 point {
+	int x;
+	int y;
+};
+
+struct point global = {
+	3,
+	4,
+};
+
+void
+function()
+{
+	struct point local = {	/* expect: 188 */
+		3,
+		4,
+	};
+}
Index: src/tests/usr.bin/xlint/lint1/msg_188.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_188.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_188.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_188.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_188.exp	Sun Mar 28 15:12:20 2021
@@ -1 +1,8 @@
-msg_188.c(6): error: syntax error ':' [249]
+(1): warning: 'long double' is illegal in traditional C [266]
+(1): warning: function prototypes are illegal in traditional C [270]
+(2): warning: 'long double' is illegal in traditional C [266]
+(2): warning: function prototypes are illegal in traditional C [270]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: function prototypes are illegal in traditional C [270]
+msg_188.c(21): warning: no automatic aggregate initialization in traditional C [188]

Reply via email to