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: test initializing a st...



details:   https://anonhg.NetBSD.org/src/rev/5d30dc33f13e
branches:  trunk
changeset: 960732:5d30dc33f13e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 27 23:13:48 2021 +0000

description:
tests/lint: test initializing a struct ending with unnamed bit-field

diffstat:

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

diffs (31 lines):

diff -r 0fe901eaa6df -r 5d30dc33f13e tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c    Sat Mar 27 22:53:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c    Sat Mar 27 23:13:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_init.c,v 1.15 2021/03/27 16:13:41 rillig Exp $   */
+/*     $NetBSD: d_c99_init.c,v 1.16 2021/03/27 23:13:48 rillig Exp $   */
 # 3 "d_c99_init.c"
 
 /*
@@ -208,4 +208,13 @@
        .points[0][0][2] = {21, 22 },
 };
 
+struct ends_with_unnamed_bit_field {
+       int member;
+       int : 0;
+} ends_with_unnamed_bit_field = {
+       12345,
+       /* expect+1: too many struct/union initializers */
+       23456,
+};
+
 // See d_struct_init_nested.c for a more complicated example.
diff -r 0fe901eaa6df -r 5d30dc33f13e tests/usr.bin/xlint/lint1/d_c99_init.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_init.exp  Sat Mar 27 22:53:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.exp  Sat Mar 27 23:13:48 2021 +0000
@@ -4,3 +4,4 @@
 d_c99_init.c(65): error: too many array initializers, expected 3 [173]
 d_c99_init.c(130): error: syntax error 'named member must only be used with struct/union' [249]
 d_c99_init.c(142): error: invalid initializer type int [176]
+d_c99_init.c(217): error: too many struct/union initializers [172]



Home | Main Index | Thread Index | Old Index