mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 03:25:54 -04:00
[libcxx] [Windows] Make a more proper implementation of strftime_l for mingw with msvcrt.dll
This also makes this function consistent with the rest of the libc++ provided fallbacks. The locale support in msvcrt.dll is very limited anyway; it can only be configured processwide, not per thread, and it only seems to support the locales "C" and "" (the user set locale), so it's hard to make any meaningful automatic test for it. But manually tested, this change does make time formatting locale code in libc++ output times in the user requested format, when using locale "". Differential Revision: https://reviews.llvm.org/D69554
This commit is contained in:
parent
26d96126a0
commit
337e435964
@ -173,7 +173,8 @@ isupper_l(int c, _locale_t loc)
|
|||||||
#define towupper_l _towupper_l
|
#define towupper_l _towupper_l
|
||||||
#define towlower_l _towlower_l
|
#define towlower_l _towlower_l
|
||||||
#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
|
#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
|
||||||
#define strftime_l( __s, __l, __f, __tm, __loc ) strftime( __s, __l, __f, __tm )
|
_LIBCPP_FUNC_VIS size_t strftime_l(char *ret, size_t n, const char *format,
|
||||||
|
const struct tm *tm, locale_t loc);
|
||||||
#else
|
#else
|
||||||
#define strftime_l _strftime_l
|
#define strftime_l _strftime_l
|
||||||
#endif
|
#endif
|
||||||
|
@ -127,3 +127,11 @@ long double strtold_l(const char* nptr, char** endptr, locale_t loc) {
|
|||||||
return strtold(nptr, endptr);
|
return strtold(nptr, endptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
|
||||||
|
size_t strftime_l(char *ret, size_t n, const char *format, const struct tm *tm,
|
||||||
|
locale_t loc) {
|
||||||
|
__libcpp_locale_guard __current(loc);
|
||||||
|
return strftime(ret, n, format, tm);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user