From 5211caac97d47417ec0d1b127e50c9d6d997229c Mon Sep 17 00:00:00 2001 From: HATATANI Shinta Date: Sun, 13 Nov 2016 13:17:32 +0900 Subject: Make upb compatible with musl libc --- upb/upb.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'upb/upb.h') diff --git a/upb/upb.h b/upb/upb.h index 6c7a627..20baaad 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -51,20 +51,21 @@ template class InlinedEnvironment; #define UPB_NORETURN #endif +#if __STDC_VERSION__ >= 199901L +/* C99 versions. */ +#include +#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 -- cgit v1.2.3 From 35e174bf0e83aa199a062db960cd14236ca67c0d Mon Sep 17 00:00:00 2001 From: HATATANI Shinta Date: Sun, 13 Nov 2016 13:41:54 +0900 Subject: Fix C++11 incompatibility --- upb/upb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'upb/upb.h') diff --git a/upb/upb.h b/upb/upb.h index 20baaad..46bed8a 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -51,8 +51,8 @@ template class InlinedEnvironment; #define UPB_NORETURN #endif -#if __STDC_VERSION__ >= 199901L -/* C99 versions. */ +#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L +/* C99/C++11 versions. */ #include #define _upb_snprintf snprintf #define _upb_vsnprintf vsnprintf -- cgit v1.2.3