From dbb66306c4cece4f5931553d3a9ad8251c9b250e Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 4 Nov 2011 20:03:11 +1300 Subject: [PATCH] Portability: add cstdarg as source of var_arg when available --- compat/stdvarargs.h | 17 ++++++++++++----- configure.ac | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/compat/stdvarargs.h b/compat/stdvarargs.h index 60b5bad990..dc8f6c182b 100644 --- a/compat/stdvarargs.h +++ b/compat/stdvarargs.h @@ -3,28 +3,35 @@ /* * va_* variables come from various places on different platforms. - * We provide a clean set of wrappers for the variosu operations + * We provide a clean set of wrappers for the various operations * Depending on what is available and needed. */ -#if defined(HAVE_STDARG_H) +#if HAVE_CSTDARG && defined(__cplusplus) +#include + +#else +#if HAVE_STDARG_H #include #define HAVE_STDARGS /* let's hope that works everywhere (mj) */ #define VA_LOCAL_DECL va_list ap; #define VA_START(f) va_start(ap, f) #define VA_SHIFT(v,t) ; /* no-op for ANSI */ #define VA_END va_end(ap) + #else -#if defined(HAVE_VARARGS_H) +#if HAVE_VARARGS_H #include #undef HAVE_STDARGS #define VA_LOCAL_DECL va_list ap; #define VA_START(f) va_start(ap) /* f is ignored! */ #define VA_SHIFT(v,t) v = va_arg(ap,t) #define VA_END va_end(ap) + #else #error XX **NO VARARGS ** XX -#endif -#endif +#endif /* HAVE_VARARGS_H */ +#endif /* HAVE_STDARG_H */ +#endif /* HAVE_CSTDARG */ /* Make sure syslog goes after stdarg/varargs */ #if HAVE_SYSLOG_H diff --git a/configure.ac b/configure.ac index f639126b01..97d4ab2652 100644 --- a/configure.ac +++ b/configure.ac @@ -2294,6 +2294,7 @@ AC_CHECK_HEADERS( \ bstring.h \ cassert \ crypt.h \ + cstdarg \ cstdlib \ cstring \ list \ -- 2.47.3