tcc -MD: drop system includes and duplicates
[tinycc.git] / tests / tests2 / 93_integer_promotion.c
bloba1176fc6bdcd719c99fddf7253e2c85ee7904091
1 /* integer promotion */
3 int printf(const char*, ...);
4 #define promote(s) printf(" %ssigned : %s\n", (s) - 100 < 0 ? " " : "un", #s);
6 int main (void)
8 struct {
9 unsigned ub:3;
10 unsigned u:32;
11 unsigned long long ullb:35;
12 unsigned long long ull:64;
13 unsigned char c;
14 } s = { 1, 1, 1 };
16 promote(s.ub);
17 promote(s.u);
18 promote(s.ullb);
19 promote(s.ull);
20 promote(s.c);
21 printf("\n");
23 promote((1 ? s.ub : 1));
24 promote((1 ? s.u : 1));
25 promote((1 ? s.ullb : 1));
26 promote((1 ? s.ull : 1));
27 promote((1 ? s.c : 1));
28 printf("\n");
30 promote(s.ub << 1);
31 promote(s.u << 1);
32 promote(s.ullb << 1);
33 promote(s.ull << 1);
34 promote(s.c << 1);
35 printf("\n");
37 promote(+s.ub);
38 promote(+s.u);
39 promote(+s.ullb);
40 promote(+s.ull);
41 promote(+s.c);
42 printf("\n");
44 promote(-s.ub);
45 promote(-s.u);
46 promote(-s.ullb);
47 promote(-s.ull);
48 promote(-s.c);
49 printf("\n");
51 promote(~s.ub);
52 promote(~s.u);
53 promote(~s.ullb);
54 promote(~s.ull);
55 promote(~s.c);
56 printf("\n");
58 promote(!s.ub);
59 promote(!s.u);
60 promote(!s.ullb);
61 promote(!s.ull);
62 promote(!s.c);
63 printf("\n");
65 promote(+(unsigned)s.ub);
66 promote(-(unsigned)s.ub);
67 promote(~(unsigned)s.ub);
68 promote(!(unsigned)s.ub);
70 return 0;