1 /* $NetBSD: msg_306.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ 2 # 3 "msg_306.c" 3 4 // Test for message: constant truncated by conversion, op '%s' [306] 5 6 /* lint1-extra-flags: -X 351 */ 7 8 unsigned char 9 to_u8(void) 10 { 11 /* expect+1: warning: conversion of 'int' to 'unsigned char' is out of range [119] */ 12 return 12345; 13 } 14 15 unsigned char 16 and_u8(unsigned char a) 17 { 18 /* XXX: unused bits in constant */ 19 return a & 0x1234; 20 } 21 22 unsigned char 23 or_u8(unsigned char a) 24 { 25 /* expect+1: warning: constant truncated by conversion, op '|=' [306] */ 26 a |= 0x1234; 27 28 /* XXX: Lint doesn't care about the expanded form of the same code. */ 29 a = a | 0x1234; 30 31 return a; 32 } 33