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