[llvm-branch-commits] [libcxx] [libc++] Guard additional headers with _LIBCPP_HAS_LOCALIZATION (#131921) (PR #134406)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 4 09:04:04 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
There were some remaining headers that were not guarded with _LIBCPP_HAS_LOCALIZATION, leading to errors when trying to use modules on platforms that don't support localization (since all the headers get pulled in when building the 'std' module). This patch brings these headers in line with what we do for every other header that depends on localization.
This patch also requires including <picolibc.h> from <__configuration/platform.h> in order to define _NEWLIB_VERSION. In the long term, we should use a better approach for doing that, such as defining a macro in the __config_site header.
(cherry picked from commit 4090910a695efcba4b484e9f8ad2b564e9a4e7ed)
---
Patch is 60.60 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/134406.diff
8 Files Affected:
- (modified) libcxx/include/__configuration/platform.h (+7)
- (modified) libcxx/include/__locale (+79-74)
- (modified) libcxx/include/__locale_dir/locale_base_api.h (+58-54)
- (modified) libcxx/include/fstream (+28-27)
- (modified) libcxx/include/regex (+145-143)
- (modified) libcxx/include/strstream (+31-24)
- (modified) libcxx/test/configs/armv7m-picolibc-libc++.cfg.in (-4)
- (modified) libcxx/test/libcxx/system_reserved_names.gen.py (+6)
``````````diff
diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h
index 8d0f8f63f5213..f3c199dee172b 100644
--- a/libcxx/include/__configuration/platform.h
+++ b/libcxx/include/__configuration/platform.h
@@ -42,6 +42,13 @@
# endif
#endif
+// This is required in order for _NEWLIB_VERSION to be defined in places where we use it.
+// TODO: We shouldn't be including arbitrarily-named headers from libc++ since this can break valid
+// user code. Move code paths that need _NEWLIB_VERSION to another customization mechanism.
+#if __has_include(<picolibc.h>)
+# include <picolibc.h>
+#endif
+
#ifndef __BYTE_ORDER__
# error \
"Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index dfe79d5e506f1..93187dc1d0d9c 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -11,6 +11,9 @@
#define _LIBCPP___LOCALE
#include <__config>
+
+#if _LIBCPP_HAS_LOCALIZATION
+
#include <__locale_dir/locale_base_api.h>
#include <__memory/shared_count.h>
#include <__mutex/once_flag.h>
@@ -24,18 +27,18 @@
#include <string>
// Some platforms require more includes than others. Keep the includes on all plaforms for now.
-#include <cstddef>
-#include <cstring>
+# include <cstddef>
+# include <cstring>
-#if _LIBCPP_HAS_WIDE_CHARACTERS
-# include <cwchar>
-#else
-# include <__std_mbstate_t.h>
-#endif
+# if _LIBCPP_HAS_WIDE_CHARACTERS
+# include <cwchar>
+# else
+# include <__std_mbstate_t.h>
+# endif
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -85,9 +88,9 @@ public:
// locale operations:
string name() const;
bool operator==(const locale&) const;
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
_LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); }
-#endif
+# endif
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
operator()(const basic_string<_CharT, _Traits, _Allocator>&, const basic_string<_CharT, _Traits, _Allocator>&) const;
@@ -237,9 +240,9 @@ long collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) cons
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>;
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>;
-#endif
+# endif
// template <class CharT> class collate_byname;
@@ -264,7 +267,7 @@ protected:
string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
};
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
class _LIBCPP_EXPORTED_FROM_ABI collate_byname<wchar_t> : public collate<wchar_t> {
__locale::__locale_t __l_;
@@ -283,7 +286,7 @@ protected:
const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const override;
string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
};
-#endif
+# endif
template <class _CharT, class _Traits, class _Allocator>
bool locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
@@ -296,7 +299,7 @@ bool locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_EXPORTED_FROM_ABI ctype_base {
public:
-#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
+# if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
typedef unsigned long mask;
static const mask space = 1 << 0;
static const mask print = 1 << 1;
@@ -308,14 +311,14 @@ public:
static const mask punct = 1 << 7;
static const mask xdigit = 1 << 8;
static const mask blank = 1 << 9;
-# if defined(__BIONIC__)
+# if defined(__BIONIC__)
// Historically this was a part of regex_traits rather than ctype_base. The
// historical value of the constant is preserved for ABI compatibility.
static const mask __regex_word = 0x8000;
-# else
+# else
static const mask __regex_word = 1 << 10;
-# endif // defined(__BIONIC__)
-#elif defined(__GLIBC__)
+# endif // defined(__BIONIC__)
+# elif defined(__GLIBC__)
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
@@ -327,12 +330,12 @@ public:
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
-# if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
+# if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
static const mask __regex_word = static_cast<mask>(_ISbit(15));
-# else
+# else
static const mask __regex_word = 0x80;
-# endif
-#elif defined(_LIBCPP_MSVCRT_LIKE)
+# endif
+# elif defined(_LIBCPP_MSVCRT_LIKE)
typedef unsigned short mask;
static const mask space = _SPACE;
static const mask print = _BLANK | _PUNCT | _ALPHA | _DIGIT;
@@ -345,16 +348,16 @@ public:
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
-#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
-# ifdef __APPLE__
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+# elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
+# ifdef __APPLE__
typedef uint32_t mask;
-# elif defined(__FreeBSD__)
+# elif defined(__FreeBSD__)
typedef unsigned long mask;
-# elif defined(__NetBSD__)
+# elif defined(__NetBSD__)
typedef unsigned short mask;
-# endif
+# endif
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
@@ -365,16 +368,16 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
-# if defined(__NetBSD__)
+# if defined(__NetBSD__)
static const mask blank = _CTYPE_BL;
// NetBSD defines classes up to 0x2000
// see sys/ctype_bits.h, _CTYPE_Q
static const mask __regex_word = 0x8000;
-# else
+# else
static const mask blank = _CTYPE_B;
static const mask __regex_word = 0x80;
-# endif
-#elif defined(_AIX)
+# endif
+# elif defined(_AIX)
typedef unsigned int mask;
static const mask space = _ISSPACE;
static const mask print = _ISPRINT;
@@ -387,7 +390,7 @@ public:
static const mask xdigit = _ISXDIGIT;
static const mask blank = _ISBLANK;
static const mask __regex_word = 0x8000;
-#elif defined(_NEWLIB_VERSION)
+# elif defined(_NEWLIB_VERSION)
// Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
typedef char mask;
// In case char is signed, static_cast is needed to avoid warning on
@@ -404,11 +407,11 @@ public:
static const mask blank = static_cast<mask>(_B);
// mask is already fully saturated, use a different type in regex_type_traits.
static const unsigned short __regex_word = 0x100;
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
-#elif defined(__MVS__)
-# if defined(__NATIVE_ASCII_F)
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
+# elif defined(__MVS__)
+# if defined(__NATIVE_ASCII_F)
typedef unsigned int mask;
static const mask space = _ISSPACE_A;
static const mask print = _ISPRINT_A;
@@ -420,7 +423,7 @@ public:
static const mask punct = _ISPUNCT_A;
static const mask xdigit = _ISXDIGIT_A;
static const mask blank = _ISBLANK_A;
-# else
+# else
typedef unsigned short mask;
static const mask space = __ISSPACE;
static const mask print = __ISPRINT;
@@ -432,11 +435,11 @@ public:
static const mask punct = __ISPUNCT;
static const mask xdigit = __ISXDIGIT;
static const mask blank = __ISBLANK;
-# endif
+# endif
static const mask __regex_word = 0x8000;
-#else
-# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
-#endif
+# else
+# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
+# endif
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
@@ -450,7 +453,7 @@ public:
template <class _CharT>
class _LIBCPP_TEMPLATE_VIS ctype;
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
class _LIBCPP_EXPORTED_FROM_ABI ctype<wchar_t> : public locale::facet, public ctype_base {
public:
@@ -515,7 +518,7 @@ protected:
virtual const char_type*
do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
};
-#endif // _LIBCPP_HAS_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_isascii(int __c) { return (__c & ~0x7F) == 0; }
@@ -580,25 +583,25 @@ public:
static locale::id id;
-#ifdef _CACHED_RUNES
+# ifdef _CACHED_RUNES
static const size_t table_size = _CACHED_RUNES;
-#else
+# else
static const size_t table_size = 256; // FIXME: Don't hardcode this.
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
static const mask* classic_table() _NOEXCEPT;
-#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+# if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
-#endif
-#if defined(__NetBSD__)
+# endif
+# if defined(__NetBSD__)
static const short* __classic_upper_table() _NOEXCEPT;
static const short* __classic_lower_table() _NOEXCEPT;
-#endif
-#if defined(__MVS__)
+# endif
+# if defined(__MVS__)
static const unsigned short* __classic_upper_table() _NOEXCEPT;
static const unsigned short* __classic_lower_table() _NOEXCEPT;
-#endif
+# endif
protected:
~ctype() override;
@@ -633,7 +636,7 @@ protected:
const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
};
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<wchar_t> : public ctype<wchar_t> {
__locale::__locale_t __l_;
@@ -658,7 +661,7 @@ protected:
const char_type*
do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override;
};
-#endif // _LIBCPP_HAS_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
template <class _CharT>
inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) {
@@ -824,7 +827,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t>
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
class _LIBCPP_EXPORTED_FROM_ABI codecvt<wchar_t, char, mbstate_t> : public locale::facet, public codecvt_base {
__locale::__locale_t __l_;
@@ -903,7 +906,7 @@ protected:
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const _NOEXCEPT;
};
-#endif // _LIBCPP_HAS_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
// template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
@@ -985,7 +988,7 @@ protected:
virtual int do_max_length() const _NOEXCEPT;
};
-#if _LIBCPP_HAS_CHAR8_T
+# if _LIBCPP_HAS_CHAR8_T
// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
@@ -1066,7 +1069,7 @@ protected:
virtual int do_max_length() const _NOEXCEPT;
};
-#endif
+# endif
// template <> class codecvt<char32_t, char, mbstate_t> // deprecated in C++20
@@ -1148,7 +1151,7 @@ protected:
virtual int do_max_length() const _NOEXCEPT;
};
-#if _LIBCPP_HAS_CHAR8_T
+# if _LIBCPP_HAS_CHAR8_T
// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
@@ -1229,7 +1232,7 @@ protected:
virtual int do_max_length() const _NOEXCEPT;
};
-#endif
+# endif
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
@@ -1251,17 +1254,17 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>;
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>;
-#endif
+# endif
extern template class _LIBCPP_DEPRECATED_IN_CXX20
_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20
extern template class _LIBCPP_DEPRECATED_IN_CXX20
_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
-#if _LIBCPP_HAS_CHAR8_T
+# if _LIBCPP_HAS_CHAR8_T
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20
-#endif
+# endif
template <size_t _Np>
struct __narrow_to_utf8 {
@@ -1441,7 +1444,7 @@ protected:
string __grouping_;
};
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
public:
@@ -1470,7 +1473,7 @@ protected:
char_type __thousands_sep_;
string __grouping_;
};
-#endif // _LIBCPP_HAS_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
// template <class charT> class numpunct_byname
@@ -1493,7 +1496,7 @@ private:
void __init(const char*);
};
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
public:
@@ -1509,8 +1512,10 @@ protected:
private:
void __init(const char*);
};
-#endif // _LIBCPP_HAS_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
_LIBCPP_END_NAMESPACE_STD
+#endif // _LIBCPP_HAS_LOCALIZATION
+
#endif // _LIBCPP___LOCALE
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index c1e73caeecced..9d92a5ea1f0aa 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -111,57 +111,59 @@
// int __sscanf(const char*, __locale_t, const char*, ...); // required by the headers
// }
-#if defined(__APPLE__)
-# include <__locale_dir/support/apple.h>
-#elif defined(__FreeBSD__)
-# include <__locale_dir/support/freebsd.h>
-#elif defined(_LIBCPP_MSVCRT_LIKE)
-# include <__locale_dir/support/windows.h>
-#elif defined(__Fuchsia__)
-# include <__locale_dir/support/fuchsia.h>
-#else
+#if _LIBCPP_HAS_LOCALIZATION
+
+# if defined(__APPLE__)
+# include <__locale_dir/support/apple.h>
+# elif defined(__FreeBSD__)
+# include <__locale_dir/support/freebsd.h>
+# elif defined(_LIBCPP_MSVCRT_LIKE)
+# include <__locale_dir/support/windows.h>
+# elif defined(__Fuchsia__)
+# include <__locale_dir/support/fuchsia.h>
+# else
// TODO: This is a temporary definition to bridge between the old way we defined the locale base API
// (by providing global non-reserved names) and the new API. As we move individual platforms
// towards the new way of defining the locale base API, this should disappear since each platform
// will define those directly.
-# if defined(_AIX) || defined(__MVS__)
-# include <__locale_dir/locale_base_api/ibm.h>
-# elif defined(__ANDROID__)
-# include <__locale_dir/locale_base_api/android.h>
-# elif defined(__OpenBSD__)
-# include <__locale_dir/locale_base_api/openbsd.h>
-# elif defined(__wasi__) || _LIBCPP_HAS_MUSL_LIBC
-# include <__locale_dir/locale_base_api/musl.h>
-# endif
-
-# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h>
-
-# include <__cstddef/size_t.h>
-# include <__utility/forward.h>
-# include <ctype.h>
-# include <string.h>
-# include <time.h>
-# if _LIBCPP_HAS_WIDE_CHARACTERS
-# include <wctype.h>
-# endif
+# if defined(_AIX) || defined(__MVS__)
+# include <__locale_dir/locale_base_api/ibm.h>
+# elif defined(__ANDROID__)
+# include <__locale_dir/locale_base_api/android.h>
+# elif defined(__OpenBSD__)
+# include <__locale_dir/locale_base_api/openbsd.h>
+# elif defined(__wasi__) || _LIBCPP_HAS_MUSL_LIBC
+# include <__locale_dir/locale_base_api/musl.h>
+# endif
+
+# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h>
+
+# include <__cstddef/size_t.h>
+# include <__utility/forward.h>
+# include <ctype.h>
+# include <string.h>
+# include <time.h>
+# if _LIBCPP_HAS_WIDE_CHARACTERS
+# include <wctype.h>
+# endif
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __locale {
//
// Locale management
//
-# define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK
-# define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK
-# define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK
-# define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK
-# define _LIBCPP_TIME_MASK LC_TIME_MASK
-# define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
-# define _LIBCPP_ALL_MASK LC_ALL_MASK
-# define _LIBCPP_LC_ALL LC_ALL
+# define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK
+# define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK
+# define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK
+# define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK
+# define _LIBCPP_TIME_MASK LC_TIME_MASK
+# define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
+# define _LIBCPP_ALL_MASK LC_ALL_MASK
+# define _LIBCPP_LC_ALL LC_ALL
using __locale_t _LIBCPP_NODEBUG = locale_t;
-# if defined(_LIBCPP_BUILDING_LIBRARY)
+# if defined(_LIBCPP_BUILDING_LIBRARY)
using __lconv_t _LIBCPP_NODEBUG = lconv;
inline _LIBCPP_HIDE_FROM_ABI __locale_t __newlocale(int __category_mask, const char* __name, __locale_t __loc) {
@@ -175,7 +177,7 @@ inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, char const* __loc
inline _LIBCPP_HIDE_FROM_ABI void __freelocale(__locale_t __loc) { freelocale(__loc); }
inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) { return __libcpp_localeconv_l(__loc); }
-# endif // _LIBCPP_BUILDING_LIBRARY
+# endif // _LIBCPP_BUILDING_LIBRARY
//
// Strtonum functions
@@ -204,15 +206,15 @@ __strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
//
// Character manipulation functions
//
-# if defined(_LIBCPP_BUILDING_LIBRARY)
+# if defined(_LIBCPP_BUILDING_LIBRARY)
inline _LIBCPP_HIDE_FROM_ABI int __islower(int __ch, __locale_t __loc) { return islower_l(__ch, __loc); }
inline _LIBCPP_HIDE_FROM_ABI int __isupper(int __ch, __locale_t __loc) { return isupper_l(__ch, __loc); }
-# endif
+# endif
inline _LIBCPP_HIDE_FROM_ABI int __isdigit(int __ch, __locale_t __loc) { return isdigit_l(__ch, __loc); }
inline _LIBCPP_HIDE_FROM_ABI int __isxdigit(int __ch, __locale_t __loc) { return isxdigit_l(__ch, __loc); }
-# if defined(_LIBCPP_BUILDING_LIBRARY)
+# if defined(_LIBCPP_BUILDING_LIBRARY)
inline _LIBCPP_HIDE_FROM_ABI int __strcoll(const char* __s1, const char* __s2, __locale_t __loc) {
return strcoll_l(__s1, __s2, __loc);
}
@@ -222,7 +224,7 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __strxfrm(char* __dest, const char* __src, s
inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __ch, __locale_t __loc) { return toupper_l(__ch, __loc); }
inline _LIBCPP_HIDE_FROM_ABI int __tolower(int __ch, __locale_t __loc) { return tolower_l(__ch, __loc); }
-# if _LIBCPP_HAS_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
inline _LIBCPP_HIDE_FROM_ABI int __wcscoll(const wchar_t* __s1, const wchar_t* __s2, __locale_t __loc) {
return wcscoll_l(__s1, __s2, __loc);
}
@@ -244,7 +246,7 @@ inline _LIBCPP_HIDE_FROM_ABI int __iswpunct(wint_t __ch, __locale_t __loc) { ret
inline _LIBCPP_HIDE_FROM_ABI int __iswxdigit(wi...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/134406
More information about the llvm-branch-commits
mailing list