[PATCH] D116337: [clang] set __NO_MATH_ERRNO__ if -fno-math-errno
Alex Xu (Hello71) via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 5 14:13:03 PST 2022
alxu updated this revision to Diff 397712.
alxu added a comment.
Try -p1 compatible diff.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116337/new/
https://reviews.llvm.org/D116337
Files:
clang/lib/Frontend/InitPreprocessor.cpp
clang/test/Preprocessor/predefined-macros.c
Index: clang/test/Preprocessor/predefined-macros.c
===================================================================
--- clang/test/Preprocessor/predefined-macros.c
+++ clang/test/Preprocessor/predefined-macros.c
@@ -59,8 +59,17 @@
// RUN: %clang_cc1 %s -E -dM -ffast-math -o - \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FAST-MATH
// CHECK-FAST-MATH: #define __FAST_MATH__ 1
+// CHECK-FAST-MATH: #define __NO_MATH_ERRNO__ 1
// CHECK-FAST-MATH: #define __FINITE_MATH_ONLY__ 1
//
+// RUN: %clang_cc1 %s -E -dM -fmath-errno -o - \
+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-MATH-ERRNO
+// CHECK-MATH-ERRNO-NOT: __NO_MATH_ERRNO__
+//
+// RUN: %clang %s -E -dM -fno-math-errno -o - \
+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-NO-MATH-ERRNO
+// CHECK-NO-MATH-ERRNO: #define __NO_MATH_ERRNO__ 1
+//
// RUN: %clang_cc1 %s -E -dM -ffinite-math-only -o - \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FINITE-MATH-ONLY
// CHECK-FINITE-MATH-ONLY: #define __FINITE_MATH_ONLY__ 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===================================================================
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1039,6 +1039,9 @@
Builder.defineMacro("__USER_LABEL_PREFIX__", TI.getUserLabelPrefix());
+ if (LangOpts.MathErrno)
+ Builder.defineMacro("__NO_MATH_ERRNO__");
+
if (LangOpts.FastMath || LangOpts.FiniteMathOnly)
Builder.defineMacro("__FINITE_MATH_ONLY__", "1");
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116337.397712.patch
Type: text/x-patch
Size: 1557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220105/6e1a39b1/attachment.bin>
More information about the cfe-commits
mailing list