[libcxx-commits] [libcxx] [libcxx] Remove the second inclusion of the system header (PR #120946)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 7 08:46:26 PST 2025


================
@@ -106,10 +106,6 @@ void perror(const char* s);
 #  ifndef _LIBCPP_STDIO_H
 #    define _LIBCPP_STDIO_H
 
-#    if __has_include_next(<stdio.h>)
-#      include_next <stdio.h>
----------------
ldionne wrote:

I think some system headers do rely on `__need` macros working though, that's why things broke when I attempted https://reviews.llvm.org/D131425.

Take for example `wchar.h`. If it gets included with a `__need` macro, our  current implementation would fail because the C library's `wchar.h` would not define e.g. `wcsstr(...)`, but we use it in our implementation later in libc++'s own `wchar.h`. That's why I was including the header once again after the first time, with the intent that all required declarations would surely be available after including the C library's `wchar.h` header for the *second* time.

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


More information about the libcxx-commits mailing list