|
|
@ -77,13 +77,19 @@ |
|
|
|
#define UPB_NORETURN |
|
|
|
#define UPB_NORETURN |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(WIN32) |
|
|
|
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L |
|
|
|
/* Windows versions */ |
|
|
|
/* 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(_MSC_VER) |
|
|
|
|
|
|
|
/* Microsoft C/C++ versions. */ |
|
|
|
#include <stdarg.h> |
|
|
|
#include <stdarg.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#if defined(_MSC_VER) && _MSC_VER < 1900 |
|
|
|
#if _MSC_VER < 1900 |
|
|
|
int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg); |
|
|
|
|
|
|
|
int msvc_snprintf(char* s, size_t n, const char* format, ...); |
|
|
|
int msvc_snprintf(char* s, size_t n, const char* format, ...); |
|
|
|
|
|
|
|
int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg); |
|
|
|
#define UPB_MSVC_VSNPRINTF |
|
|
|
#define UPB_MSVC_VSNPRINTF |
|
|
|
#define _upb_snprintf msvc_snprintf |
|
|
|
#define _upb_snprintf msvc_snprintf |
|
|
|
#define _upb_vsnprintf msvc_vsnprintf |
|
|
|
#define _upb_vsnprintf msvc_vsnprintf |
|
|
@ -92,13 +98,6 @@ int msvc_snprintf(char* s, size_t n, const char* format, ...); |
|
|
|
#define _upb_vsnprintf vsnprintf |
|
|
|
#define _upb_vsnprintf vsnprintf |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#define _upb_va_copy(a, b) va_copy(a, b) |
|
|
|
#define _upb_va_copy(a, b) va_copy(a, b) |
|
|
|
#else |
|
|
|
|
|
|
|
#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__ |
|
|
|
#elif defined __GNUC__ |
|
|
|
/* A few hacky workarounds for functions not in C89. |
|
|
|
/* A few hacky workarounds for functions not in C89. |
|
|
|
* For internal use only! |
|
|
|
* For internal use only! |
|
|
@ -111,7 +110,6 @@ int msvc_snprintf(char* s, size_t n, const char* format, ...); |
|
|
|
#else |
|
|
|
#else |
|
|
|
#error Need implementations of [v]snprintf and va_copy |
|
|
|
#error Need implementations of [v]snprintf and va_copy |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
#ifdef __cplusplus |
|
|
|
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || \ |
|
|
|
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || \ |
|
|
|