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