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

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 11 16:56:54 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
----------------
petrhosek wrote:

I tried that in https://github.com/llvm/llvm-project/pull/94533/commits/745745c5df98cce4924f0fb8ef5bdffb1081953f but that lead to build errors, see https://github.com/llvm/llvm-project/pull/94533#issuecomment-2153159848.

I noticed that the particular `<cmath>` include that triggered that build error was removed by @philnik777 in https://github.com/llvm/llvm-project/commit/0dd8c0ddd0bef1753f7bcbd6709a8e99af507ed5 so it might worth trying it again and see if there are any remaining issues.

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


More information about the libcxx-commits mailing list