msg_362.c revision 1.3 1 /* $NetBSD: msg_362.c,v 1.3 2024/03/25 22:37:43 rillig Exp $ */
2 # 3 "msg_362.c"
3
4 // Test for message: conversion '%.*s' should not be escaped [362]
5
6 /*
7 * Since the characters used for the conversion type were chosen to be easily
8 * readable, it doesn't make sense to obfuscate them.
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+9: warning: conversion '\142' should not be escaped [362] */
24 /* expect+8: warning: bit position 'o' in '\142old-style-lsb\0' should be escaped as octal or hex [369] */
25 /* expect+7: warning: bit position 'o' (111) in '\142old-style-lsb\0' out of range 0..63 [371] */
26 /* expect+6: warning: unknown conversion '\001', must be one of 'bfF=:*' [374] */
27 snprintb(buf, sizeof(buf),
28 "\177\020"
29 "\142old-style-lsb\0"
30 "\001old-style-lsb\0"
31 "\142\000old-style-lsb\0",
32 u32);
33 }
34