[libcxx-commits] [libcxx] draft: [libcxx] avoid the "_l" calls on musl platforms (PR #128936)
Brian Cain via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 26 11:26:35 PST 2025
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/128936
>From 08a49e81a1fffe815be7bbbc64de22ccab8af5b0 Mon Sep 17 00:00:00 2001
From: Pirama Arumuga Nainar <pirama at google.com>
Date: Wed, 26 Feb 2025 11:17:26 -0800
Subject: [PATCH] [libcxx] avoid the "_l" calls on musl platforms
Since 363bfd6090b0 ([libc++] Use the new locale base API on Linux (#128007), 2025-02-24),
musl targets will fail to build with errors like the below:
In file included from /[b/f/w/src/git/out/stage2/include/c++/v1/__locale:14](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale?l=14):
In file included from /[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/locale_base_api.h:123](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/locale_base_api.h?l=123):
/[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/support/linux.h:98](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/support/linux.h?l=98):12: error: no member named 'strtoll_l' in the global namespace
98 | return ::strtoll_l(__nptr, __endptr, __base, __loc);
| ~~^
/[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/support/linux.h:103](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/support/linux.h?l=103):10: error: no member named 'strtoull_l' in the global namespace; did you mean '__strtoull'?
103 | return ::strtoull_l(__nptr, __endptr, __base, __loc);
| ^~~~~~~~~~~~
| __strtoull
/[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/support/linux.h:102](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/support/linux.h?l=102):1: note: '__strtoull' declared here
102 | __strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
| ^
2 errors generated.
---
libcxx/include/__locale_dir/support/linux.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libcxx/include/__locale_dir/support/linux.h b/libcxx/include/__locale_dir/support/linux.h
index f1662c0112603..7787a4c0d7354 100644
--- a/libcxx/include/__locale_dir/support/linux.h
+++ b/libcxx/include/__locale_dir/support/linux.h
@@ -95,12 +95,20 @@ 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 !defined(_LIBCPP_HAS_MUSL_LIBC)
return ::strtoll_l(__nptr, __endptr, __base, __loc);
+#else
+ 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 !defined(_LIBCPP_HAS_MUSL_LIBC)
return ::strtoull_l(__nptr, __endptr, __base, __loc);
+#else
+ return ::strtoull(__nptr, __endptr, __base:);
+#endif
}
//
More information about the libcxx-commits
mailing list