perf dwarf: Avoid redefinition warnings for REG_DWARFNUM_NAME

dwarf-regs.c includes an arch-specific dwarf-regs-table.h for several
architectures. This pulls in different definitions of REG_DWARFNUM_NAME
and causes compiler warnings for W=1 builds.

In file included from util/dwarf-regs.c:23:

  .../dwarf-regs-table.h:5: error: "REG_DWARFNUM_NAME" redefined [-Werror]
   #define REG_DWARFNUM_NAME(reg, idx) [idx] = reg

Undefine REG_DWARFNUM_NAME before each new definition.

Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Cc: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Martin Kaiser
2026-06-09 10:13:08 +02:00
committed by Arnaldo Carvalho de Melo
parent 7435c4069a
commit d5312a7ef7
3 changed files with 3 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
* http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html
* http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf
*/
#undef REG_DWARFNUM_NAME
#define REG_DWARFNUM_NAME(reg, idx) [idx] = "%" #reg
static const char * const powerpc_regstr_tbl[] = {

View File

@@ -2,6 +2,7 @@
#ifdef DEFINE_DWARF_REGSTR_TABLE
/* This is included in perf/util/dwarf-regs.c */
#undef REG_DWARFNUM_NAME
#define REG_DWARFNUM_NAME(reg, idx) [idx] = "%" #reg
static const char * const riscv_regstr_tbl[] = {

View File

@@ -2,6 +2,7 @@
#ifndef S390_DWARF_REGS_TABLE_H
#define S390_DWARF_REGS_TABLE_H
#undef REG_DWARFNUM_NAME
#define REG_DWARFNUM_NAME(reg, idx) [idx] = "%" #reg
/*