[libcxx-commits] [PATCH] D69554: [libcxx] [Windows] Make a more proper implementation of strftime_l for mingw with msvcrt.dll

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 29 02:41:39 PDT 2019


mstorsjo created this revision.
mstorsjo added reviewers: rnk, pcc, thomasanderson, EricWF.
Herald added subscribers: ldionne, christof.

See D37468 <https://reviews.llvm.org/D37468> for original case when this specific fallback was added.


Repository:
  rCXX libc++

https://reviews.llvm.org/D69554

Files:
  libcxx/include/support/win32/locale_win32.h
  libcxx/src/support/win32/locale_win32.cpp


Index: libcxx/src/support/win32/locale_win32.cpp
===================================================================
--- libcxx/src/support/win32/locale_win32.cpp
+++ libcxx/src/support/win32/locale_win32.cpp
@@ -129,3 +129,11 @@
   return strtold(nptr, endptr);
 }
 #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
Index: libcxx/include/support/win32/locale_win32.h
===================================================================
--- libcxx/include/support/win32/locale_win32.h
+++ libcxx/include/support/win32/locale_win32.h
@@ -238,7 +238,8 @@
 #define towupper_l _towupper_l
 #define towlower_l _towlower_l
 #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
 #define strftime_l _strftime_l
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69554.226858.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191029/69c47b4e/attachment.bin>


More information about the libcxx-commits mailing list