Module Name: src
Committed By: rillig
Date: Mon Mar 29 17:13:07 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c
Log Message:
tests/lint: add examples for initialization from C99
These all pass lint without any warnings. Both Clang and GCC warn about
these in -Wall mode, so they are unlikely to be seen in practice.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/d_c99_init.c
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/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.19 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.20
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.19 Sun Mar 28 19:53:58 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c Mon Mar 29 17:13:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_init.c,v 1.19 2021/03/28 19:53:58 rillig Exp $ */
+/* $NetBSD: d_c99_init.c,v 1.20 2021/03/29 17:13:07 rillig Exp $ */
# 3 "d_c99_init.c"
/*
@@ -264,3 +264,45 @@ struct ten ten = {
// 5,
// 6,
};
+
+int c99_6_7_8_p26_example3[4][3] = {
+ { 1, 3, 5 },
+ { 2, 4, 6 },
+ { 3, 5, 7 },
+};
+
+int c99_6_7_8_p27_example4[4][3] = {
+ { 1 }, { 2 }, { 3 }, { 4 }
+};
+
+struct {
+ int a[3], b;
+} c99_6_7_8_p28_example5[] = {
+ { 1 },
+ 2,
+};
+
+short c99_6_7_8_p29_example6a[4][3][2] = {
+ { 1 },
+ { 2, 3 },
+ { 4, 5, 6 },
+};
+
+short c99_6_7_8_p29_example6b[4][3][2] = {
+ 1, 0, 0, 0, 0, 0,
+ 2, 3, 0, 0, 0, 0,
+ 4, 5, 6, 0, 0, 0,
+};
+
+short c99_6_7_8_p29_example6c[4][3][2] = {
+ {
+ { 1 },
+ },
+ {
+ { 2, 3 },
+ },
+ {
+ { 4, 5 },
+ { 6 },
+ }
+};