aboutsummaryrefslogtreecommitdiff
path: root/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch
blob: d099ea61673364d5d13b695176bef121487c9c12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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