mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-03 13:09:06 +08:00
52 lines
1.9 KiB
Diff
52 lines
1.9 KiB
Diff
From 5af642bdfe023a7c857d1d26593af586516bf696 Mon Sep 17 00:00:00 2001
|
|
From: Sergey Sharybin <sergey.vfx@gmail.com>
|
|
Date: Thu, 31 Dec 2015 17:16:26 +0500
|
|
Subject: [PATCH] Fix some compilation warnings with MSVC 2015
|
|
|
|
MSVC 2015 already defines vsnprintf() and va_copy().
|
|
---
|
|
src/windows_port.cc | 2 ++
|
|
src/windows_port.h | 2 ++
|
|
2 files changed, 4 insertions(+)
|
|
|
|
diff --git a/src/windows_port.cc b/src/windows_port.cc
|
|
index 1f40458..b5b7194 100644
|
|
--- a/src/windows_port.cc
|
|
+++ b/src/windows_port.cc
|
|
@@ -44,6 +44,7 @@
|
|
|
|
// These call the windows _vsnprintf, but always NUL-terminate.
|
|
#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
|
|
+#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */
|
|
|
|
#ifdef _MSC_VER
|
|
# pragma warning(push)
|
|
@@ -68,4 +69,5 @@ int snprintf(char *str, size_t size, const char *format, ...) {
|
|
return r;
|
|
}
|
|
|
|
+#endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */
|
|
#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
|
|
diff --git a/src/windows_port.h b/src/windows_port.h
|
|
index c8ff24f..554b9c9 100644
|
|
--- a/src/windows_port.h
|
|
+++ b/src/windows_port.h
|
|
@@ -63,12 +63,14 @@
|
|
* name vsnprintf, since windows defines that (but not snprintf (!)).
|
|
*/
|
|
#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
|
|
+#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */
|
|
extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
|
|
const char *format, ...);
|
|
extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size,
|
|
const char *format, va_list ap);
|
|
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
|
|
#define va_copy(dst, src) (dst) = (src)
|
|
+#endif
|
|
#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
|
|
|
|
#ifdef _MSC_VER
|
|
--
|
|
2.10.0.windows.1
|
|
|