Module Name: src Committed By: rillig Date: Sun Feb 21 13:10:57 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_init.c d_c99_init.exp Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_c99_init.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/d_c99_init.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.4 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.5 --- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.4 Sun Feb 21 12:49:05 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_init.c Sun Feb 21 13:10:57 2021 @@ -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 @@ struct_initialization_via_assignment(any 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); Index: src/tests/usr.bin/xlint/lint1/d_c99_init.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.3 src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.4 --- src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.3 Sun Feb 21 12:49:05 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_init.exp Sun Feb 21 13:10:57 2021 @@ -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]