[libcxx-commits] [libcxx] 39c6c8b - [libc++] Fix the locale base API on Linux with musl (#128936)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 27 19:49:23 PST 2025


Author: Brian Cain
Date: 2025-02-27T22:49:19-05:00
New Revision: 39c6c8be2f3f607b413e3f05ab1f4678efdd129a

URL: https://github.com/llvm/llvm-project/commit/39c6c8be2f3f607b413e3f05ab1f4678efdd129a
DIFF: https://github.com/llvm/llvm-project/commit/39c6c8be2f3f607b413e3f05ab1f4678efdd129a.diff

LOG: [libc++] Fix the locale base API on Linux with musl (#128936)

Since `363bfd6090b0 ([libc++] Use the new locale base API on Linux
(#128007), 2025-02-24)`, musl targets will fail to build with errors
due to missing strtoll_l functions.

Co-authored-by: Pirama Arumuga Nainar <pirama at google.com>

Added: 
    

Modified: 
    libcxx/include/__locale_dir/support/linux.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__locale_dir/support/linux.h b/libcxx/include/__locale_dir/support/linux.h
index f1662c0112603..fa0b03c646a2a 100644
--- a/libcxx/include/__locale_dir/support/linux.h
+++ b/libcxx/include/__locale_dir/support/linux.h
@@ -95,12 +95,22 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
 }
 
 inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
+#if !_LIBCPP_HAS_MUSL_LIBC
   return ::strtoll_l(__nptr, __endptr, __base, __loc);
+#else
+  (void)__loc;
+  return ::strtoll(__nptr, __endptr, __base);
+#endif
 }
 
 inline _LIBCPP_HIDE_FROM_ABI unsigned long long
 __strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
+#if !_LIBCPP_HAS_MUSL_LIBC
   return ::strtoull_l(__nptr, __endptr, __base, __loc);
+#else
+  (void)__loc;
+  return ::strtoull(__nptr, __endptr, __base);
+#endif
 }
 
 //


        


More information about the libcxx-commits mailing list