[libc-commits] [libc] [libc][math] Refactor the `math_errhandling` macro definition (PR #166350)

via libc-commits libc-commits at lists.llvm.org
Tue Nov 4 11:46:40 PST 2025


================
@@ -42,14 +42,36 @@
 #define FP_LLOGBNAN LONG_MAX
 #endif
 
-#if defined(__NVPTX__) || defined(__AMDGPU__) || defined(__FAST_MATH__)
-#define math_errhandling 0
-#elif defined(__NO_MATH_ERRNO__)
-#define math_errhandling (MATH_ERREXCEPT)
+// Math error handling. Target support is assumed to be existent unless
+// explicitly disabled.
+#if defined(__NVPTX__) || defined(__AMDGPU__) || defined(__FAST_MATH__) ||     \
+    defined(__NO_MATH_ERRNO__)
+#define __LIBC_SUPPORTS_MATH_ERRNO 0
+#else
+#define __LIBC_SUPPORTS_MATH_ERRNO 1
+#endif
+
+#if (defined(__arm__) || defined(_M_ARM) || defined(__thumb__) ||              \
----------------
lntue wrote:

We should also disable except when `__FAST_MATH__` is defined.

https://github.com/llvm/llvm-project/pull/166350


More information about the libc-commits mailing list