[libcxx-commits] [libcxx] [libc++] Use proper functions instead of macros in bsd_locale_defaults.h (PR #113759)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 31 06:12:05 PDT 2024


================
@@ -46,7 +54,7 @@ size_t __libcpp_mbsnrtowcs_l(wchar_t* dest, const char** src, size_t max_out, si
 size_t __libcpp_mbrtowc_l(wchar_t* dest, cosnt char* src, size_t count, mbstate_t*, locale_t);
 int __libcpp_mbtowc_l(wchar_t* dest, const char* src, size_t count, locale_t);
 size_t __libcpp_mbrlen_l(const char* str, size_t count, mbstate_t*, locale_t);
-lconv* __libcpp_localeconv_l(locale_t);
+lconv* __libcpp_localeconv_l(locale_t&);
----------------
ldionne wrote:

This is really tricky, but on Windows the `locale_t` defined in `win32.h` can't be copied. Well, I guess you can copy it, but if you do, it crashes later on. The existing code didn't run into issues because it used a macro, but after moving to a function that took `locale_t` by value, I noticed the windows bots failing. After much head scratching, I narrowed it down to that.

I don't view this as a final state -- I'd much rather fix the win32 `locale_t` to make it properly copyable. But that's something that will be easier once the locale base API is defined in a less tortuous way.

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


More information about the libcxx-commits mailing list