gcc/
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-stdint-5.c
blob9c224edc1cbc4893f127b6ca74902cb6d1161fad
1 /* Verify that GCC's internal notions of types in <stdint.h> agree
2 with any system header (which GCC will use by default for hosted
3 compilations). */
4 /* { dg-do compile } */
5 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
7 #include <stdint.h>
8 #ifndef SIGNAL_SUPPRESS
9 #include <signal.h>
10 #endif
12 #define CHECK_TYPES(TYPE1, TYPE2) \
13 do { TYPE1 a; TYPE2 *b = &a; TYPE2 c; TYPE1 *d = &c; } while (0)
15 void
16 check_types (void)
18 #ifdef __INT8_TYPE__
19 CHECK_TYPES(__INT8_TYPE__, int8_t);
20 #endif
21 #ifdef __INT16_TYPE__
22 CHECK_TYPES(__INT16_TYPE__, int16_t);
23 #endif
24 #ifdef __INT32_TYPE__
25 CHECK_TYPES(__INT32_TYPE__, int32_t);
26 #endif
27 #ifdef __INT64_TYPE__
28 CHECK_TYPES(__INT64_TYPE__, int64_t);
29 #endif
30 #ifdef __UINT8_TYPE__
31 CHECK_TYPES(__UINT8_TYPE__, uint8_t);
32 #endif
33 #ifdef __UINT16_TYPE__
34 CHECK_TYPES(__UINT16_TYPE__, uint16_t);
35 #endif
36 #ifdef __UINT32_TYPE__
37 CHECK_TYPES(__UINT32_TYPE__, uint32_t);
38 #endif
39 #ifdef __UINT64_TYPE__
40 CHECK_TYPES(__UINT64_TYPE__, uint64_t);
41 #endif
42 CHECK_TYPES(__INT_LEAST8_TYPE__, int_least8_t);
43 CHECK_TYPES(__INT_LEAST16_TYPE__, int_least16_t);
44 CHECK_TYPES(__INT_LEAST32_TYPE__, int_least32_t);
45 CHECK_TYPES(__INT_LEAST64_TYPE__, int_least64_t);
46 CHECK_TYPES(__UINT_LEAST8_TYPE__, uint_least8_t);
47 CHECK_TYPES(__UINT_LEAST16_TYPE__, uint_least16_t);
48 CHECK_TYPES(__UINT_LEAST32_TYPE__, uint_least32_t);
49 CHECK_TYPES(__UINT_LEAST64_TYPE__, uint_least64_t);
50 CHECK_TYPES(__INT_FAST8_TYPE__, int_fast8_t);
51 CHECK_TYPES(__INT_FAST16_TYPE__, int_fast16_t);
52 CHECK_TYPES(__INT_FAST32_TYPE__, int_fast32_t);
53 CHECK_TYPES(__INT_FAST64_TYPE__, int_fast64_t);
54 CHECK_TYPES(__UINT_FAST8_TYPE__, uint_fast8_t);
55 CHECK_TYPES(__UINT_FAST16_TYPE__, uint_fast16_t);
56 CHECK_TYPES(__UINT_FAST32_TYPE__, uint_fast32_t);
57 CHECK_TYPES(__UINT_FAST64_TYPE__, uint_fast64_t);
58 #ifdef __INTPTR_TYPE__
59 CHECK_TYPES(__INTPTR_TYPE__, intptr_t);
60 #endif
61 #ifdef __UINTPTR_TYPE__
62 CHECK_TYPES(__UINTPTR_TYPE__, uintptr_t);
63 #endif
64 CHECK_TYPES(__INTMAX_TYPE__, intmax_t);
65 CHECK_TYPES(__UINTMAX_TYPE__, uintmax_t);
66 #ifndef SIGNAL_SUPPRESS
67 CHECK_TYPES(__SIG_ATOMIC_TYPE__, sig_atomic_t);
68 #endif