xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_187.c (revision e57698da95564f26d76026eb7e8b17bb588790fb)
1 /*	$NetBSD: msg_187.c,v 1.6 2024/03/27 19:28:20 rillig Exp $	*/
2 # 3 "msg_187.c"
3 
4 // Test for message: string literal too long (%ju) for target array (%ju) [187]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 char auto_msg[] = "the string length is determined automatically";
9 
10 /* The terminating null byte is not copied to the array. */
11 char large_enough[10] = "0123456789";
12 
13 /* expect+1: warning: string literal too long (10) for target array (9) [187] */
14 char too_small[9] = "0123456789";
15 
16 char x0[3] = "x\0";
17 
18 char xx0[3] = "xx\0";
19 
20 /* expect+1: warning: string literal too long (4) for target array (3) [187] */
21 char xxx0[3] = "012\0";
22 
23 /* expect+1: warning: string literal too long (4) for target array (3) [187] */
24 char xx00[3] = "01\0\0";
25