diff options
author | 2012-09-24 06:48:20 +0000 | |
---|---|---|
committer | 2012-09-24 06:48:20 +0000 | |
commit | fcb8a50b5017673a90dd9d7eef9999a101151c30 (patch) | |
tree | 8bc7283f6bdbde32d600eb707d41be7ef742db4e /src/google/protobuf/stubs | |
parent | b55a20fa2c669b181f47ea9219b8e74d1263da19 (diff) |
Update MSVC project files and fix compilation issues in MSVC.
Diffstat (limited to 'src/google/protobuf/stubs')
-rw-r--r-- | src/google/protobuf/stubs/stringprintf.cc | 5 | ||||
-rw-r--r-- | src/google/protobuf/stubs/stringprintf_unittest.cc | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/google/protobuf/stubs/stringprintf.cc b/src/google/protobuf/stubs/stringprintf.cc index d66a497a..4a5b8582 100644 --- a/src/google/protobuf/stubs/stringprintf.cc +++ b/src/google/protobuf/stubs/stringprintf.cc @@ -44,6 +44,11 @@ namespace protobuf { #ifdef _MSC_VER enum { IS_COMPILER_MSVC = 1 }; +#ifndef va_copy +// Define va_copy for MSVC. This is a hack, assuming va_list is simply a +// pointer into the stack and is safe to copy. +#define va_copy(dest, src) ((dest) = (src)) +#endif #else enum { IS_COMPILER_MSVC = 0 }; #endif diff --git a/src/google/protobuf/stubs/stringprintf_unittest.cc b/src/google/protobuf/stubs/stringprintf_unittest.cc index 5cf7fffc..a78a2027 100644 --- a/src/google/protobuf/stubs/stringprintf_unittest.cc +++ b/src/google/protobuf/stubs/stringprintf_unittest.cc @@ -55,9 +55,9 @@ TEST(StringPrintfTest, Empty) { TEST(StringPrintfTest, Misc) { // MSVC does not support $ format specifier. -#if !defined(COMPILER_MSVC) +#if !defined(_MSC_VER) EXPECT_EQ("123hello w", StringPrintf("%3$d%2$s %1$c", 'w', "hello", 123)); -#endif // !COMPILER_MSVC +#endif // !_MSC_VER } TEST(StringAppendFTest, Empty) { |