From 4e284b637943980a405a8c44f2712b749ded428f Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 23 Jun 2019 01:53:43 +0200 Subject: utils.h: require a semi colon after OSMO_ASSERT When using `OSMO_ASSERT(exp);` clang will warn about an empty expression because the semi colon was superflous. Use do {} while (0) to enfore the need of a semi colon. This might break other test. Change-Id: I2272d29a81496164bebd1696a694383a28a86434 --- include/osmocom/core/utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/osmocom') diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 601bb565..8585a6a9 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -98,9 +98,9 @@ do { \ * the predicate evaluates to false (0). */ #define OSMO_ASSERT(exp) \ - if (!(exp)) { \ + do if (!(exp)) { \ osmo_panic("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ - } + } while(0) /*! duplicate a string using talloc and release its prior content (if any) * \param[in] ctx Talloc context to use for allocation -- cgit v1.2.3