summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/windows
diff options
context:
space:
mode:
authorChaoren Lin <chaorenl@google.com>2015-08-20 20:53:15 +0000
committerChaoren Lin <chaorenl@google.com>2015-08-20 20:53:15 +0000
commitee3c2060216a94e392584460671531148b74afdb (patch)
tree104397c4f948ffc4ca1e4f28965ebd037186a42a /lldb/source/Host/windows
parent419bb33b0b23a925270296e8a58ca3c0b38baa69 (diff)
downloadbcm5719-llvm-ee3c2060216a94e392584460671531148b74afdb.tar.gz
bcm5719-llvm-ee3c2060216a94e392584460671531148b74afdb.zip
Inline fake snprintf to avoid linkage issues on Windows.
Summary: dllexport doesn't work if linking against a static library with its own copy of snprintf. Reviewers: zturner Subscribers: zturner, lldb-commits Differential Revision: http://reviews.llvm.org/D12206 llvm-svn: 245610
Diffstat (limited to 'lldb/source/Host/windows')
-rw-r--r--lldb/source/Host/windows/Windows.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lldb/source/Host/windows/Windows.cpp b/lldb/source/Host/windows/Windows.cpp
index cd2cfc96b71..71bff7a9d2e 100644
--- a/lldb/source/Host/windows/Windows.cpp
+++ b/lldb/source/Host/windows/Windows.cpp
@@ -203,18 +203,17 @@ int usleep(uint32_t useconds)
}
#if _MSC_VER < 1900
-int snprintf(char *buffer, size_t count, const char *format, ...)
+namespace lldb_private {
+int vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
{
int old_errno = errno;
- va_list argptr;
- va_start(argptr, format);
- int r = vsnprintf(buffer, count, format, argptr);
+ int r = ::vsnprintf(buffer, count, format, argptr);
int new_errno = errno;
buffer[count-1] = '\0';
if (r == -1 || r == count)
{
FILE *nul = fopen("nul", "w");
- int bytes_written = vfprintf(nul, format, argptr);
+ int bytes_written = ::vfprintf(nul, format, argptr);
fclose(nul);
if (bytes_written < count)
errno = new_errno;
@@ -224,9 +223,9 @@ int snprintf(char *buffer, size_t count, const char *format, ...)
r = bytes_written;
}
}
- va_end(argptr);
return r;
}
+} // namespace lldb_private
#endif
#endif // _MSC_VER
OpenPOWER on IntegriCloud