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