xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_359.c (revision 32d1c65c71fbdb65a012e8392a62a757dd6853e9)
1 /*	$NetBSD: msg_359.c,v 1.3 2024/11/05 06:23:04 rillig Exp $	*/
2 # 3 "msg_359.c"
3 
4 // Test for message: missing new-style '\177' or old-style number base [359]
5 
6 /*
7  * The first or second character of the snprintb format specifies the number
8  * base.  It must be an octal or hexadecimal escape sequence, as the characters
9  * 2, 10 and 16 are not printable, and writing '\n' instead of '\x0a' would be
10  * misleading.
11  */
12 
13 /* lint1-extra-flags: -X 351 */
14 
15 typedef typeof(sizeof(0)) size_t;
16 typedef unsigned long long uint64_t;
17 
18 int snprintb(char *, size_t, const char *, uint64_t);
19 
20 void
21 old_style_number_base(void)
22 {
23 	char buf[64];
24 
25 	/* expect+1: warning: missing new-style '\177' or old-style number base [359] */
26 	snprintb(buf, sizeof(buf), "", 0);
27 	snprintb(buf, sizeof(buf), "\010", 0);
28 	snprintb(buf, sizeof(buf), "" "\177\020" "", 0);
29 }
30