[libcxx-commits] [libcxx] [libcxx] Provide locale conversions to tests through lit substitution (PR #105651)
Rodrigo Salazar via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 6 13:43:25 PST 2024
================
@@ -80,6 +49,12 @@ std::wstring negate_en_US(std::wstring s) {
#endif
}
+wchar_t thousands_sep_or_default(std::wstring s) { return !s.empty() ? s[0] : L','; }
----------------
4-rodrigo-salazar wrote:
Thanks @mstorsjo for taking over the PR and making progress on it!
Right, localeconv's struct has `currency_symbol` which could in practice be more than 1 char, so to allow `provide_locale_conversions` substitution code in features.py to be flexible enough it just sets the substitutions as strings.
The defaults ("," and ".") in the `thousands_sep_or_default` helper function won't actually be used as we are only calling these from tests where the locale is set to fr_FR or ru_RU and we've set the defines.
I think it's reasonable for these helpers to assert that the input is not empty and always take the first char. The functions should probably be renamed to something more appropriate though if they're essentially just converting to a wchar_t.
https://github.com/llvm/llvm-project/pull/105651
More information about the libcxx-commits
mailing list