xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_164.c (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1 /*	$NetBSD: msg_164.c,v 1.6 2023/07/07 19:45:22 rillig Exp $	*/
2 # 3 "msg_164.c"
3 
4 // Test for message: assignment of negative constant to unsigned type [164]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 void
9 example(void)
10 {
11 	/* expect+1: warning: initialization of unsigned with negative constant [221] */
12 	unsigned char uch = -3;
13 
14 	/* expect+1: warning: assignment of negative constant to unsigned type [164] */
15 	uch = -5;
16 	/* expect+1: warning: conversion of negative constant to unsigned type [222] */
17 	uch += -7;
18 	/* expect+1: warning: conversion of negative constant to unsigned type [222] */
19 	uch *= -1;
20 }
21