[libcxx-commits] [libcxx] [libc++] Move the locale support headers to __locale_dir/locale_base_api/ (PR #74522)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 12:54:53 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 86bde5adc8f20a619c7ccbfee5d9bf92c5429226 49e7cbc460927eab140dd3420f454a9c8d432299 -- libcxx/include/__locale_dir/locale_base_api.h libcxx/include/__locale libcxx/include/__locale_dir/locale_base_api/android.h libcxx/include/__locale_dir/locale_base_api/fuchsia.h libcxx/include/__locale_dir/locale_base_api/ibm.h libcxx/include/__locale_dir/locale_base_api/musl.h libcxx/include/__locale_dir/locale_base_api/newlib.h libcxx/include/__locale_dir/locale_base_api/openbsd.h libcxx/include/__locale_dir/locale_base_api/win32.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__locale_dir/locale_base_api/android.h b/libcxx/include/__locale_dir/locale_base_api/android.h
index 1f4c621e76..c2dea1e731 100644
--- a/libcxx/include/__locale_dir/locale_base_api/android.h
+++ b/libcxx/include/__locale_dir/locale_base_api/android.h
@@ -12,39 +12,39 @@
 
 #if defined(__BIONIC__)
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
-#include <stdlib.h>
-#include <xlocale.h>
+#  include <stdlib.h>
+#  include <xlocale.h>
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 
-#if defined(__ANDROID__)
+#  if defined(__ANDROID__)
 
-#include <android/api-level.h>
-#if __ANDROID_API__ < 21
-#include <__support/xlocale/__posix_l_fallback.h>
-#endif
+#    include <android/api-level.h>
+#    if __ANDROID_API__ < 21
+#      include <__support/xlocale/__posix_l_fallback.h>
+#    endif
 
 // If we do not have this header, we are in a platform build rather than an NDK
 // build, which will always be at least as new as the ToT NDK, in which case we
 // don't need any of the inlines below since libc provides them.
-#if __has_include(<android/ndk-version.h>)
-#include <android/ndk-version.h>
+#    if __has_include(<android/ndk-version.h>)
+#      include <android/ndk-version.h>
 // In NDK versions later than 16, locale-aware functions are provided by
 // legacy_stdlib_inlines.h
-#if __NDK_MAJOR__ <= 16
-#if __ANDROID_API__ < 21
-#include <__support/xlocale/__strtonum_fallback.h>
-#elif __ANDROID_API__ < 26
+#      if __NDK_MAJOR__ <= 16
+#        if __ANDROID_API__ < 21
+#          include <__support/xlocale/__strtonum_fallback.h>
+#        elif __ANDROID_API__ < 26
 
-#if defined(__cplusplus)
+#          if defined(__cplusplus)
 extern "C" {
-#endif
+#          endif
 
 inline _LIBCPP_HIDE_FROM_ABI_C float strtof_l(const char* __nptr, char** __endptr, locale_t) {
   return ::strtof(__nptr, __endptr);
@@ -58,15 +58,15 @@ inline _LIBCPP_HIDE_FROM_ABI_C long strtol_l(const char* __nptr, char** __endptr
   return ::strtol(__nptr, __endptr, __base);
 }
 
-#if defined(__cplusplus)
+#          if defined(__cplusplus)
 }
-#endif
+#          endif
 
-#endif // __ANDROID_API__ < 26
+#        endif // __ANDROID_API__ < 26
 
-#endif // __NDK_MAJOR__ <= 16
-#endif // __has_include(<android/ndk-version.h>)
-#endif // defined(__ANDROID__)
+#      endif // __NDK_MAJOR__ <= 16
+#    endif   // __has_include(<android/ndk-version.h>)
+#  endif     // defined(__ANDROID__)
 
 #endif // defined(__BIONIC__)
 #endif // _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H
diff --git a/libcxx/include/__locale_dir/locale_base_api/fuchsia.h b/libcxx/include/__locale_dir/locale_base_api/fuchsia.h
index 561d99e815..f999bead23 100644
--- a/libcxx/include/__locale_dir/locale_base_api/fuchsia.h
+++ b/libcxx/include/__locale_dir/locale_base_api/fuchsia.h
@@ -12,10 +12,10 @@
 
 #if defined(__Fuchsia__)
 
-#include <cstdlib>
-#include <cwchar>
-#include <__support/xlocale/__posix_l_fallback.h>
-#include <__support/xlocale/__strtonum_fallback.h>
+#  include <__support/xlocale/__posix_l_fallback.h>
+#  include <__support/xlocale/__strtonum_fallback.h>
+#  include <cstdlib>
+#  include <cwchar>
 
 #endif // defined(__Fuchsia__)
 
diff --git a/libcxx/include/__locale_dir/locale_base_api/ibm.h b/libcxx/include/__locale_dir/locale_base_api/ibm.h
index 6d5cd9fab5..f2211b5c8f 100644
--- a/libcxx/include/__locale_dir/locale_base_api/ibm.h
+++ b/libcxx/include/__locale_dir/locale_base_api/ibm.h
@@ -11,7 +11,7 @@
 #define _LIBCPP___LOCALE_LOCALE_BASE_API_IBM_H
 
 #if defined(__MVS__)
-#include <__support/ibm/locale_mgmt_zos.h>
+#  include <__support/ibm/locale_mgmt_zos.h>
 #endif // defined(__MVS__)
 
 #include <stdarg.h>
@@ -23,9 +23,9 @@ extern "C" {
 #endif
 
 #if defined(__MVS__)
-#include <wctype.h>
+#  include <wctype.h>
 // POSIX routines
-#include <__support/xlocale/__posix_l_fallback.h>
+#  include <__support/xlocale/__posix_l_fallback.h>
 #endif // defined(__MVS__)
 
 namespace {
@@ -33,7 +33,7 @@ namespace {
 struct __setAndRestore {
   explicit __setAndRestore(locale_t locale) {
     if (locale == (locale_t)0) {
-      __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
+      __cloc   = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
       __stored = uselocale(__cloc);
     } else {
       __stored = uselocale(locale);
@@ -48,59 +48,52 @@ struct __setAndRestore {
 
 private:
   locale_t __stored = (locale_t)0;
-  locale_t __cloc = (locale_t)0;
+  locale_t __cloc   = (locale_t)0;
 };
 
 } // namespace
 
 // The following are not POSIX routines.  These are quick-and-dirty hacks
 // to make things pretend to work
-inline _LIBCPP_HIDE_FROM_ABI long long
-strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtoll(__nptr, __endptr, __base);
 }
 
-inline _LIBCPP_HIDE_FROM_ABI long
-strtol_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long strtol_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtol(__nptr, __endptr, __base);
 }
 
-inline _LIBCPP_HIDE_FROM_ABI double
-strtod_l(const char *__nptr, char **__endptr, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtod(__nptr, __endptr);
 }
 
-inline _LIBCPP_HIDE_FROM_ABI float
-strtof_l(const char *__nptr, char **__endptr, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtof(__nptr, __endptr);
 }
 
-inline _LIBCPP_HIDE_FROM_ABI long double
-strtold_l(const char *__nptr, char **__endptr, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtold(__nptr, __endptr);
 }
 
 inline _LIBCPP_HIDE_FROM_ABI unsigned long long
-strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtoull(__nptr, __endptr, __base);
 }
 
-inline _LIBCPP_HIDE_FROM_ABI unsigned long
-strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI unsigned long strtoul_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
   __setAndRestore __newloc(locale);
   return ::strtoul(__nptr, __endptr, __base);
 }
 
-inline _LIBCPP_HIDE_FROM_ABI int
-vasprintf(char **strp, const char *fmt, va_list ap) {
+inline _LIBCPP_HIDE_FROM_ABI int vasprintf(char** strp, const char* fmt, va_list ap) {
   const size_t buff_size = 256;
-  if ((*strp = (char *)malloc(buff_size)) == NULL) {
+  if ((*strp = (char*)malloc(buff_size)) == NULL) {
     return -1;
   }
 
@@ -111,14 +104,14 @@ vasprintf(char **strp, const char *fmt, va_list ap) {
 #else
   va_copy(ap_copy, ap);
 #endif
-  int str_size = vsnprintf(*strp, buff_size, fmt,  ap_copy);
+  int str_size = vsnprintf(*strp, buff_size, fmt, ap_copy);
   va_end(ap_copy);
 
-  if ((size_t) str_size >= buff_size) {
-    if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL) {
+  if ((size_t)str_size >= buff_size) {
+    if ((*strp = (char*)realloc(*strp, str_size + 1)) == NULL) {
       return -1;
     }
-    str_size = vsnprintf(*strp, str_size + 1, fmt,  ap);
+    str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
   }
   return str_size;
 }
diff --git a/libcxx/include/__locale_dir/locale_base_api/newlib.h b/libcxx/include/__locale_dir/locale_base_api/newlib.h
index 4639e0b63b..8d030cb732 100644
--- a/libcxx/include/__locale_dir/locale_base_api/newlib.h
+++ b/libcxx/include/__locale_dir/locale_base_api/newlib.h
@@ -11,12 +11,11 @@
 
 #if defined(_NEWLIB_VERSION)
 
-#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
-    __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
-#include <__support/xlocale/__nop_locale_mgmt.h>
-#include <__support/xlocale/__posix_l_fallback.h>
-#include <__support/xlocale/__strtonum_fallback.h>
-#endif
+#  if !defined(__NEWLIB__) || __NEWLIB__ < 2 || __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
+#    include <__support/xlocale/__nop_locale_mgmt.h>
+#    include <__support/xlocale/__posix_l_fallback.h>
+#    include <__support/xlocale/__strtonum_fallback.h>
+#  endif
 
 #endif // _NEWLIB_VERSION
 
diff --git a/libcxx/include/__locale_dir/locale_base_api/win32.h b/libcxx/include/__locale_dir/locale_base_api/win32.h
index f50553634f..5dfacfb9c1 100644
--- a/libcxx/include/__locale_dir/locale_base_api/win32.h
+++ b/libcxx/include/__locale_dir/locale_base_api/win32.h
@@ -41,176 +41,148 @@
 #define LC_NUMERIC_MASK _M_NUMERIC
 #define LC_TIME_MASK _M_TIME
 #define LC_MESSAGES_MASK _M_MESSAGES
-#define LC_ALL_MASK (  LC_COLLATE_MASK \
-                     | LC_CTYPE_MASK \
-                     | LC_MESSAGES_MASK \
-                     | LC_MONETARY_MASK \
-                     | LC_NUMERIC_MASK \
-                     | LC_TIME_MASK )
+#define LC_ALL_MASK                                                                                                    \
+  (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
 
 class __lconv_storage {
 public:
-    __lconv_storage(const lconv *__lc_input) {
-        __lc_ = *__lc_input;
-
-        __decimal_point_ = __lc_input->decimal_point;
-        __thousands_sep_ = __lc_input->thousands_sep;
-        __grouping_ = __lc_input->grouping;
-        __int_curr_symbol_ = __lc_input->int_curr_symbol;
-        __currency_symbol_ = __lc_input->currency_symbol;
-        __mon_decimal_point_ = __lc_input->mon_decimal_point;
-        __mon_thousands_sep_ = __lc_input->mon_thousands_sep;
-        __mon_grouping_ = __lc_input->mon_grouping;
-        __positive_sign_ = __lc_input->positive_sign;
-        __negative_sign_ = __lc_input->negative_sign;
-
-        __lc_.decimal_point = const_cast<char *>(__decimal_point_.c_str());
-        __lc_.thousands_sep = const_cast<char *>(__thousands_sep_.c_str());
-        __lc_.grouping = const_cast<char *>(__grouping_.c_str());
-        __lc_.int_curr_symbol = const_cast<char *>(__int_curr_symbol_.c_str());
-        __lc_.currency_symbol = const_cast<char *>(__currency_symbol_.c_str());
-        __lc_.mon_decimal_point = const_cast<char *>(__mon_decimal_point_.c_str());
-        __lc_.mon_thousands_sep = const_cast<char *>(__mon_thousands_sep_.c_str());
-        __lc_.mon_grouping = const_cast<char *>(__mon_grouping_.c_str());
-        __lc_.positive_sign = const_cast<char *>(__positive_sign_.c_str());
-        __lc_.negative_sign = const_cast<char *>(__negative_sign_.c_str());
-    }
-
-    lconv *__get() {
-        return &__lc_;
-    }
+  __lconv_storage(const lconv* __lc_input) {
+    __lc_ = *__lc_input;
+
+    __decimal_point_     = __lc_input->decimal_point;
+    __thousands_sep_     = __lc_input->thousands_sep;
+    __grouping_          = __lc_input->grouping;
+    __int_curr_symbol_   = __lc_input->int_curr_symbol;
+    __currency_symbol_   = __lc_input->currency_symbol;
+    __mon_decimal_point_ = __lc_input->mon_decimal_point;
+    __mon_thousands_sep_ = __lc_input->mon_thousands_sep;
+    __mon_grouping_      = __lc_input->mon_grouping;
+    __positive_sign_     = __lc_input->positive_sign;
+    __negative_sign_     = __lc_input->negative_sign;
+
+    __lc_.decimal_point     = const_cast<char*>(__decimal_point_.c_str());
+    __lc_.thousands_sep     = const_cast<char*>(__thousands_sep_.c_str());
+    __lc_.grouping          = const_cast<char*>(__grouping_.c_str());
+    __lc_.int_curr_symbol   = const_cast<char*>(__int_curr_symbol_.c_str());
+    __lc_.currency_symbol   = const_cast<char*>(__currency_symbol_.c_str());
+    __lc_.mon_decimal_point = const_cast<char*>(__mon_decimal_point_.c_str());
+    __lc_.mon_thousands_sep = const_cast<char*>(__mon_thousands_sep_.c_str());
+    __lc_.mon_grouping      = const_cast<char*>(__mon_grouping_.c_str());
+    __lc_.positive_sign     = const_cast<char*>(__positive_sign_.c_str());
+    __lc_.negative_sign     = const_cast<char*>(__negative_sign_.c_str());
+  }
+
+  lconv* __get() { return &__lc_; }
+
 private:
-    lconv __lc_;
-    std::string __decimal_point_;
-    std::string __thousands_sep_;
-    std::string __grouping_;
-    std::string __int_curr_symbol_;
-    std::string __currency_symbol_;
-    std::string __mon_decimal_point_;
-    std::string __mon_thousands_sep_;
-    std::string __mon_grouping_;
-    std::string __positive_sign_;
-    std::string __negative_sign_;
+  lconv __lc_;
+  std::string __decimal_point_;
+  std::string __thousands_sep_;
+  std::string __grouping_;
+  std::string __int_curr_symbol_;
+  std::string __currency_symbol_;
+  std::string __mon_decimal_point_;
+  std::string __mon_thousands_sep_;
+  std::string __mon_grouping_;
+  std::string __positive_sign_;
+  std::string __negative_sign_;
 };
 
 class locale_t {
 public:
-    locale_t()
-        : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
-    locale_t(std::nullptr_t)
-        : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
-    locale_t(_locale_t __xlocale, const char* __xlocale_str)
-        : __locale_(__xlocale), __locale_str_(__xlocale_str), __lc_(nullptr) {}
-    locale_t(const locale_t &__l)
-        : __locale_(__l.__locale_), __locale_str_(__l.__locale_str_), __lc_(nullptr) {}
-
-    ~locale_t() {
-        delete __lc_;
-    }
-
-    locale_t &operator =(const locale_t &__l) {
-        __locale_ = __l.__locale_;
-        __locale_str_ = __l.__locale_str_;
-        // __lc_ not copied
-        return *this;
-    }
-
-    friend bool operator==(const locale_t& __left, const locale_t& __right) {
-        return __left.__locale_ == __right.__locale_;
-    }
-
-    friend bool operator==(const locale_t& __left, int __right) {
-        return __left.__locale_ == nullptr && __right == 0;
-    }
-
-    friend bool operator==(const locale_t& __left, long long __right) {
-        return __left.__locale_ == nullptr && __right == 0;
-    }
-
-    friend bool operator==(const locale_t& __left, std::nullptr_t) {
-        return __left.__locale_ == nullptr;
-    }
-
-    friend bool operator==(int __left, const locale_t& __right) {
-        return __left == 0 && nullptr == __right.__locale_;
-    }
-
-    friend bool operator==(std::nullptr_t, const locale_t& __right) {
-        return nullptr == __right.__locale_;
-    }
-
-    friend bool operator!=(const locale_t& __left, const locale_t& __right) {
-        return !(__left == __right);
-    }
-
-    friend bool operator!=(const locale_t& __left, int __right) {
-        return !(__left == __right);
-    }
-
-    friend bool operator!=(const locale_t& __left, long long __right) {
-        return !(__left == __right);
-    }
-
-    friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
-        return !(__left == __right);
-    }
-
-    friend bool operator!=(int __left, const locale_t& __right) {
-        return !(__left == __right);
-    }
-
-    friend bool operator!=(std::nullptr_t __left, const locale_t& __right) {
-        return !(__left == __right);
-    }
-
-    operator bool() const {
-        return __locale_ != nullptr;
-    }
-
-    const char* __get_locale() const { return __locale_str_; }
-
-    operator _locale_t() const {
-        return __locale_;
-    }
-
-    lconv *__store_lconv(const lconv *__input_lc) {
-        delete __lc_;
-        __lc_ = new __lconv_storage(__input_lc);
-        return __lc_->__get();
-    }
+  locale_t() : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
+  locale_t(std::nullptr_t) : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
+  locale_t(_locale_t __xlocale, const char* __xlocale_str)
+      : __locale_(__xlocale), __locale_str_(__xlocale_str), __lc_(nullptr) {}
+  locale_t(const locale_t& __l) : __locale_(__l.__locale_), __locale_str_(__l.__locale_str_), __lc_(nullptr) {}
+
+  ~locale_t() { delete __lc_; }
+
+  locale_t& operator=(const locale_t& __l) {
+    __locale_     = __l.__locale_;
+    __locale_str_ = __l.__locale_str_;
+    // __lc_ not copied
+    return *this;
+  }
+
+  friend bool operator==(const locale_t& __left, const locale_t& __right) {
+    return __left.__locale_ == __right.__locale_;
+  }
+
+  friend bool operator==(const locale_t& __left, int __right) { return __left.__locale_ == nullptr && __right == 0; }
+
+  friend bool operator==(const locale_t& __left, long long __right) {
+    return __left.__locale_ == nullptr && __right == 0;
+  }
+
+  friend bool operator==(const locale_t& __left, std::nullptr_t) { return __left.__locale_ == nullptr; }
+
+  friend bool operator==(int __left, const locale_t& __right) { return __left == 0 && nullptr == __right.__locale_; }
+
+  friend bool operator==(std::nullptr_t, const locale_t& __right) { return nullptr == __right.__locale_; }
+
+  friend bool operator!=(const locale_t& __left, const locale_t& __right) { return !(__left == __right); }
+
+  friend bool operator!=(const locale_t& __left, int __right) { return !(__left == __right); }
+
+  friend bool operator!=(const locale_t& __left, long long __right) { return !(__left == __right); }
+
+  friend bool operator!=(const locale_t& __left, std::nullptr_t __right) { return !(__left == __right); }
+
+  friend bool operator!=(int __left, const locale_t& __right) { return !(__left == __right); }
+
+  friend bool operator!=(std::nullptr_t __left, const locale_t& __right) { return !(__left == __right); }
+
+  operator bool() const { return __locale_ != nullptr; }
+
+  const char* __get_locale() const { return __locale_str_; }
+
+  operator _locale_t() const { return __locale_; }
+
+  lconv* __store_lconv(const lconv* __input_lc) {
+    delete __lc_;
+    __lc_ = new __lconv_storage(__input_lc);
+    return __lc_->__get();
+  }
+
 private:
-    _locale_t __locale_;
-    const char* __locale_str_;
-    __lconv_storage *__lc_ = nullptr;
+  _locale_t __locale_;
+  const char* __locale_str_;
+  __lconv_storage* __lc_ = nullptr;
 };
 
 // Locale management functions
 #define freelocale _free_locale
 // FIXME: base currently unused. Needs manual work to construct the new locale
-locale_t newlocale( int __mask, const char * __locale, locale_t __base );
+locale_t newlocale(int __mask, const char* __locale, locale_t __base);
 // uselocale can't be implemented on Windows because Windows allows partial modification
 // of thread-local locale and so _get_current_locale() returns a copy while uselocale does
 // not create any copies.
 // We can still implement raii even without uselocale though.
 
-
-lconv *localeconv_l( locale_t & __loc );
-size_t mbrlen_l( const char *__restrict __s, size_t __n,
-                 mbstate_t *__restrict __ps, locale_t __loc);
-size_t mbsrtowcs_l( wchar_t *__restrict __dst, const char **__restrict __src,
-                    size_t __len, mbstate_t *__restrict __ps, locale_t __loc );
-size_t wcrtomb_l( char *__restrict __s, wchar_t __wc, mbstate_t *__restrict __ps,
-                  locale_t __loc);
-size_t mbrtowc_l( wchar_t *__restrict __pwc, const char *__restrict __s,
-                  size_t __n, mbstate_t *__restrict __ps, locale_t __loc);
-size_t mbsnrtowcs_l( wchar_t *__restrict __dst, const char **__restrict __src,
-                     size_t __nms, size_t __len, mbstate_t *__restrict __ps, locale_t __loc);
-size_t wcsnrtombs_l( char *__restrict __dst, const wchar_t **__restrict __src,
-                     size_t __nwc, size_t __len, mbstate_t *__restrict __ps, locale_t __loc);
-wint_t btowc_l( int __c, locale_t __loc );
-int wctob_l( wint_t __c, locale_t __loc );
-
-decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
+lconv* localeconv_l(locale_t& __loc);
+size_t mbrlen_l(const char* __restrict __s, size_t __n, mbstate_t* __restrict __ps, locale_t __loc);
+size_t mbsrtowcs_l(
+    wchar_t* __restrict __dst, const char** __restrict __src, size_t __len, mbstate_t* __restrict __ps, locale_t __loc);
+size_t wcrtomb_l(char* __restrict __s, wchar_t __wc, mbstate_t* __restrict __ps, locale_t __loc);
+size_t mbrtowc_l(
+    wchar_t* __restrict __pwc, const char* __restrict __s, size_t __n, mbstate_t* __restrict __ps, locale_t __loc);
+size_t mbsnrtowcs_l(wchar_t* __restrict __dst,
+                    const char** __restrict __src,
+                    size_t __nms,
+                    size_t __len,
+                    mbstate_t* __restrict __ps,
+                    locale_t __loc);
+size_t wcsnrtombs_l(char* __restrict __dst,
+                    const wchar_t** __restrict __src,
+                    size_t __nwc,
+                    size_t __len,
+                    mbstate_t* __restrict __ps,
+                    locale_t __loc);
+wint_t btowc_l(int __c, locale_t __loc);
+int wctob_l(wint_t __c, locale_t __loc);
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L(locale_t __l);
 
 // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
 #define mbtowc_l _mbtowc_l
@@ -218,23 +190,15 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
 #define strtoull_l _strtoui64_l
 #define strtod_l _strtod_l
 #if defined(_LIBCPP_MSVCRT)
-#define strtof_l _strtof_l
-#define strtold_l _strtold_l
+#  define strtof_l _strtof_l
+#  define strtold_l _strtold_l
 #else
 _LIBCPP_EXPORTED_FROM_ABI float strtof_l(const char*, char**, locale_t);
 _LIBCPP_EXPORTED_FROM_ABI long double strtold_l(const char*, char**, locale_t);
 #endif
-inline _LIBCPP_HIDE_FROM_ABI int
-islower_l(int __c, _locale_t __loc)
-{
- return _islower_l((int)__c, __loc);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI int
-isupper_l(int __c, _locale_t __loc)
-{
- return _isupper_l((int)__c, __loc);
-}
+inline _LIBCPP_HIDE_FROM_ABI int islower_l(int __c, _locale_t __loc) { return _islower_l((int)__c, __loc); }
+
+inline _LIBCPP_HIDE_FROM_ABI int isupper_l(int __c, _locale_t __loc) { return _isupper_l((int)__c, __loc); }
 
 #define isdigit_l _isdigit_l
 #define isxdigit_l _isxdigit_l
@@ -256,27 +220,20 @@ isupper_l(int __c, _locale_t __loc)
 #define towupper_l _towupper_l
 #define towlower_l _towlower_l
 #if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
-_LIBCPP_EXPORTED_FROM_ABI size_t strftime_l(char *ret, size_t n, const char *format,
-                                   const struct tm *tm, locale_t loc);
+_LIBCPP_EXPORTED_FROM_ABI size_t strftime_l(char* ret, size_t n, const char* format, const struct tm* tm, locale_t loc);
 #else
-#define strftime_l _strftime_l
+#  define strftime_l _strftime_l
 #endif
-#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
-_LIBCPP_EXPORTED_FROM_ABI int snprintf_l(char *__ret, size_t __n, locale_t __loc, const char *__format, ...);
-_LIBCPP_EXPORTED_FROM_ABI int asprintf_l( char **__ret, locale_t __loc, const char *__format, ... );
-_LIBCPP_EXPORTED_FROM_ABI int vasprintf_l( char **__ret, locale_t __loc, const char *__format, va_list __ap );
+#define sscanf_l(__s, __l, __f, ...) _sscanf_l(__s, __f, __l, __VA_ARGS__)
+#define sprintf_l(__s, __l, __f, ...) _sprintf_l(__s, __f, __l, __VA_ARGS__)
+#define vsprintf_l(__s, __l, __f, ...) _vsprintf_l(__s, __f, __l, __VA_ARGS__)
+#define vsnprintf_l(__s, __n, __l, __f, ...) _vsnprintf_l(__s, __n, __f, __l, __VA_ARGS__)
+_LIBCPP_EXPORTED_FROM_ABI int snprintf_l(char* __ret, size_t __n, locale_t __loc, const char* __format, ...);
+_LIBCPP_EXPORTED_FROM_ABI int asprintf_l(char** __ret, locale_t __loc, const char* __format, ...);
+_LIBCPP_EXPORTED_FROM_ABI int vasprintf_l(char** __ret, locale_t __loc, const char* __format, va_list __ap);
 
 // not-so-pressing FIXME: use locale to determine blank characters
-inline int isblank_l( int __c, locale_t /*loc*/ )
-{
-    return ( __c == ' ' || __c == '\t' );
-}
-inline int iswblank_l( wint_t __c, locale_t /*loc*/ )
-{
-    return ( __c == L' ' || __c == L'\t' );
-}
+inline int isblank_l(int __c, locale_t /*loc*/) { return (__c == ' ' || __c == '\t'); }
+inline int iswblank_l(wint_t __c, locale_t /*loc*/) { return (__c == L' ' || __c == L'\t'); }
 
 #endif // _LIBCPP___LOCALE_LOCALE_BASE_API_WIN32_H

``````````

</details>


https://github.com/llvm/llvm-project/pull/74522


More information about the libcxx-commits mailing list