diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-08 18:03:55 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-08 18:03:55 +0000 |
commit | 3bbc75302fd43cf13d868b46c94ff8794b302e43 (patch) | |
tree | 1728504f2e06ca75a920b8240d2d07db2454e355 /utils/builtin-defines.c | |
parent | 9158804749356f88be8c5a3bade75b761846273c (diff) |
More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
defined (instead of __DYNAMIC__).
- Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.
- Set __NO_INLINE__ following GCC 4.2.
- Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.
- Set __EXCEPTIONS for Objective-C NonFragile ABI.
- Set __STRICT_ANSI__ for standard conforming modes.
- I added a clang style test case in utils for this, but its not
particularly portable and I don't think it belongs in the test
suite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/builtin-defines.c')
-rw-r--r-- | utils/builtin-defines.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/utils/builtin-defines.c b/utils/builtin-defines.c new file mode 100644 index 0000000000..98b0220748 --- /dev/null +++ b/utils/builtin-defines.c @@ -0,0 +1,79 @@ +/* +This is a clang style test case for checking that preprocessor +defines match gcc. +*/ + +/* +RUN: for arch in -m32 -m64; do \ +RUN: for lang in -std=gnu89 -ansi -std=c99 -std=gnu99; do \ +RUN: for input in c objective-c; do \ +RUN: for opts in "-O0" "-O1 -dynamic" "-O2 -static" "-Os"; do \ +RUN: echo "-- $arch, $lang, $input, $opts --"; \ +RUN: for cc in 0 1; do \ +RUN: if [ "$cc" == 0 ]; then \ +RUN: cc_prog=clang; \ +RUN: output=%t0; \ +RUN: else \ +RUN: cc_prog=gcc; \ +RUN: output=%t1; \ +RUN: fi; \ +RUN: $cc_prog $arch $lang $opts -dM -E -x $input %s | sort > $output; \ +RUN: done; \ +RUN: if (! diff %t0 %t1); then exit 1; fi; \ +RUN: done; \ +RUN: done; \ +RUN: done; \ +RUN: done; +*/ + +/* We don't care about this difference */ +#ifdef __PIC__ +#if __PIC__ == 1 +#undef __PIC__ +#undef __pic__ +#define __PIC__ 2 +#define __pic__ 2 +#endif +#endif + +/* Undefine things we don't expect to match. */ +#undef __DEC_EVAL_METHOD__ +#undef __INT16_TYPE__ +#undef __INT32_TYPE__ +#undef __INT64_TYPE__ +#undef __INT8_TYPE__ +#undef __SSP__ +#undef __APPLE_CC__ +#undef __VERSION__ +#undef __clang__ +#undef __llvm__ +#undef __nocona +#undef __nocona__ +#undef __k8 +#undef __k8__ +#undef __tune_nocona__ +#undef __tune_core2__ +#undef __POINTER_WIDTH__ +#undef __INTPTR_TYPE__ + +#undef __DEC128_DEN__ +#undef __DEC128_EPSILON__ +#undef __DEC128_MANT_DIG__ +#undef __DEC128_MAX_EXP__ +#undef __DEC128_MAX__ +#undef __DEC128_MIN_EXP__ +#undef __DEC128_MIN__ +#undef __DEC32_DEN__ +#undef __DEC32_EPSILON__ +#undef __DEC32_MANT_DIG__ +#undef __DEC32_MAX_EXP__ +#undef __DEC32_MAX__ +#undef __DEC32_MIN_EXP__ +#undef __DEC32_MIN__ +#undef __DEC64_DEN__ +#undef __DEC64_EPSILON__ +#undef __DEC64_MANT_DIG__ +#undef __DEC64_MAX_EXP__ +#undef __DEC64_MAX__ +#undef __DEC64_MIN_EXP__ +#undef __DEC64_MIN__ |