Skip to content

Commit

Permalink
ccutil: Fix and simplify implementation of variadic macro
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
stweil committed Aug 29, 2016
1 parent b000dd2 commit 1274874
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ccutil/errcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1274874

Please sign in to comment.