aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-01-04 08:02:53 +0100
committerTom Rini <trini@konsulko.com>2021-01-16 12:11:43 -0500
commit694237df5ed1606fa2b9969217d196c984e7f90d (patch)
tree1f70fca957fee0293df14666bef48a2c0f66b39d
parente9f5740d5d2501f7929e1c21b06b5bd3a54940fc (diff)
downloadu-boot-694237df5ed1606fa2b9969217d196c984e7f90d.zip
u-boot-694237df5ed1606fa2b9969217d196c984e7f90d.tar.gz
u-boot-694237df5ed1606fa2b9969217d196c984e7f90d.tar.bz2
log: make debug_cond() function like
Change debug_cond() such that it can be used instead of a function like debug(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--include/log.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/include/log.h b/include/log.h
index 6bce560..40ab551 100644
--- a/include/log.h
+++ b/include/log.h
@@ -217,10 +217,9 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
#if !_DEBUG && CONFIG_IS_ENABLED(LOG)
#define debug_cond(cond, fmt, args...) \
- do { \
- if (1) \
- log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
- } while (0)
+({ \
+ log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
+})
#else /* _DEBUG */
@@ -229,11 +228,11 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
* computed by a preprocessor in the best case, allowing for the best
* optimization.
*/
-#define debug_cond(cond, fmt, args...) \
- do { \
- if (cond) \
- printf(pr_fmt(fmt), ##args); \
- } while (0)
+#define debug_cond(cond, fmt, args...) \
+({ \
+ if (cond) \
+ printf(pr_fmt(fmt), ##args); \
+})
#endif /* _DEBUG */