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 <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2019-04-18 15:56:52 -04:00
parent c5a80cc488
commit cf24b46a58

2
env/posix/ocf_env.h vendored
View File

@ -67,7 +67,7 @@ typedef uint64_t sector_t;
#define ENV_WARN_ONCE(cond, fmt...) ENV_WARN(cond, fmt) #define ENV_WARN_ONCE(cond, fmt...) ENV_WARN(cond, fmt)
#define ENV_BUG() assert(0) #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 *** */ /* *** MEMORY MANAGEMENT *** */
#define ENV_MEM_NORMAL 0 #define ENV_MEM_NORMAL 0