[libcxx-commits] [libcxx] [libcxx] Undefine all supported C math functions (PR #94533)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 6 10:23:22 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
----------------
philnik777 wrote:

@ldionne Consider
```c++
#include <__math/traits.h>
#include <math.h>
```
The `__math/traits.h` would try to `#undef` a macro that will only be defined when including `math.h`. Does that make it clearer?

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


More information about the libcxx-commits mailing list