xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_368.c (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 /*	$NetBSD: msg_368.c,v 1.2 2024/03/25 22:37:43 rillig Exp $	*/
2 # 3 "msg_368.c"
3 
4 // Test for message: missing comparison value after conversion '%.*s' [368]
5 
6 /*
7  * The conversions '=' and ':' require a comparison value as their argument,
8  * followed by the description and the terminating null character.
9  */
10 
11 /* lint1-extra-flags: -X 351 */
12 
13 typedef typeof(sizeof(0)) size_t;
14 typedef unsigned long long uint64_t;
15 
16 int snprintb(char*, size_t, const char*, uint64_t);
17 
18 void
19 example(uint64_t val)
20 {
21 	char buf[64];
22 
23 	/* expect+4: warning: missing comparison value after conversion '=' [368] */
24 	snprintb(buf, sizeof(buf),
25 	    "\177\020"
26 	    "=",
27 	    val);
28 
29 	/* expect+4: warning: missing comparison value after conversion ':' [368] */
30 	snprintb(buf, sizeof(buf),
31 	    "\177\020"
32 	    ":",
33 	    val);
34 }
35