From 34b51e26555d05c00b2320f943a645added5dae4 Mon Sep 17 00:00:00 2001 From: Helmut Schaa Date: Mon, 9 Dec 2013 14:15:11 +0100 Subject: [PATCH 5/6] lib/util.h: Disable ovs_assert when build with NDEBUG Reduces binary size. Use a static inline function instead of a macro to not get "unused variable" warning everywhere. Signed-off-by: Helmut Schaa --- lib/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/util.h b/lib/util.h index 5c23962..9e5866d 100644 --- a/lib/util.h +++ b/lib/util.h @@ -69,10 +69,15 @@ * - Writes the failure message to the log. * * - Not affected by NDEBUG. */ +#ifndef NDEBUG #define ovs_assert(CONDITION) \ if (!OVS_LIKELY(CONDITION)) { \ ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION); \ } +#else +static inline void ovs_assert(bool cond OVS_UNUSED) {} +#endif + void ovs_assert_failure(const char *, const char *, const char *) NO_RETURN; /* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes -- 1.8.1.4