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