msg_364.c revision 1.2 1 /* $NetBSD: msg_364.c,v 1.2 2024/03/03 10:27:18 rillig Exp $ */
2 # 3 "msg_364.c"
3
4 // Test for message: missing bit position after '%.*s' [364]
5
6 /*
7 * The directives 'b', 'f' and 'F' require a bit position as their first
8 * argument.
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(unsigned u32)
20 {
21 char buf[64];
22
23 /* expect+4: warning: missing bit position after 'b' [364] */
24 snprintb(buf, sizeof(buf),
25 "\177\020"
26 "b",
27 u32);
28
29 /* expect+5: warning: empty description in 'b\007' [367] */
30 /* expect+4: warning: missing '\0' at the end of 'b\007' [366] */
31 snprintb(buf, sizeof(buf),
32 "\177\020"
33 "b\007",
34 u32);
35 }
36