From 04950d0b335b7b88f8d259038aa416d540dbd7a6 Mon Sep 17 00:00:00 2001 From: "Mr. Walls" Date: Thu, 13 Nov 2025 15:42:52 -0800 Subject: [PATCH] [libc++] Suggested fix for llvm/llvm-project#167977 Handle the same guards used by musl libc to conditionally compile the 'Strtonum functions' --- libcxx/include/__locale_dir/support/linux.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libcxx/include/__locale_dir/support/linux.h b/libcxx/include/__locale_dir/support/linux.h index 94a2ecb9a940d..2233c12b7af8b 100644 --- a/libcxx/include/__locale_dir/support/linux.h +++ b/libcxx/include/__locale_dir/support/linux.h @@ -83,15 +83,30 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) { // Strtonum functions // inline _LIBCPP_HIDE_FROM_ABI float __strtof(const char* __nptr, char** __endptr, __locale_t __loc) { +#if !_LIBCPP_HAS_MUSL_LIBC || defined(_GNU_SOURCE) return ::strtof_l(__nptr, __endptr, __loc); +#else + (void)__loc; + return ::strtof(__nptr, __endptr); +#endif } inline _LIBCPP_HIDE_FROM_ABI double __strtod(const char* __nptr, char** __endptr, __locale_t __loc) { +#if !_LIBCPP_HAS_MUSL_LIBC || defined(_GNU_SOURCE) return ::strtod_l(__nptr, __endptr, __loc); +#else + (void)__loc; + return ::strtod(__nptr, __endptr); +#endif } inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __endptr, __locale_t __loc) { +#if !_LIBCPP_HAS_MUSL_LIBC || defined(_GNU_SOURCE) return ::strtold_l(__nptr, __endptr, __loc); +#else + (void)__loc; + return ::strtold(__nptr, __endptr); +#endif } inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {