Skip to content

Commit 04950d0

Browse files
[libc++] Suggested fix for #167977
Handle the same guards used by musl libc to conditionally compile the 'Strtonum functions'
1 parent d719876 commit 04950d0

File tree

1 file changed

+15
-0
lines changed
  • libcxx/include/__locale_dir/support

1 file changed

+15
-0
lines changed

libcxx/include/__locale_dir/support/linux.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,30 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
8383
// Strtonum functions
8484
//
8585
inline _LIBCPP_HIDE_FROM_ABI float __strtof(const char* __nptr, char** __endptr, __locale_t __loc) {
86+
#if !_LIBCPP_HAS_MUSL_LIBC || defined(_GNU_SOURCE)
8687
return ::strtof_l(__nptr, __endptr, __loc);
88+
#else
89+
(void)__loc;
90+
return ::strtof(__nptr, __endptr);
91+
#endif
8792
}
8893

8994
inline _LIBCPP_HIDE_FROM_ABI double __strtod(const char* __nptr, char** __endptr, __locale_t __loc) {
95+
#if !_LIBCPP_HAS_MUSL_LIBC || defined(_GNU_SOURCE)
9096
return ::strtod_l(__nptr, __endptr, __loc);
97+
#else
98+
(void)__loc;
99+
return ::strtod(__nptr, __endptr);
100+
#endif
91101
}
92102

93103
inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __endptr, __locale_t __loc) {
104+
#if !_LIBCPP_HAS_MUSL_LIBC || defined(_GNU_SOURCE)
94105
return ::strtold_l(__nptr, __endptr, __loc);
106+
#else
107+
(void)__loc;
108+
return ::strtold(__nptr, __endptr);
109+
#endif
95110
}
96111

97112
inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {

0 commit comments

Comments
 (0)