builtin-defines.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. This is a clang style test case for checking that preprocessor
  3. defines match gcc.
  4. */
  5. /*
  6. RUN: for arch in -m32 -m64; do \
  7. RUN: for lang in -std=gnu89 -ansi -std=c99 -std=gnu99; do \
  8. RUN: for input in c objective-c; do \
  9. RUN: for opts in "-O0" "-O1 -dynamic" "-O2 -static" "-Os"; do \
  10. RUN: echo "-- $arch, $lang, $input, $opts --"; \
  11. RUN: for cc in 0 1; do \
  12. RUN: if [ "$cc" == 0 ]; then \
  13. RUN: cc_prog=clang; \
  14. RUN: output=%t0; \
  15. RUN: else \
  16. RUN: cc_prog=gcc; \
  17. RUN: output=%t1; \
  18. RUN: fi; \
  19. RUN: $cc_prog $arch $lang $opts -march=core2 -dM -E -x $input %s | sort > $output; \
  20. RUN: done; \
  21. RUN: if (! diff %t0 %t1); then exit 1; fi; \
  22. RUN: done; \
  23. RUN: done; \
  24. RUN: done; \
  25. RUN: done;
  26. */
  27. /* We don't care about this difference */
  28. #ifdef __PIC__
  29. #if __PIC__ == 1
  30. #undef __PIC__
  31. #undef __pic__
  32. #define __PIC__ 2
  33. #define __pic__ 2
  34. #endif
  35. #endif
  36. /* Undefine things we don't expect to match. */
  37. #undef __core2
  38. #undef __core2__
  39. #undef __SSSE3__
  40. /* Undefine things we don't expect to match. */
  41. #undef __DEC_EVAL_METHOD__
  42. #undef __INT16_TYPE__
  43. #undef __INT32_TYPE__
  44. #undef __INT64_TYPE__
  45. #undef __INT8_TYPE__
  46. #undef __SSP__
  47. #undef __APPLE_CC__
  48. #undef __VERSION__
  49. #undef __clang__
  50. #undef __llvm__
  51. #undef __nocona
  52. #undef __nocona__
  53. #undef __k8
  54. #undef __k8__
  55. #undef __tune_nocona__
  56. #undef __tune_core2__
  57. #undef __POINTER_WIDTH__
  58. #undef __INTPTR_TYPE__
  59. #undef __NO_MATH_INLINES
  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__