xref: /netbsd-src/tests/usr.bin/xlint/lint1/platform_ilp32.c (revision 98412b5015f4d494913d9440a5ebd2476000e119)
1 /*	$NetBSD: platform_ilp32.c,v 1.6 2024/06/08 06:37:06 rillig Exp $	*/
2 # 3 "platform_ilp32.c"
3 
4 /*
5  * Test features that only apply to platforms that have 32-bit int, long and
6  * pointer types.
7  *
8  * See also:
9  *	platform_ilp32_int.c
10  *	platform_ilp32_long.c
11  */
12 
13 /* lint1-extra-flags: -c -h -a -p -b -r -z -X 351 */
14 /* lint1-only-if: ilp32 */
15 
16 void
switch_s64(long long x)17 switch_s64(long long x)
18 {
19 	switch (x) {
20 	case 0x222200000001:
21 	case 0x333300000001:
22 	/* expect+1: error: duplicate case '37529424232449' in switch [199] */
23 	case 0x222200000001:
24 	case -0x7fffffffffffffff:
25 	/* expect+1: error: duplicate case '-9223372036854775807' in switch [199] */
26 	case -0x7fffffffffffffff:
27 		break;
28 	}
29 }
30 
31 void
switch_u64(unsigned long long x)32 switch_u64(unsigned long long x)
33 {
34 	switch (x) {
35 	case 0x222200000001:
36 	case 0x333300000001:
37 	/* expect+1: error: duplicate case '37529424232449' in switch [200] */
38 	case 0x222200000001:
39 	/* expect+1: warning: conversion of negative constant -9223372036854775807 to unsigned type 'unsigned long long' [222] */
40 	case -0x7fffffffffffffff:
41 	/* expect+2: warning: conversion of negative constant -9223372036854775807 to unsigned type 'unsigned long long' [222] */
42 	/* expect+1: error: duplicate case '9223372036854775809' in switch [200] */
43 	case -0x7fffffffffffffff:
44 		break;
45 	}
46 }
47