Skip to content

Commit

Permalink
Trace: Avoid redefine of UNUSED() macro
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
singalsu committed Oct 25, 2023
1 parent e69d593 commit e08d6c0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/sof/trace/preproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

0 comments on commit e08d6c0

Please sign in to comment.