include: Make statements evaluate boolean expressions

MISRA-C requires that the if statement has essentially Boolean type.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2019-03-08 14:56:56 -08:00 committed by Anas Nashif
commit 063a9ce8c3
11 changed files with 24 additions and 22 deletions

View file

@ -219,13 +219,13 @@ extern "C" {
.source_id = _id \
}; \
\
if (BIT(_level) & LOG_FUNCTION_PREFIX_MASK) { \
if ((BIT(_level) & LOG_FUNCTION_PREFIX_MASK) != 0) {\
__LOG_INTERNAL(src_level, \
Z_LOG_STR(__VA_ARGS__)); \
} else { \
__LOG_INTERNAL(src_level, __VA_ARGS__); \
} \
} else if (0) { \
} else if (false) { \
/* Arguments checker present but never evaluated.*/ \
/* Placed here to ensure that __VA_ARGS__ are*/ \
/* evaluated once when log is enabled.*/ \