xref: /netbsd-src/tests/usr.bin/xlint/lint1/platform_lp64.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: platform_lp64.c,v 1.4 2023/02/22 22:12:35 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-extra-flags: -c -h -a -p -b -r -z */
10 /* lint1-only-if: lp64 */
11 
12 int s32;
13 unsigned int u32;
14 long sl32;
15 unsigned long ul32;
16 
17 void
18 convert_between_int_and_long(void)
19 {
20 	/* expect+1: warning: conversion from 'long' to 'int' may lose accuracy [132] */
21 	s32 = sl32;
22 	sl32 = s32;
23 	/* expect+1: warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy [132] */
24 	u32 = ul32;
25 	ul32 = u32;
26 }
27 
28 void to_size_t(typeof(sizeof(int)));
29 
30 void
31 convert_unsigned_char_to_size_t(unsigned char uc)
32 {
33 	/* no warning, unlike platform_int */
34 	to_size_t(uc);
35 }
36