From 4a187ec527bddc7d6058eeb48ca533eb4ef1153a Mon Sep 17 00:00:00 2001 From: Zentaro Kavanagh Date: Mon, 11 Dec 2017 08:19:39 -0800 Subject: [PATCH] Add overloadable attributes for vsnprintf and snprintf - Adds overloadable attributes for clang. --- lib/libcompat.h | 12 ++++++++++-- lib/snprintf.c | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/libcompat.h b/lib/libcompat.h index 9ec6eb81..e29c132c 100644 --- a/lib/libcompat.h +++ b/lib/libcompat.h @@ -234,12 +234,20 @@ CK_DLL_EXP int timer_delete(timer_t timerid); #include #if !HAVE_VSNPRINTF -CK_DLL_EXP int rpl_vsnprintf(char *, size_t, const char *, va_list); +CK_DLL_EXP int +#if defined(__clang__) +__attribute__((overloadable)) +#endif +rpl_vsnprintf(char *, size_t, const char *, va_list); #define vsnprintf rpl_vsnprintf #endif #if !HAVE_SNPRINTF -CK_DLL_EXP int rpl_snprintf(char *, size_t, const char *, ...); +CK_DLL_EXP int +#if defined(__clang__) +__attribute__((overloadable)) +#endif +rpl_snprintf(char *, size_t, const char *, ...); #define snprintf rpl_snprintf #endif diff --git a/lib/snprintf.c b/lib/snprintf.c index b91b65c6..280d6dc0 100644 --- a/lib/snprintf.c +++ b/lib/snprintf.c @@ -487,6 +487,9 @@ static LDOUBLE mypow10(int); extern int errno; int +#if defined(__clang__) +__attribute__((overloadable)) +#endif rpl_vsnprintf(char *str, size_t size, const char *format, va_list args) { LDOUBLE fvalue; @@ -1452,6 +1455,9 @@ mypow10(int exponent) #if !HAVE_SNPRINTF #if HAVE_STDARG_H int +#if defined(__clang__) +__attribute__((overloadable)) +#endif rpl_snprintf(char *str, size_t size, const char *format, ...) #else int