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