From ebbc3f14febbf0152c4d98dac9abecc898dfae08 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 5 Jun 2018 17:50:45 -0400 Subject: [PATCH] BT_ASSERT_PRE(): when disabled, use the expression anyway Apply to the BT_ASSERT_PRE() macro (and its derivatives) the same trick used for BT_ASSERT() to use the condition without evaluating it when the macro is disabled. This avoids unused variable compiler warnings in a production build. Signed-off-by: Philippe Proulx --- include/babeltrace/assert-pre-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/babeltrace/assert-pre-internal.h b/include/babeltrace/assert-pre-internal.h index 58364736..74a8b9e2 100644 --- a/include/babeltrace/assert-pre-internal.h +++ b/include/babeltrace/assert-pre-internal.h @@ -98,7 +98,7 @@ */ # define BT_ASSERT_PRE_MSG BT_LIB_LOGF #else -# define BT_ASSERT_PRE(_cond, _fmt, ...) +# define BT_ASSERT_PRE(_cond, _fmt, ...) ((void) sizeof((void) (_cond), 0)) # define BT_ASSERT_PRE_FUNC BT_UNUSED # define BT_ASSERT_PRE_MSG(_fmt, ...) #endif /* BT_DEV_MODE */ -- 2.34.1