[libcxx-commits] [libcxx] [libcxx] Undefine all supported C math functions (PR #94533)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 4 09:47:20 PDT 2024
================
@@ -307,53 +307,79 @@ long double truncl(long double x);
// back to C++ linkage before including these C++ headers.
extern "C++" {
-# ifdef fpclassify
-# undef fpclassify
-# endif
-
-# ifdef signbit
-# undef signbit
-# endif
-
-# ifdef isfinite
-# undef isfinite
-# endif
-
-# ifdef isinf
-# undef isinf
-# endif
-
-# ifdef isnan
-# undef isnan
-# endif
-
-# ifdef isnormal
-# undef isnormal
-# endif
-
-# ifdef isgreater
-# undef isgreater
-# endif
-
-# ifdef isgreaterequal
-# undef isgreaterequal
-# endif
-
-# ifdef isless
-# undef isless
-# endif
-
-# ifdef islessequal
-# undef islessequal
-# endif
-
-# ifdef islessgreater
-# undef islessgreater
-# endif
-
-# ifdef isunordered
-# undef isunordered
-# endif
+// According to section 7.1.4 Use of library functions of the C standard, any
----------------
ldionne wrote:
IMO it would make more sense to undefine each macro where the corresponding libc++ function is implemented. For example in
```c++
#undef cosh
inline _LIBCPP_HIDE_FROM_ABI float cosh(float __x) _NOEXCEPT { return __builtin_coshf(__x); }
// etc...
```
in `libcxx/include/__math/hyperbolic_functions.h`.
https://github.com/llvm/llvm-project/pull/94533
More information about the libcxx-commits
mailing list