[libcxx-commits] [PATCH] D59727: [libc++] Fix return value of snprintf_l() on Windows when buffer is too small

Shoaib Meenai via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 26 12:43:05 PDT 2019


smeenai added a comment.

In D59727#1442687 <https://reviews.llvm.org/D59727#1442687>, @mstorsjo wrote:

> FWIW, this will break mingw builds that use the old msvcrt.dll. Since a couple years, mingw-w64 also supports the UCRT, but this is not the default configuration upstream yet (while it is in my own builds).


This is guarded by _LIBCPP_MSVCRT, which shouldn't be defined for MinGW.



================
Comment at: src/support/win32/locale_win32.cpp:92
     va_start( ap, format );
-#if defined(_LIBCPP_MSVCRT)
-    int result = _vsnprintf_l( ret, n, format, loc, ap );
+#if defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
+    // FIXME: Remove usage of internal CRT function and globals.
----------------
>From `__config`:

```
#  if defined(_MSC_VER) && !defined(__MINGW32__)
#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
#  endif
```

So checking for `!defined(__MINGW32__)` here is redundant.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59727/new/

https://reviews.llvm.org/D59727





More information about the libcxx-commits mailing list