]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf dwarf: Avoid redefinition warnings for REG_DWARFNUM_NAME
authorMartin Kaiser <martin@kaiser.cx>
Tue, 9 Jun 2026 08:13:08 +0000 (10:13 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 10 Jun 2026 19:53:35 +0000 (16:53 -0300)
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>
tools/perf/arch/powerpc/include/dwarf-regs-table.h
tools/perf/arch/riscv/include/dwarf-regs-table.h
tools/perf/arch/s390/include/dwarf-regs-table.h

index 66dc015a733d6a588619dd21d52fa514933fa66c..7e746cb31b66ed7c696a6171a2d92337d84c933b 100644 (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[] = {
index a45b63a6d5a8e36306dd8535fee633f168da6a76..009a4e3c51ab39b7516c1b6ad68e4d823306d266 100644 (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[] = {
index 671553525f41548e1e87477109874f7af31ba893..e90b631577023d41cb46c3898b0b919b18e9f267 100644 (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
 
 /*