xref: /minix3/external/bsd/llvm/dist/clang/utils/builtin-defines.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc /*
2*f4a2713aSLionel Sambuc This is a clang style test case for checking that preprocessor
3*f4a2713aSLionel Sambuc defines match gcc.
4*f4a2713aSLionel Sambuc */
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc /*
7*f4a2713aSLionel Sambuc RUN: for arch in -m32 -m64; do \
8*f4a2713aSLionel Sambuc RUN:   for lang in -std=gnu89 -ansi -std=c99 -std=gnu99; do \
9*f4a2713aSLionel Sambuc RUN:     for input in c objective-c; do \
10*f4a2713aSLionel Sambuc RUN:       for opts in "-O0" "-O1 -dynamic" "-O2 -static" "-Os"; do     \
11*f4a2713aSLionel Sambuc RUN:         echo "-- $arch, $lang, $input, $opts --"; \
12*f4a2713aSLionel Sambuc RUN:         for cc in 0 1; do \
13*f4a2713aSLionel Sambuc RUN:           if [ "$cc" == 0 ]; then \
14*f4a2713aSLionel Sambuc RUN:             cc_prog=clang; \
15*f4a2713aSLionel Sambuc RUN:             output=%t0; \
16*f4a2713aSLionel Sambuc RUN:           else \
17*f4a2713aSLionel Sambuc RUN:             cc_prog=gcc; \
18*f4a2713aSLionel Sambuc RUN:             output=%t1; \
19*f4a2713aSLionel Sambuc RUN:           fi; \
20*f4a2713aSLionel Sambuc RUN:           $cc_prog $arch $lang $opts -march=core2 -dM -E -x $input %s | sort > $output; \
21*f4a2713aSLionel Sambuc RUN:          done; \
22*f4a2713aSLionel Sambuc RUN:          if (! diff %t0 %t1); then exit 1; fi; \
23*f4a2713aSLionel Sambuc RUN:       done; \
24*f4a2713aSLionel Sambuc RUN:     done; \
25*f4a2713aSLionel Sambuc RUN:   done; \
26*f4a2713aSLionel Sambuc RUN: done;
27*f4a2713aSLionel Sambuc */
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc /* We don't care about this difference */
30*f4a2713aSLionel Sambuc #ifdef __PIC__
31*f4a2713aSLionel Sambuc #if __PIC__ == 1
32*f4a2713aSLionel Sambuc #undef __PIC__
33*f4a2713aSLionel Sambuc #undef __pic__
34*f4a2713aSLionel Sambuc #define __PIC__ 2
35*f4a2713aSLionel Sambuc #define __pic__ 2
36*f4a2713aSLionel Sambuc #endif
37*f4a2713aSLionel Sambuc #endif
38*f4a2713aSLionel Sambuc 
39*f4a2713aSLionel Sambuc /* Undefine things we don't expect to match. */
40*f4a2713aSLionel Sambuc #undef __core2
41*f4a2713aSLionel Sambuc #undef __core2__
42*f4a2713aSLionel Sambuc #undef __SSSE3__
43*f4a2713aSLionel Sambuc 
44*f4a2713aSLionel Sambuc /* Undefine things we don't expect to match. */
45*f4a2713aSLionel Sambuc #undef __DEC_EVAL_METHOD__
46*f4a2713aSLionel Sambuc #undef __INT16_TYPE__
47*f4a2713aSLionel Sambuc #undef __INT32_TYPE__
48*f4a2713aSLionel Sambuc #undef __INT64_TYPE__
49*f4a2713aSLionel Sambuc #undef __INT8_TYPE__
50*f4a2713aSLionel Sambuc #undef __SSP__
51*f4a2713aSLionel Sambuc #undef __APPLE_CC__
52*f4a2713aSLionel Sambuc #undef __VERSION__
53*f4a2713aSLionel Sambuc #undef __clang__
54*f4a2713aSLionel Sambuc #undef __llvm__
55*f4a2713aSLionel Sambuc #undef __nocona
56*f4a2713aSLionel Sambuc #undef __nocona__
57*f4a2713aSLionel Sambuc #undef __k8
58*f4a2713aSLionel Sambuc #undef __k8__
59*f4a2713aSLionel Sambuc #undef __tune_nocona__
60*f4a2713aSLionel Sambuc #undef __tune_core2__
61*f4a2713aSLionel Sambuc #undef __POINTER_WIDTH__
62*f4a2713aSLionel Sambuc #undef __INTPTR_TYPE__
63*f4a2713aSLionel Sambuc #undef __NO_MATH_INLINES
64*f4a2713aSLionel Sambuc 
65*f4a2713aSLionel Sambuc #undef __DEC128_DEN__
66*f4a2713aSLionel Sambuc #undef __DEC128_EPSILON__
67*f4a2713aSLionel Sambuc #undef __DEC128_MANT_DIG__
68*f4a2713aSLionel Sambuc #undef __DEC128_MAX_EXP__
69*f4a2713aSLionel Sambuc #undef __DEC128_MAX__
70*f4a2713aSLionel Sambuc #undef __DEC128_MIN_EXP__
71*f4a2713aSLionel Sambuc #undef __DEC128_MIN__
72*f4a2713aSLionel Sambuc #undef __DEC32_DEN__
73*f4a2713aSLionel Sambuc #undef __DEC32_EPSILON__
74*f4a2713aSLionel Sambuc #undef __DEC32_MANT_DIG__
75*f4a2713aSLionel Sambuc #undef __DEC32_MAX_EXP__
76*f4a2713aSLionel Sambuc #undef __DEC32_MAX__
77*f4a2713aSLionel Sambuc #undef __DEC32_MIN_EXP__
78*f4a2713aSLionel Sambuc #undef __DEC32_MIN__
79*f4a2713aSLionel Sambuc #undef __DEC64_DEN__
80*f4a2713aSLionel Sambuc #undef __DEC64_EPSILON__
81*f4a2713aSLionel Sambuc #undef __DEC64_MANT_DIG__
82*f4a2713aSLionel Sambuc #undef __DEC64_MAX_EXP__
83*f4a2713aSLionel Sambuc #undef __DEC64_MAX__
84*f4a2713aSLionel Sambuc #undef __DEC64_MIN_EXP__
85*f4a2713aSLionel Sambuc #undef __DEC64_MIN__
86