Rebase.
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-stdint-6.c
blob150666ce6898121cb9d57ad6176e381e435f6161
1 /* Verify that GCC's internal notions of types in <stdint.h> agree
2 with any system <inttypes.h> header. */
3 /* { dg-do compile { target inttypes_types } } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6 #include <inttypes.h>
7 #ifndef SIGNAL_SUPPRESS
8 #include <signal.h>
9 #endif
11 #define CHECK_TYPES(TYPE1, TYPE2) \
12 do { TYPE1 a; TYPE2 *b = &a; TYPE2 c; TYPE1 *d = &c; } while (0)
14 void
15 check_types (void)
17 #ifdef __INT8_TYPE__
18 CHECK_TYPES(__INT8_TYPE__, int8_t);
19 #endif
20 #ifdef __INT16_TYPE__
21 CHECK_TYPES(__INT16_TYPE__, int16_t);
22 #endif
23 #ifdef __INT32_TYPE__
24 CHECK_TYPES(__INT32_TYPE__, int32_t);
25 #endif
26 #ifdef __INT64_TYPE__
27 CHECK_TYPES(__INT64_TYPE__, int64_t);
28 #endif
29 #ifdef __UINT8_TYPE__
30 CHECK_TYPES(__UINT8_TYPE__, uint8_t);
31 #endif
32 #ifdef __UINT16_TYPE__
33 CHECK_TYPES(__UINT16_TYPE__, uint16_t);
34 #endif
35 #ifdef __UINT32_TYPE__
36 CHECK_TYPES(__UINT32_TYPE__, uint32_t);
37 #endif
38 #ifdef __UINT64_TYPE__
39 CHECK_TYPES(__UINT64_TYPE__, uint64_t);
40 #endif
41 #ifndef NO_LEAST_TYPES
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 #endif
51 #ifndef NO_FAST_TYPES
52 CHECK_TYPES(__INT_FAST8_TYPE__, int_fast8_t);
53 CHECK_TYPES(__INT_FAST16_TYPE__, int_fast16_t);
54 CHECK_TYPES(__INT_FAST32_TYPE__, int_fast32_t);
55 CHECK_TYPES(__INT_FAST64_TYPE__, int_fast64_t);
56 CHECK_TYPES(__UINT_FAST8_TYPE__, uint_fast8_t);
57 CHECK_TYPES(__UINT_FAST16_TYPE__, uint_fast16_t);
58 CHECK_TYPES(__UINT_FAST32_TYPE__, uint_fast32_t);
59 CHECK_TYPES(__UINT_FAST64_TYPE__, uint_fast64_t);
60 #endif
61 #ifdef __INTPTR_TYPE__
62 CHECK_TYPES(__INTPTR_TYPE__, intptr_t);
63 #endif
64 #ifdef __UINTPTR_TYPE__
65 CHECK_TYPES(__UINTPTR_TYPE__, uintptr_t);
66 #endif
67 #ifndef NO_MAX_TYPES
68 CHECK_TYPES(__INTMAX_TYPE__, intmax_t);
69 CHECK_TYPES(__UINTMAX_TYPE__, uintmax_t);
70 #endif
71 #ifndef SIGNAL_SUPPRESS
72 CHECK_TYPES(__SIG_ATOMIC_TYPE__, sig_atomic_t);
73 #endif