diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2016-11-14 10:15:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-14 10:15:04 -0800 |
commit | 9a91f7bba8c89ed4d1cb0d56b8a394a9590df029 (patch) | |
tree | ccd6d8c365c9c8d8bb9192770dc7c23a465557a1 | |
parent | 77c97fd3f29caa5c243294b5f4e6763b3ed3c36f (diff) | |
parent | 1b4fc46f87636ac3b9d6a8690acaa7e1537a0977 (diff) |
Merge pull request #73 from apstndb/fix-va-copy
Fix musl libc incompatibility
-rw-r--r-- | tests/pb/test_decoder.cc | 2 | ||||
-rw-r--r-- | upb/upb.h | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/tests/pb/test_decoder.cc b/tests/pb/test_decoder.cc index d272ea5..49544b2 100644 --- a/tests/pb/test_decoder.cc +++ b/tests/pb/test_decoder.cc @@ -111,7 +111,7 @@ using std::string; void vappendf(string* str, const char *format, va_list args) { va_list copy; - __va_copy(copy, args); + _upb_va_copy(copy, args); int count = vsnprintf(NULL, 0, format, args); if (count >= 0) @@ -51,20 +51,21 @@ template <int N> class InlinedEnvironment; #define UPB_NORETURN #endif +#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L +/* C99/C++11 versions. */ +#include <stdio.h> +#define _upb_snprintf snprintf +#define _upb_vsnprintf vsnprintf +#define _upb_va_copy(a, b) va_copy(a, b) +#elif defined __GNUC__ /* A few hacky workarounds for functions not in C89. * For internal use only! * TODO(haberman): fix these by including our own implementations, or finding * another workaround. */ -#ifdef __GNUC__ #define _upb_snprintf __builtin_snprintf #define _upb_vsnprintf __builtin_vsnprintf #define _upb_va_copy(a, b) __va_copy(a, b) -#elif __STDC_VERSION__ >= 199901L -/* C99 versions. */ -#define _upb_snprintf snprintf -#define _upb_vsnprintf vsnprintf -#define _upb_va_copy(a, b) va_copy(a, b) #else #error Need implementations of [v]snprintf and va_copy #endif |