From 5d5d751c7f93c5f524661efaa9ad9cd32fa39da6 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 16 Apr 2019 15:03:18 +1000 Subject: [PATCH] teach cppcheck that _assert_int_equal and _assert_int_not_equal don't return on failure --- lib/isc/include/isc/util.h | 4 ++++ lib/isc/tests/aes_test.c | 3 ++- lib/isc/tests/errno_test.c | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 53b31f1f74..4dfe1d77e4 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -219,6 +219,10 @@ extern void mock_assert(const int result, const char* const expression, (mock_assert(0, #expression, __FILE__, __LINE__), abort()) : (void)0) #define _assert_true(c, e, f, l) \ ((c) ? (void)0 : (_assert_true(0, e, f, l), abort())) +#define _assert_int_equal(a, b, f, l) \ + (((a) == (b)) ? (void)0 : (_assert_int_equal(a, b, f, l), abort())) +#define _assert_int_not_equal(a, b, f, l) \ + (((a) != (b)) ? (void)0 : (_assert_int_not_equal(a, b, f, l), abort())) #else /* UNIT_TESTING */ /* * Assertions diff --git a/lib/isc/tests/aes_test.c b/lib/isc/tests/aes_test.c index 9ead547faa..20795fee9f 100644 --- a/lib/isc/tests/aes_test.c +++ b/lib/isc/tests/aes_test.c @@ -11,9 +11,10 @@ #if HAVE_CMOCKA +#include #include #include -#include +#include #include #include diff --git a/lib/isc/tests/errno_test.c b/lib/isc/tests/errno_test.c index 1872f7dbdd..b17937e815 100644 --- a/lib/isc/tests/errno_test.c +++ b/lib/isc/tests/errno_test.c @@ -11,9 +11,10 @@ #if HAVE_CMOCKA +#include #include #include -#include +#include #include #include