tools: Fix debug() to avoid unused-variable warnings

The debug() macro in mkimage.h expands to nothing when MKIMAGE_DEBUG
is not defined. This causes the compiler to warn about unused variables
that are only referenced in debug() statements.

Fix this using the same approach as the debug_cond() macro.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-11-18 05:24:15 -07:00
parent c7c867390c
commit daf122806e

View File

@@ -25,9 +25,13 @@
#undef MKIMAGE_DEBUG
#ifdef MKIMAGE_DEBUG
#define debug(fmt,args...) printf (fmt ,##args)
#define debug(fmt, args...) printf(fmt, ##args)
#else
#define debug(fmt,args...)
#define debug(fmt, args...) \
do { \
if (0) \
printf(fmt, ##args); \
} while (0)
#endif /* MKIMAGE_DEBUG */
#define log_debug(fmt, args...) debug(fmt, ##args)