Reduces binary size. Use a static inline function instead of a macro to not get "unused variable" warnings everywhere.
Making ovs_assert an empty inline in the header file effectively optimizes out all calls to ovs_assert. Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com> --- lib/util.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/util.h b/lib/util.h index 975d1a9..cc70f0e 100644 --- a/lib/util.h +++ b/lib/util.h @@ -68,11 +68,16 @@ * * - Writes the failure message to the log. * - * - Not affected by NDEBUG. */ + * - Gets optimized out 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 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev