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; \ |
Daniel Dunbar | 31ed552 | 2009-05-11 23:11:21 +0000 | [diff] [blame] | 20 | RUN: $cc_prog $arch $lang $opts -march=core2 -dM -E -x $input %s | sort > $output; \ |
Daniel Dunbar | 3bbc753 | 2009-04-08 18:03:55 +0000 | [diff] [blame] | 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. */ |
Daniel Dunbar | 31ed552 | 2009-05-11 23:11:21 +0000 | [diff] [blame] | 40 | #undef __core2 |
| 41 | #undef __core2__ |
| 42 | #undef __SSSE3__ |
| 43 | |
| 44 | /* Undefine things we don't expect to match. */ |
Daniel Dunbar | 3bbc753 | 2009-04-08 18:03:55 +0000 | [diff] [blame] | 45 | #undef __DEC_EVAL_METHOD__ |
| 46 | #undef __INT16_TYPE__ |
| 47 | #undef __INT32_TYPE__ |
| 48 | #undef __INT64_TYPE__ |
| 49 | #undef __INT8_TYPE__ |
| 50 | #undef __SSP__ |
| 51 | #undef __APPLE_CC__ |
| 52 | #undef __VERSION__ |
| 53 | #undef __clang__ |
| 54 | #undef __llvm__ |
| 55 | #undef __nocona |
| 56 | #undef __nocona__ |
| 57 | #undef __k8 |
| 58 | #undef __k8__ |
| 59 | #undef __tune_nocona__ |
| 60 | #undef __tune_core2__ |
| 61 | #undef __POINTER_WIDTH__ |
| 62 | #undef __INTPTR_TYPE__ |
Daniel Dunbar | 912f391 | 2009-04-20 23:53:56 +0000 | [diff] [blame] | 63 | #undef __NO_MATH_INLINES |
Daniel Dunbar | 3bbc753 | 2009-04-08 18:03:55 +0000 | [diff] [blame] | 64 | |
| 65 | #undef __DEC128_DEN__ |
| 66 | #undef __DEC128_EPSILON__ |
| 67 | #undef __DEC128_MANT_DIG__ |
| 68 | #undef __DEC128_MAX_EXP__ |
| 69 | #undef __DEC128_MAX__ |
| 70 | #undef __DEC128_MIN_EXP__ |
| 71 | #undef __DEC128_MIN__ |
| 72 | #undef __DEC32_DEN__ |
| 73 | #undef __DEC32_EPSILON__ |
| 74 | #undef __DEC32_MANT_DIG__ |
| 75 | #undef __DEC32_MAX_EXP__ |
| 76 | #undef __DEC32_MAX__ |
| 77 | #undef __DEC32_MIN_EXP__ |
| 78 | #undef __DEC32_MIN__ |
| 79 | #undef __DEC64_DEN__ |
| 80 | #undef __DEC64_EPSILON__ |
| 81 | #undef __DEC64_MANT_DIG__ |
| 82 | #undef __DEC64_MAX_EXP__ |
| 83 | #undef __DEC64_MAX__ |
| 84 | #undef __DEC64_MIN_EXP__ |
| 85 | #undef __DEC64_MIN__ |