Attention is currently required from: fixeria. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/27047 )
Change subject: core/utils.h: make use of OSMO_LIKELY in OSMO_ASSERT ......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
So the linter suggests the following: […]
I guess you could use the do - while loop, and add a semicolon at the end for compatibility:
#define OSMO_ASSERT(exp) \ do { \ if (!OSMO_LIKELY(exp)) { \ osmo_panic("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ } \ } while (0);
IMHO this check is really useful in other cases (not here, because the whole macro is inside an if, thus it shouldn't lead to if-else logic defects as described here https://stackoverflow.com/a/9496007).