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

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 6 11:35:58 PDT 2024


PiJoules wrote:

Just as philnik777 points out, it looks like that's what's happening here. For isnan, it's first `undef`d via an include of `__math/traits.h` here
```
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2/libcxx/src/bind.cpp:9:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/functional:535:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__functional/bind.h:21:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/tuple:261:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/compare:147:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__compare/compare_partial_order_fallback.h:13:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__compare/partial_order.h:14:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__compare/weak_order.h:14:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__compare/strong_order.h:17:
/usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__math/traits.h:95:2: warning: "undef isnan" [-W#warnings]
```
then we include `math.h` afterwards which would redefine it:
```
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2/libcxx/src/bind.cpp:9:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/functional:540:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__functional/boyer_moore_searcher.h:26:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/unordered_map:591:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/__hash_table:43:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/cmath:318:
In file included from /usr/local/google/home/leonardchan/llvm-projects/my-llvm-project-2-build/include/c++/v1/math.h:301:
/usr/local/google/home/leonardchan/misc/linux-sysroot/usr/include/math.h:259:2: warning: "included math.h" [-W#warnings]
  259 | #warning "included math.h"
      |  ^
```

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


More information about the libcxx-commits mailing list