platform_lp64.c revision 1.7
1/* $NetBSD: platform_lp64.c,v 1.7 2023/07/08 12:45:43 rillig Exp $ */ 2# 3 "platform_lp64.c" 3 4/* 5 * Test features that only apply to platforms that have 32-bit int and 64-bit 6 * long and pointer types. 7 */ 8 9/* lint1-only-if: lp64 */ 10/* lint1-extra-flags: -c -h -a -p -b -r -z -X 351 */ 11 12int s32; 13unsigned int u32; 14long sl32; 15unsigned long ul32; 16__int128_t s128; 17__uint128_t u128; 18 19void 20convert_between_int_and_long(void) 21{ 22 /* expect+1: warning: conversion from 'long' to 'int' may lose accuracy [132] */ 23 s32 = sl32; 24 sl32 = s32; 25 /* expect+1: warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy [132] */ 26 u32 = ul32; 27 ul32 = u32; 28} 29 30void to_size_t(typeof(sizeof(int))); 31 32void 33convert_unsigned_char_to_size_t(unsigned char uc) 34{ 35 /* no warning, unlike platform_int */ 36 to_size_t(uc); 37} 38 39void 40convert_128(void) 41{ 42 /* expect+1: warning: conversion from '__int128_t' to 'int' may lose accuracy [132] */ 43 s32 = s128; 44 /* expect+1: warning: conversion from '__uint128_t' to 'unsigned int' may lose accuracy [132] */ 45 u32 = u128; 46} 47