From: Mark Andrews Date: Thu, 30 Jan 2020 06:14:42 +0000 (+1100) Subject: simplify RUNTIME_CHECK for cppcheck X-Git-Tag: v9.16.0~34^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=668a972d1e71ccc7282601906dff4bc4bb3a7d1c;p=thirdparty%2Fbind9.git simplify RUNTIME_CHECK for cppcheck --- diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index c4a872cba7c..20f107b8c62 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -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 */