headers: corecrt_wstring.h: fix libc++ build libc++ checks _CRT_CONST_CORRECT_OVERLOADS only for MSVC, and it doesn't check __CORRECT_ISO_CPP_WCHAR_H_PROTO. Instead, it uses _WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ to decide whether to provide the correct overloads itself or use the ones provided by the system headers. Without this macro, libc++ will provide the correct overloads itself, which will trigger -Wcast-qual because it expects the system-provided functions (e.g. wcschr) will return wchar_t* instead of const wchar_t*. Previously, this warning was hidden, because the inclusion chain is: cwchar -> libc++ wchar.h -> our wchar.h (by #include_next) -> sec_api/wchar_s.h -> libc++ wchar.h (because no #include next) Because our wchar.h is treated as a system header (it's placed in a path that is registered with -internal-isystem), and libc++ wchar.h is included indirectly by our wchar.h, it's also treated as a system header by Clang even with -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER, and the warnings are hidden. After merging wchar_s.h into wchar.h, libc++ wchar.h is no longer included by our wchar.h, and Clang will treat it as a normal header with -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER, then the warnings occur, and CI fails because -Werror is enabled. See also: https://github.com/dragon-archer/mingw-w64/actions/runs/33171856131/job/98856450001#step:6:2011 Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/corecrt_wstring.h b/mingw-w64-headers/crt/corecrt_wstring.h index 5220f0d..4d6dfb4 100644 --- a/mingw-w64-headers/crt/corecrt_wstring.h +++ b/mingw-w64-headers/crt/corecrt_wstring.h
@@ -13,6 +13,7 @@ #ifdef __cplusplus /* Tell libstdc++ and libc++ we have provided the correct ISO C++ overloads */ #define __CORRECT_ISO_CPP_WCHAR_H_PROTO +#define _WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ #endif #define _WSTRING_DEFINED /* Legacy guard */