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