From 1274874e904ca3f31db1476aefa80ce1b38beb78 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 19 Aug 2016 08:12:50 +0200 Subject: [PATCH] ccutil: Fix and simplify implementation of variadic macro The implementation for MS C did not pass the variable arguments to tprintf. The standard is supported since C99 / C++11, so one implementation is sufficient. Signed-off-by: Stefan Weil --- ccutil/errcode.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ccutil/errcode.h b/ccutil/errcode.h index 69d4187a37..d690240036 100644 --- a/ccutil/errcode.h +++ b/ccutil/errcode.h @@ -87,21 +87,12 @@ const ERRCODE ASSERT_FAILED = "Assert failed"; __FILE__, __LINE__); \ } -#ifdef _MSC_VER -#define ASSERT_HOST_MSG(x, msg, ...) if (!(x)) \ +#define ASSERT_HOST_MSG(x, ...) if (!(x)) \ { \ - tprintf(msg); \ + tprintf(__VA_ARGS__); \ ASSERT_FAILED.error(#x, ABORT, "in file %s, line %d", \ __FILE__, __LINE__); \ } -#else -#define ASSERT_HOST_MSG(x, msg...) if (!(x)) \ - { \ - tprintf(msg); \ - ASSERT_FAILED.error(#x, ABORT, "in file %s, line %d", \ - __FILE__, __LINE__); \ - } -#endif void signal_exit(int signal_code);