]> granicus.if.org Git - clang/commitdiff
Teach the frontend to provide the builtin preprocessor defines for
authorChandler Carruth <chandlerc@gmail.com>
Tue, 3 Jan 2012 02:46:46 +0000 (02:46 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 3 Jan 2012 02:46:46 +0000 (02:46 +0000)
-ffast-math.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147440 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Preprocessor/predefined-macros.c

index f601f3d73ab619cdf678402145f5e91286286f8e..74c2ec90ece864c74dc4466c1d028ca4e6de1c7e 100644 (file)
@@ -411,6 +411,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
   if (LangOpts.OptimizeSize)
     Builder.defineMacro("__OPTIMIZE_SIZE__");
 
+  if (LangOpts.FastMath)
+    Builder.defineMacro("__FAST_MATH__");
+
   // Initialize target-specific preprocessor defines.
 
   // Define type sizing macros based on the target properties.
index 85a0cb80415c20d8e3e5952cc6e2e84eac48468e..5b03872c1f67bf0a3902abae2b3834848ef11f29 100644 (file)
@@ -1,12 +1,14 @@
-// This test verifies that the correct macros are predefined. It currently
-// only checks for Microsoft macros.
-
-// RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-extensions -fmsc-version=1300 -o - | FileCheck %s
-
-
-// CHECK: #define _INTEGRAL_MAX_BITS 64
-// CHECK: #define _MSC_EXTENSIONS 1
-// CHECK: #define _MSC_VER 1300
-// CHECK: #define _M_IX86 600
-// CHECK: #define _M_IX86_FP
-// CHECK: #define _WIN32 1
+// This test verifies that the correct macros are predefined.
+//
+// RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-extensions \
+// RUN:     -fmsc-version=1300 -o - | FileCheck %s --check-prefix=CHECK-MS
+// CHECK-MS: #define _INTEGRAL_MAX_BITS 64
+// CHECK-MS: #define _MSC_EXTENSIONS 1
+// CHECK-MS: #define _MSC_VER 1300
+// CHECK-MS: #define _M_IX86 600
+// CHECK-MS: #define _M_IX86_FP
+// CHECK-MS: #define _WIN32 1
+//
+// RUN: %clang_cc1 %s -E -dM -ffast-math -o - \
+// RUN:   | FileCheck %s --check-prefix=CHECK-FAST-MATH
+// CHECK-FAST-MATH: #define __FAST_MATH__