From cf24b46a58d1dbe7026befcf44916c4fe1988714 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Thu, 18 Apr 2019 15:56:52 -0400 Subject: [PATCH] posix env: evaluate ENV_BUG_ON condition unconditionally OCF depends on ENV_BUG_ON condition to be evaluated as it may have side effects. So simple implementation with "assert(!cond)" is not good enough as it will likely be noop in release build. Signed-off-by: Adam Rutkowski --- env/posix/ocf_env.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/posix/ocf_env.h b/env/posix/ocf_env.h index 603750a..83d0758 100644 --- a/env/posix/ocf_env.h +++ b/env/posix/ocf_env.h @@ -67,7 +67,7 @@ typedef uint64_t sector_t; #define ENV_WARN_ONCE(cond, fmt...) ENV_WARN(cond, fmt) #define ENV_BUG() assert(0) -#define ENV_BUG_ON(cond) assert(!(cond)) +#define ENV_BUG_ON(cond) do { if (cond) ENV_BUG(); } while (0) /* *** MEMORY MANAGEMENT *** */ #define ENV_MEM_NORMAL 0