From e08d6c0ed4fc7c9144e1253f69fefaf0555a707a Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Wed, 25 Oct 2023 16:49:41 +0300 Subject: [PATCH] Trace: Avoid redefine of UNUSED() macro The xt-clang RI-2022.10 compiler headers define UNUSED. With this patch the definition is done only if the macro is undefined. This fixes error: In file included sof/tools/tplg_parser/pga.c:17: In file included sof/tools/tplg_parser/ ../../src/include/sof/lib/uuid.h:11: In file included sof/tools/tplg_parser/ ../../src/include/sof/common.h:105: /home/singalsu/work/current/sof/sof/tools/tplg_parser/ ../../src/include/sof/trace/preproc.h:162:9: error: 'UNUSED' macro redefined [-Werror,-Wmacro-redefined] #define UNUSED(arg1, ...) do { META_RECURSE( xtensa/XtDevTools/install/tools/RI-2022.10-linux/XtensaTools/ xtensa-elf/include/xtensa/xtensa-types.h:60:9: note: previous definition is here #define UNUSED(x) ((void)(x)) Signed-off-by: Seppo Ingalsuo --- src/include/sof/trace/preproc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/include/sof/trace/preproc.h b/src/include/sof/trace/preproc.h index 17a7994fcb43..8f9677d4f399 100644 --- a/src/include/sof/trace/preproc.h +++ b/src/include/sof/trace/preproc.h @@ -158,8 +158,10 @@ return_t META_CONCAT(prefix, postfix) (args) /* counteract compiler warning about unused variables */ +#ifndef UNUSED #define UNUSED(arg1, ...) do { META_RECURSE( \ META_MAP_AGGREGATE(1, _META_VOID2, _META_VOID(arg1), __VA_ARGS__)); \ } while (0) +#endif #endif /* __SOF_TRACE_PREPROC_H__ */