Skip to content

Commit fb1cacd

Browse files
committed
selftests/nolibc: avoid GCC 15 -Wunterminated-string-initialization
On GCC 15 the following warnings is emitted: nolibc-test.c: In function ‘run_stdlib’: nolibc-test.c:1416:32: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (11 chars into 10 available) [-Wunterminated-string-initialization] 1416 | char buf[10] = "test123456"; | ^~~~~~~~~~~~ Increase the size of buf to avoid the warning. It would also be possible to use __attribute__((nonstring)) but that would require some ifdeffery to work with older compilers. Fixes: 1063649 ("selftests/nolibc: Add tests for strlcat() and strlcpy()") Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250623-nolibc-nonstring-v1-1-11282204766a@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
1 parent eb13531 commit fb1cacd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/testing/selftests/nolibc/nolibc-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ int run_stdlib(int min, int max)
14131413
* Add some more chars after the \0, to test functions that overwrite the buffer set
14141414
* the \0 at the exact right position.
14151415
*/
1416-
char buf[10] = "test123456";
1416+
char buf[11] = "test123456";
14171417
buf[4] = '\0';
14181418

14191419

0 commit comments

Comments
 (0)