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: add examples for initi...



details:   https://anonhg.NetBSD.org/src/rev/8b270959b13f
branches:  trunk
changeset: 982041:8b270959b13f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Mar 29 17:13:07 2021 +0000

description:
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.

diffstat:

 tests/usr.bin/xlint/lint1/d_c99_init.c |  44 +++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diffs (55 lines):

diff -r ace9bc1152d0 -r 8b270959b13f tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c    Mon Mar 29 15:31:46 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c    Mon Mar 29 17:13:07 2021 +0000
@@ -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 @@
        // 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 },
+       }
+};



Home | Main Index | Thread Index | Old Index