Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: msg_368.c,v 1.3 2024/08/31 06:57:31 rillig Exp $	*/
      2 # 3 "msg_368.c"
      3 
      4 // Test for message: missing comparison value after conversion '%.*s' [368]
      5 
      6 /*
      7  * The conversions '=' and ':' require a comparison value as their argument,
      8  * followed by the description and the terminating null character.
      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(uint64_t val)
     20 {
     21 	char buf[64];
     22 
     23 	/* expect+4: warning: missing comparison value after conversion '=' [368] */
     24 	snprintb(buf, sizeof(buf),
     25 	    "\177\020"
     26 	    "=",
     27 	    val);
     28 
     29 	/* expect+4: warning: missing comparison value after conversion ':' [368] */
     30 	snprintb(buf, sizeof(buf),
     31 	    "\177\020"
     32 	    ":",
     33 	    val);
     34 }
     35