[Lldb-commits] [lldb] r372591 - [LLDB] Remove a now redundant windows specific workaround

Martin Storsjo via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 23 05:03:33 PDT 2019

Author: mstorsjo
Date: Mon Sep 23 05:03:33 2019
New Revision: 372591

URL: http://llvm.org/viewvc/llvm-project?rev=372591&view=rev
[LLDB] Remove a now redundant windows specific workaround

vsnprintf(NULL, 0, ...) works for measuring the needed string
size on all supported Windows variants; it's supported since
at least MSVC 2015 (and LLVM requires a newer version than that),
and works on both msvcrt.dll (since at least XP) and UCRT with MinGW.

The previous use of ifdefs was wrong as well, as __MINGW64__ only is
defined for 64 bit targets, and the define without trailing
underscores is never defined automatically (neither by clang nor
by gcc).

Differential Revision: https://reviews.llvm.org/D67861


Modified: lldb/trunk/source/Host/windows/Windows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Windows.cpp?rev=372591&r1=372590&r2=372591&view=diff
--- lldb/trunk/source/Host/windows/Windows.cpp (original)
+++ lldb/trunk/source/Host/windows/Windows.cpp Mon Sep 23 05:03:33 2019
@@ -48,13 +48,8 @@ int vasprintf(char **ret, const char *fm
   size_t buflen;
   va_list ap2;
-#if defined(_MSC_VER) || defined(__MINGW64)
-  ap2 = ap;
-  len = _vscprintf(fmt, ap2);
   va_copy(ap2, ap);
   len = vsnprintf(NULL, 0, fmt, ap2);
   if (len >= 0 &&
       (buf = (char *)malloc((buflen = (size_t)(len + 1)))) != NULL) {

More information about the lldb-commits mailing list