Add check for va_copy
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/25e6ff33 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/25e6ff33 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/25e6ff33 Branch: refs/heads/master Commit: 25e6ff33d3df646d1bf5adc887b8bd5cd6f59023 Parents: 82ad289 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Sat Mar 5 19:54:54 2016 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Sat Mar 5 19:54:54 2016 +0100 ---------------------------------------------------------------------- compiler/src/CFCUtil.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/25e6ff33/compiler/src/CFCUtil.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c index a2a0993..7470c04 100644 --- a/compiler/src/CFCUtil.c +++ b/compiler/src/CFCUtil.c @@ -30,6 +30,17 @@ #include <direct.h> #endif +#if !defined(CHY_HAS_C99_SNPRINTF) && !defined(CHY_HAS__SCPRINTF) + #error "snprintf or replacement not available." +#endif + +/* va_copy is not part of C89. Assume that simple assignment works if it + * isn't defined. + */ +#ifndef va_copy + #define va_copy(dst, src) ((dst) = (src)) +#endif + #ifndef true #define true 1 #define false 0 @@ -74,10 +85,6 @@ CFCUtil_sprintf(const char *fmt, ...) { return string; } -#if !defined(CHY_HAS_C99_SNPRINTF) && !defined(CHY_HAS__SCPRINTF) - #error "snprintf or replacement not available." -#endif - char* CFCUtil_vsprintf(const char *fmt, va_list args) { va_list args_copy;