Commit 03bebcb0 authored by Andreas Schuh's avatar Andreas Schuh

Merge pull request #129 from Nazg-Gul/master

Resolve some compiler warnings
parents 9db82895 366e9d33
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
// 5b) Trim most flag's descriptions to fit on a single terminal line // 5b) Trim most flag's descriptions to fit on a single terminal line
#include "gflags_completions.h"
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
// These call the windows _vsnprintf, but always NUL-terminate. // These call the windows _vsnprintf, but always NUL-terminate.
#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ #if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) # pragma warning(push)
...@@ -59,8 +60,6 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { ...@@ -59,8 +60,6 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
# pragma warning(pop) # pragma warning(pop)
#endif #endif
#if _MSC_VER < 1900 // msvs 2015 finally includes snprintf
int snprintf(char *str, size_t size, const char *format, ...) { int snprintf(char *str, size_t size, const char *format, ...) {
int r; int r;
va_list ap; va_list ap;
...@@ -70,6 +69,5 @@ int snprintf(char *str, size_t size, const char *format, ...) { ...@@ -70,6 +69,5 @@ int snprintf(char *str, size_t size, const char *format, ...) {
return r; return r;
} }
#endif #endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */
#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ #endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
...@@ -63,12 +63,14 @@ ...@@ -63,12 +63,14 @@
* name vsnprintf, since windows defines that (but not snprintf (!)). * name vsnprintf, since windows defines that (but not snprintf (!)).
*/ */
#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ #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, extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
const char *format, ...); const char *format, ...);
extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size, extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap); const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) #define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
#define va_copy(dst, src) (dst) = (src) #define va_copy(dst, src) (dst) = (src)
#endif
#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ #endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
#ifdef _MSC_VER #ifdef _MSC_VER
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
DECLARE_string(message); // in gflags_delcare_test.cc DECLARE_string(message); // in gflags_delcare_test.cc
void print_message();
void print_message() void print_message()
{ {
std::cout << FLAGS_message << std::endl; std::cout << FLAGS_message << std::endl;
......
...@@ -1485,7 +1485,7 @@ TEST(FlagsValidator, FlagSaver) { ...@@ -1485,7 +1485,7 @@ TEST(FlagsValidator, FlagSaver) {
} // unnamed namespace } // unnamed namespace
int main(int argc, char **argv) { static int main(int argc, char **argv) {
// Run unit tests only if called without arguments, otherwise this program // Run unit tests only if called without arguments, otherwise this program
// is used by an "external" usage test // is used by an "external" usage test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment