OSDN Git Service

2012-01-30 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / c99-stdint-6.c
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" } */
5 /* { dg-options "-std=gnu99 -pedantic-errors -DNO_FAST_TYPES" { target *-*-solaris2.[89]* } } */
6 /* { dg-options "-std=gnu99 -pedantic-errors -DNO_LEAST_TYPES -DNO_FAST_TYPES -DNO_MAX_TYPES" { target alpha*-dec-osf5* } } */
7
8 #include <inttypes.h>
9 #ifndef SIGNAL_SUPPRESS
10 #include <signal.h>
11 #endif
12
13 #define CHECK_TYPES(TYPE1, TYPE2) \
14   do { TYPE1 a; TYPE2 *b = &a; TYPE2 c; TYPE1 *d = &c; } while (0)
15
16 void
17 check_types (void)
18 {
19 #ifdef __INT8_TYPE__
20   CHECK_TYPES(__INT8_TYPE__, int8_t);
21 #endif
22 #ifdef __INT16_TYPE__
23   CHECK_TYPES(__INT16_TYPE__, int16_t);
24 #endif
25 #ifdef __INT32_TYPE__
26   CHECK_TYPES(__INT32_TYPE__, int32_t);
27 #endif
28 #ifdef __INT64_TYPE__
29   CHECK_TYPES(__INT64_TYPE__, int64_t);
30 #endif
31 #ifdef __UINT8_TYPE__
32   CHECK_TYPES(__UINT8_TYPE__, uint8_t);
33 #endif
34 #ifdef __UINT16_TYPE__
35   CHECK_TYPES(__UINT16_TYPE__, uint16_t);
36 #endif
37 #ifdef __UINT32_TYPE__
38   CHECK_TYPES(__UINT32_TYPE__, uint32_t);
39 #endif
40 #ifdef __UINT64_TYPE__
41   CHECK_TYPES(__UINT64_TYPE__, uint64_t);
42 #endif
43 #ifndef NO_LEAST_TYPES
44   CHECK_TYPES(__INT_LEAST8_TYPE__, int_least8_t);
45   CHECK_TYPES(__INT_LEAST16_TYPE__, int_least16_t);
46   CHECK_TYPES(__INT_LEAST32_TYPE__, int_least32_t);
47   CHECK_TYPES(__INT_LEAST64_TYPE__, int_least64_t);
48   CHECK_TYPES(__UINT_LEAST8_TYPE__, uint_least8_t);
49   CHECK_TYPES(__UINT_LEAST16_TYPE__, uint_least16_t);
50   CHECK_TYPES(__UINT_LEAST32_TYPE__, uint_least32_t);
51   CHECK_TYPES(__UINT_LEAST64_TYPE__, uint_least64_t);
52 #endif
53 #ifndef NO_FAST_TYPES
54   CHECK_TYPES(__INT_FAST8_TYPE__, int_fast8_t);
55   CHECK_TYPES(__INT_FAST16_TYPE__, int_fast16_t);
56   CHECK_TYPES(__INT_FAST32_TYPE__, int_fast32_t);
57   CHECK_TYPES(__INT_FAST64_TYPE__, int_fast64_t);
58   CHECK_TYPES(__UINT_FAST8_TYPE__, uint_fast8_t);
59   CHECK_TYPES(__UINT_FAST16_TYPE__, uint_fast16_t);
60   CHECK_TYPES(__UINT_FAST32_TYPE__, uint_fast32_t);
61   CHECK_TYPES(__UINT_FAST64_TYPE__, uint_fast64_t);
62 #endif
63 #ifdef __INTPTR_TYPE__
64   CHECK_TYPES(__INTPTR_TYPE__, intptr_t);
65 #endif
66 #ifdef __UINTPTR_TYPE__
67   CHECK_TYPES(__UINTPTR_TYPE__, uintptr_t);
68 #endif
69 #ifndef NO_MAX_TYPES
70   CHECK_TYPES(__INTMAX_TYPE__, intmax_t);
71   CHECK_TYPES(__UINTMAX_TYPE__, uintmax_t);
72 #endif
73 #ifndef SIGNAL_SUPPRESS
74   CHECK_TYPES(__SIG_ATOMIC_TYPE__, sig_atomic_t);
75 #endif
76 }