diff options
author | HATATANI Shinta <gamaguchi@gmail.com> | 2016-11-13 13:17:32 +0900 |
---|---|---|
committer | HATATANI Shinta <gamaguchi@gmail.com> | 2016-11-13 13:17:32 +0900 |
commit | 5211caac97d47417ec0d1b127e50c9d6d997229c (patch) | |
tree | c9a45f71c6e7c865bc9ca6c0b23b8c02c650dc03 /upb/upb.h | |
parent | 77c97fd3f29caa5c243294b5f4e6763b3ed3c36f (diff) |
Make upb compatible with musl libc
Diffstat (limited to 'upb/upb.h')
-rw-r--r-- | upb/upb.h | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -51,20 +51,21 @@ template <int N> class InlinedEnvironment; #define UPB_NORETURN #endif +#if __STDC_VERSION__ >= 199901L +/* C99 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 |