xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_360.c (revision ce2046810387440872bfc20878728c18e4f27f6c)
1*ce204681Srillig /*	$NetBSD: msg_360.c,v 1.4 2024/11/05 06:23:04 rillig Exp $	*/
238c0bdf2Srillig # 3 "msg_360.c"
338c0bdf2Srillig 
438c0bdf2Srillig // Test for message: missing new-style number base after '\177' [360]
538c0bdf2Srillig 
638c0bdf2Srillig /*
738c0bdf2Srillig  * The new-style format requires the number base as the second character.
8*ce204681Srillig  * This check is merely a byproduct of the implementation, it provides little
9*ce204681Srillig  * value of its own.
1038c0bdf2Srillig  */
1138c0bdf2Srillig 
1238c0bdf2Srillig /* lint1-extra-flags: -X 351 */
1338c0bdf2Srillig 
1438c0bdf2Srillig typedef typeof(sizeof(0)) size_t;
1538c0bdf2Srillig typedef unsigned long long uint64_t;
1638c0bdf2Srillig 
1738c0bdf2Srillig int snprintb(char *, size_t, const char *, uint64_t);
1838c0bdf2Srillig 
1938c0bdf2Srillig void
2038c0bdf2Srillig new_style_number_base(void)
2138c0bdf2Srillig {
2238c0bdf2Srillig 	char buf[64];
2338c0bdf2Srillig 
2438c0bdf2Srillig 	/* expect+1: warning: missing new-style number base after '\177' [360] */
2538c0bdf2Srillig 	snprintb(buf, sizeof(buf), "\177", 0);
26c9de07fbSrillig 	/* expect+1: warning: number base '\002' is 2, must be 8, 10 or 16 [361] */
2738c0bdf2Srillig 	snprintb(buf, sizeof(buf), "\177\002", 0);
2838c0bdf2Srillig }
29