Home | History | Annotate | Line # | Download | only in lint1
msg_363.c revision 1.1
      1  1.1  rillig /*	$NetBSD: msg_363.c,v 1.1 2024/03/01 19:39:28 rillig Exp $	*/
      2  1.1  rillig # 3 "msg_363.c"
      3  1.1  rillig 
      4  1.1  rillig // Test for message: non-printing character '%.*s' in description '%.*s' [363]
      5  1.1  rillig 
      6  1.1  rillig /*
      7  1.1  rillig  * The purpose of snprintb is to produce a printable, visible representation
      8  1.1  rillig  * of a binary number, therefore the description should consist of visible
      9  1.1  rillig  * characters only.
     10  1.1  rillig  */
     11  1.1  rillig 
     12  1.1  rillig /* lint1-extra-flags: -X 351 */
     13  1.1  rillig 
     14  1.1  rillig typedef typeof(sizeof(0)) size_t;
     15  1.1  rillig typedef unsigned long long uint64_t;
     16  1.1  rillig 
     17  1.1  rillig int snprintb(char*, size_t, const char*, uint64_t);
     18  1.1  rillig 
     19  1.1  rillig void
     20  1.1  rillig old_style_description(unsigned u32)
     21  1.1  rillig {
     22  1.1  rillig 	char buf[64];
     23  1.1  rillig 
     24  1.1  rillig 	/* expect+6: warning: bit position '\t' in '\tprint' should be escaped as octal or hex [369] */
     25  1.1  rillig 	/* expect+5: warning: non-printing character '\377' in description 'able\377' [363] */
     26  1.1  rillig 	/* expect+4: warning: bit position '\n' in '\nable\377' should be escaped as octal or hex [369] */
     27  1.1  rillig 	snprintb(buf, sizeof(buf),
     28  1.1  rillig 	    "\020"
     29  1.1  rillig 	    "\001non\tprint\nable\377",
     30  1.1  rillig 	    u32);
     31  1.1  rillig 
     32  1.1  rillig 	/* expect+8: warning: old-style format contains '\0' [362] */
     33  1.1  rillig 	/* expect+7: warning: bit position '\000' (0) in '\000print' out of range 1..32 [371] */
     34  1.1  rillig 	/* expect+6: warning: old-style format contains '\0' [362] */
     35  1.1  rillig 	/* expect+5: warning: bit position '\n' in '\nable' should be escaped as octal or hex [369] */
     36  1.1  rillig 	/* expect+4: warning: empty description in '\0' [367] */
     37  1.1  rillig 	snprintb(buf, sizeof(buf),
     38  1.1  rillig 	    "\020"
     39  1.1  rillig 	    "\001non\000print\nable\0",
     40  1.1  rillig 	    u32);
     41  1.1  rillig }
     42