1 /* $NetBSD: msg_363.c,v 1.4 2024/03/03 16:09:01 rillig Exp $ */ 2 # 3 "msg_363.c" 3 4 // Test for message: non-printing character '%.*s' in description '%.*s' [363] 5 6 /* 7 * The purpose of snprintb is to produce a printable, visible representation 8 * of a binary number, therefore the description should consist of visible 9 * characters only. 10 */ 11 12 /* lint1-extra-flags: -X 351 */ 13 14 typedef typeof(sizeof(0)) size_t; 15 typedef unsigned long long uint64_t; 16 17 int snprintb(char*, size_t, const char*, uint64_t); 18 19 void 20 old_style_description(unsigned u32) 21 { 22 char buf[64]; 23 24 /* expect+6: warning: bit position '\t' in '\tprint' should be escaped as octal or hex [369] */ 25 /* expect+5: warning: non-printing character '\377' in description 'able\377' [363] */ 26 /* expect+4: warning: bit position '\n' in '\nable\377' should be escaped as octal or hex [369] */ 27 snprintb(buf, sizeof(buf), 28 "\020" 29 "\001non\tprint\nable\377", 30 u32); 31 32 /* expect+10: warning: non-printing character '\177' in description '\177' [363] */ 33 /* expect+9: warning: non-printing character '\177' in description 'aa""""\177' [363] */ 34 /* expect+8: warning: non-printing character '\177' in description 'bb""\177' [363] */ 35 /* expect+7: warning: non-printing character '\177' in description 'cc\177' [363] */ 36 snprintb(buf, sizeof(buf), 37 "\020" 38 "\002""\177" 39 "\003aa""""\177" 40 "\004""bb""\177" 41 "\005""""cc\177", 42 u32); 43 44 /* expect+6: warning: bit position '\000' (0) in '\000print' out of range 1..32 [371] */ 45 /* expect+5: warning: bit position '\n' in '\nable' should be escaped as octal or hex [369] */ 46 /* expect+4: warning: redundant '\0' at the end of the format [377] */ 47 snprintb(buf, sizeof(buf), 48 "\020" 49 "\001non\000print\nable\0", 50 u32); 51 } 52