diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2023-03-23 19:25:58 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2023-04-06 13:49:34 +0300 |
commit | 66c144e66f21a7e340045790b9a65b4982f9e3f4 (patch) | |
tree | fe548e98a5f38a3f2eb3ef521966b24bd500e341 /helper | |
parent | fd27ef522ab5c6c2d345da7efed30f8941d1d51a (diff) |
helper: debug: re-enable print format warnings
Commit a0237360e745 ("helper: debug: fix variadic macro build errors")
also disabled print format warnings as a side effect. Remove the
pragma used in that commit, and instead avoid the variadic macro
warnings with '__extension__' keyword.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/include/odp/helper/odph_debug.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/helper/include/odp/helper/odph_debug.h b/helper/include/odp/helper/odph_debug.h index bedef2f66..20ba3d04b 100644 --- a/helper/include/odp/helper/odph_debug.h +++ b/helper/include/odp/helper/odph_debug.h @@ -24,14 +24,16 @@ extern "C" { #endif +#pragma GCC diagnostic push + +#ifdef __clang__ +#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#endif + /** @addtogroup odph_debug ODPH DEBUG * @{ */ -/* Avoid "ISO C99 requires at least one argument for the "..." in a variadic - * macro" errors when building with 'pedantic' option. */ -#pragma GCC system_header - /** * Assert macro for applications and helper code * @@ -85,26 +87,40 @@ do { \ /** * Debug printing macro, which prints output when DEBUG flag is set. */ -#define ODPH_DBG(fmt, ...) \ - ODPH_LOG(ODPH_LOG_DBG, fmt, ##__VA_ARGS__) +#define ODPH_DBG(...) \ + do { \ + __extension__ ({ \ + ODPH_LOG(ODPH_LOG_DBG, ##__VA_ARGS__); \ + }); \ + } while (0) /** * Print output to stderr (file, line and function). */ -#define ODPH_ERR(fmt, ...) \ - ODPH_LOG(ODPH_LOG_ERR, fmt, ##__VA_ARGS__) +#define ODPH_ERR(...) \ + do { \ + __extension__ ({ \ + ODPH_LOG(ODPH_LOG_ERR, ##__VA_ARGS__); \ + }); \ + } while (0) /** * Print output to stderr (file, line and function), * then abort. */ -#define ODPH_ABORT(fmt, ...) \ - ODPH_LOG(ODPH_LOG_ABORT, fmt, ##__VA_ARGS__) +#define ODPH_ABORT(...) \ + do { \ + __extension__ ({ \ + ODPH_LOG(ODPH_LOG_ABORT, ##__VA_ARGS__); \ + }); \ + } while (0) /** * @} */ +#pragma GCC diagnostic pop + #ifdef __cplusplus } #endif |