summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/msg_187.c
blob: 16a3e0f262e4e96ba7f409a19b42743a17bc6d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*	$NetBSD: msg_187.c,v 1.5 2023/03/28 14:44:35 rillig Exp $	*/
# 3 "msg_187.c"

// Test for message: string literal too long (%lu) for target array (%lu) [187]

/* lint1-extra-flags: -X 351 */

char auto_msg[] = "the string length is determined automatically";

/* The terminating null byte is not copied to the array. */
char large_enough[10] = "0123456789";

/* expect+1: warning: string literal too long (10) for target array (9) [187] */
char too_small[9] = "0123456789";

char x0[3] = "x\0";

char xx0[3] = "xx\0";

/* expect+1: warning: string literal too long (4) for target array (3) [187] */
char xxx0[3] = "012\0";

/* expect+1: warning: string literal too long (4) for target array (3) [187] */
char xx00[3] = "01\0\0";