Skip to content

Commit

Permalink
check for macros within __math/traits
Browse files Browse the repository at this point in the history
  • Loading branch information
ahgamut committed Dec 12, 2024
1 parent 22094ae commit 1a38b86
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 48 deletions.
44 changes: 44 additions & 0 deletions third_party/libcxx/__math/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,50 @@
# pragma GCC system_header
#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

_LIBCPP_BEGIN_NAMESPACE_STD

namespace __math {
Expand Down
46 changes: 46 additions & 0 deletions third_party/libcxx/cmath
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,52 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
_LIBCPP_PUSH_MACROS
#include <__undef_macros>

# 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



_LIBCPP_BEGIN_NAMESPACE_STD

using ::signbit _LIBCPP_USING_IF_EXISTS;
Expand Down
52 changes: 4 additions & 48 deletions third_party/libcxx/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,54 +307,6 @@ 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

# include <__math/abs.h>
# include <__math/copysign.h>
# include <__math/error_functions.h>
Expand All @@ -379,6 +331,10 @@ extern "C++" {
# include <__type_traits/is_integral.h>
# include <stdlib.h>

# ifdef fpclassify
# undef fpclassify
# endif

// fpclassify relies on implementation-defined constants, so we can't move it to a detail header
_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down

0 comments on commit 1a38b86

Please sign in to comment.