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 'scalar type cann...



details:   https://anonhg.NetBSD.org/src/rev/33e3f114d811
branches:  trunk
changeset: 954169:33e3f114d811
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Mar 30 19:45:04 2021 +0000

description:
tests/lint: test 'scalar type cannot use designator'

diffstat:

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

diffs (32 lines):

diff -r 8192a1164477 -r 33e3f114d811 tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c    Tue Mar 30 16:09:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c    Tue Mar 30 19:45:04 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_init.c,v 1.28 2021/03/30 16:09:30 rillig Exp $   */
+/*     $NetBSD: d_c99_init.c,v 1.29 2021/03/30 19:45:04 rillig Exp $   */
 # 3 "d_c99_init.c"
 
 /*
@@ -376,3 +376,12 @@
 } union_with_only_unnamed_members = {  /* expect: has no named members */
        123,            /* expect: too many struct/union initializers */
 };
+
+int designator_for_scalar = {
+       .value = 3,             /* expect: scalar type cannot use designator */
+};
+
+struct point designator_for_scalar_in_struct = {
+       { .x = 3 },             /* expect: scalar type cannot use designator */
+       { [1] = 4 },            /* expect: scalar type cannot use designator */
+};
diff -r 8192a1164477 -r 33e3f114d811 tests/usr.bin/xlint/lint1/d_c99_init.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_init.exp  Tue Mar 30 16:09:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.exp  Tue Mar 30 19:45:04 2021 +0000
@@ -22,3 +22,6 @@
 d_c99_init.c(371): error: too many struct/union initializers [172]
 d_c99_init.c(376): warning: union has no named members [65]
 d_c99_init.c(377): error: too many struct/union initializers [172]
+d_c99_init.c(381): error: syntax error 'scalar type cannot use designator' [249]
+d_c99_init.c(385): error: syntax error 'scalar type cannot use designator' [249]
+d_c99_init.c(386): error: syntax error 'scalar type cannot use designator' [249]



Home | Main Index | Thread Index | Old Index