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: extend test for nested...



details:   https://anonhg.NetBSD.org/src/rev/ddd6ee9f5e6a
branches:  trunk
changeset: 1029114:ddd6ee9f5e6a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 21 23:12:21 2021 +0000

description:
tests/lint: extend test for nested initializations

diffstat:

 tests/usr.bin/xlint/lint1/msg_171.c |  25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 6e8ae674676f -r ddd6ee9f5e6a tests/usr.bin/xlint/lint1/msg_171.c
--- a/tests/usr.bin/xlint/lint1/msg_171.c       Tue Dec 21 22:53:21 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_171.c       Tue Dec 21 23:12:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_171.c,v 1.6 2021/03/23 18:40:50 rillig Exp $       */
+/*     $NetBSD: msg_171.c,v 1.7 2021/12/21 23:12:21 rillig Exp $       */
 # 3 "msg_171.c"
 
 // Test for message: cannot assign to '%s' from '%s' [171]
@@ -37,6 +37,27 @@
                int y;
        };
        struct point *p = &(struct point){
-           12, 5,
+               12, 5,
+       };
+
+       /*
+        * A sizeof expression is another way to create nested
+        * initializations.
+        */
+       struct point p2 = {
+               (int)sizeof(struct point){
+                       (int)sizeof(struct point){
+                               (int)sizeof(struct point){
+                                       (int)sizeof(struct point){
+                                               0,
+                                               0,
+                                       },
+                                       0,
+                               },
+                               0,
+                       },
+                       0,
+               },
+               0,
        };
 }



Home | Main Index | Thread Index | Old Index