Home | History | Annotate | Line # | Download | only in lint1
msg_230.c revision 1.2
      1 /*	$NetBSD: msg_230.c,v 1.2 2021/01/03 15:35:01 rillig Exp $	*/
      2 # 3 "msg_230.c"
      3 
      4 // Test for message: nonportable character comparison, op %s [230]
      5 
      6 /* lint1-flags: -S -g -p -w */
      7 
      8 void example(char c, unsigned char uc, signed char sc)
      9 {
     10 	if (c < 0)
     11 		if (uc < 0)
     12 			if (sc < 0)
     13 				return;
     14 
     15 	/*
     16 	 * XXX: The comparison "<= -1" looks very similar to "< 0",
     17 	 * nevertheless "< 0" does not generate a warning.
     18 	 *
     19 	 * The comparisons may actually differ subtly because of the usual
     20 	 * arithmetic promotions.
     21 	 * */
     22 	if (c <= -1)
     23 		if (uc <= -1)
     24 			if (sc <= -1)
     25 				return;
     26 }
     27