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 lint: add test for initializing a ...
details: https://anonhg.NetBSD.org/src/rev/bd33e84edadf
branches: trunk
changeset: 952927:bd33e84edadf
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 21 13:10:57 2021 +0000
description:
lint: add test for initializing a character array using a string
The previous attempt took another code path than expected. The
initialization of static_duration actually calls initstack_string.
diffstat:
tests/usr.bin/xlint/lint1/d_c99_init.c | 8 ++++++--
tests/usr.bin/xlint/lint1/d_c99_init.exp | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r f7829a30584e -r bd33e84edadf tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c Sun Feb 21 12:49:05 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c Sun Feb 21 13:10:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_init.c,v 1.4 2021/02/21 12:49:05 rillig Exp $ */
+/* $NetBSD: d_c99_init.c,v 1.5 2021/02/21 13:10:57 rillig Exp $ */
# 3 "d_c99_init.c"
/*
@@ -31,9 +31,13 @@
use(&local);
}
+
// See init_using_expr, initstack_string.
+char static_duration[] = "static duration";
+
+// See init_using_expr.
void
-initialization_by_string(void)
+initialization_by_braced_string(void)
{
any local = { "hello" };
use(&local);
diff -r f7829a30584e -r bd33e84edadf tests/usr.bin/xlint/lint1/d_c99_init.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_init.exp Sun Feb 21 12:49:05 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.exp Sun Feb 21 13:10:57 2021 +0000
@@ -1,3 +1,3 @@
d_c99_init.c(22): invalid initializer type int [176]
d_c99_init.c(23): too many initializers [174]
-d_c99_init.c(45): initialisation type mismatch (pointer to const void) and (struct any) [185]
+d_c99_init.c(49): initialisation type mismatch (pointer to const void) and (struct any) [185]
Home |
Main Index |
Thread Index |
Old Index