expr_promote_trad.c revision 1.1
1/*	$NetBSD: expr_promote_trad.c,v 1.1 2021/08/16 20:11:03 rillig Exp $	*/
2# 3 "expr_promote_trad.c"
3
4/*
5 * Test arithmetic promotions in traditional C.
6 */
7
8/* lint1-flags: -tw */
9
10sink();
11
12struct arithmetic_types {
13	/* _Bool is not available in traditional C */
14	char plain_char;
15	/* signed char is not available in traditional C */
16	unsigned char unsigned_char;
17	short signed_short;
18	unsigned short unsigned_short;
19	int signed_int;
20	unsigned int unsigned_int;
21	long signed_long;
22	unsigned long unsigned_long;
23	/* (unsigned) long long is not available in traditional C */
24	/* __int128_t is not available in traditional C */
25	/* __uint128_t is not available in traditional C */
26	float single_floating;
27	double double_floating;
28	/* long double is not available in traditional C */
29	/* _Complex is not available in traditional C */
30};
31
32caller(arg)
33	struct arithmetic_types *arg;
34{
35	sink("",
36	    arg->plain_char,		/* gets promoted to 'int' */
37	    arg->unsigned_char,		/* gets promoted to 'unsigned int' */
38	    arg->signed_short,		/* gets promoted to 'int' */
39	    arg->unsigned_short,	/* gets promoted to 'unsigned int' */
40	    arg->signed_int,
41	    arg->unsigned_int,
42	    arg->signed_long,
43	    arg->unsigned_long,
44	    arg->single_floating,	/* gets promoted to 'double' */
45	    arg->double_floating);
46}
47