Home | History | Annotate | Line # | Download | only in lint1
msg_222.c revision 1.4
      1 /*	$NetBSD: msg_222.c,v 1.4 2022/06/22 19:23:18 rillig Exp $	*/
      2 # 3 "msg_222.c"
      3 
      4 // Test for message: conversion of negative constant to unsigned type [222]
      5 
      6 /* expect+1: warning: initialization of unsigned with negative constant [221] */
      7 unsigned int global = -1;
      8 
      9 void take_unsigned_int(unsigned int);
     10 
     11 void
     12 function(void)
     13 {
     14 	/* expect+1: warning: initialization of unsigned with negative constant [221] */
     15 	unsigned int local = -1;
     16 
     17 	/* expect+1: warning: conversion of negative constant to unsigned type, arg #1 [296] */
     18 	take_unsigned_int(-1);
     19 
     20 	if (local & -1)
     21 		return;
     22 
     23 	/* expect+1: warning: operator '<' compares 'unsigned int' with 'negative constant' [162] */
     24 	if (local < -1)
     25 		return;
     26 
     27 	local &= -1;
     28 
     29 	/* expect+1: warning: conversion of negative constant to unsigned type [222] */
     30 	local += -1;
     31 }
     32