From a6993ab758dcbbb783cd120191efc881cde38765 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 5 Apr 2023 22:22:01 +0200 Subject: [PATCH] Overload assert in coverage mode to avoid polluting the report with untaken branch by the assert macro. --- tests/coverage.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/coverage.h b/tests/coverage.h index 6e6b9c3f..622212b5 100644 --- a/tests/coverage.h +++ b/tests/coverage.h @@ -150,6 +150,14 @@ #undef M_CHECK_DEFAULT_TYPE #undef M_CHECK_SAME #undef isspace +#elif defined(BUILD_COVERAGE) +// Overload assert to avoid polluting final branch coverage +// No need to provide debug outputs. Just abort in case of error. +#undef assert +static void assert(int cond) +{ + if (!cond) abort(); +} #else /* For normal builds, empty macros which does nothing */ #define START_COVERAGE