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