1 /* $NetBSD: platform_long.c,v 1.5 2023/03/28 14:44:35 rillig Exp $ */ 2 # 3 "platform_long.c" 3 4 /* 5 * Test features that only apply to platforms on which size_t is unsigned 6 * long and ptr_diff is signed long. 7 */ 8 9 /* lint1-only-if: long */ 10 /* lint1-extra-flags: -c -h -a -p -b -r -z -X 351 */ 11 12 void to_size(typeof(sizeof(int))); 13 14 /* See should_warn_about_prototype_conversion. */ 15 void 16 convert_unsigned_char_to_size(unsigned char uc) 17 { 18 /* 19 * In this function call, uc is first promoted to INT. It is then 20 * converted to size_t, which is ULONG. The portable bit size of INT 21 * is 24 (see INT_RSIZE in inittyp.c), which is less than the 32 of 22 * ULONG. Since the portable bit size increases from 24 to 32, there 23 * is no warning. 24 * 25 * XXX: Investigate whether this rule makes sense. Warning 259 is 26 * about prototype mismatch, not about lossy integer conversions, 27 * and there is a clear mismatch here between INT and LONG, 28 * therefore a warning makes sense. 29 */ 30 to_size(uc); 31 } 32 33 /* expect+1: warning: static variable 'unused_variable' unused [226] */ 34 static int unused_variable; 35