simplify RUNTIME_CHECK for cppcheck

This commit is contained in:
Mark Andrews 2020-01-30 17:14:42 +11:00 committed by Ondřej Surý
parent dfd96e1aa5
commit 668a972d1e

View file

@ -285,12 +285,17 @@ extern void mock_assert(const int result, const char* const expression,
#ifdef UNIT_TESTING
#define RUNTIME_CHECK(expression) \
mock_assert((int)(expression), #expression, __FILE__, __LINE__)
((!(expression)) ? \
(mock_assert(0, #expression, __FILE__, __LINE__), abort()) : (void)0)
#else /* UNIT_TESTING */
#ifndef CPPCHECK
/*% Runtime Check */
#define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond)
#else
#define RUNTIME_CHECK(e) if (!(e)) abort()
#endif
#endif /* UNIT_TESTING */