[libcxx-commits] [libcxx] [libc++] __need_infinity_nan doesn't work in non-gnu c++ standards (PR #172539)

Ian Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 6 11:34:41 PST 2026


ian-twilightcoder wrote:

> I got rid of the `__need` macros from libc++ headers in #119025 because they are terribly confusing, and I really really don't want to go back on that. Instead, I'd rather do something like what we do for `<stddef.h>` (which also supports `__need` macros). Libc++'s `<stddef.h>` simply does `#include_next <stddef.h>` outside of any header guards, that way it can be multiply-included if needed without problems. I also don't understand why you need to split `float.h` into `__float/characteristics.h` and `__float/header_macro.h` -- we don't do that for `<stddef.h>` and things have worked so far? What's the re-definition issue you're worried about?

stddef.h actually needs to have it declarations moved to a normal modular header as well so that its declarations end up in a single pcm so that we don't run into redeclaration issues in Swift (some of those are worked around in the compiler). But the `__need` macros are probably only relevant in a C/POSIX scenario and it's probably fine to ignore them in C++. I'll rework that.

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


More information about the libcxx-commits mailing list