mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Martin Kaiser <martin@kaiser.cx>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH v2 1/2] perf: avoid redefinition warnings for REG_DWARFNUM_NAME
Date: Tue,  9 Jun 2026 10:13:08 +0200	[thread overview]
Message-ID: <20260609081500.743861-2-martin@kaiser.cx> (raw)
In-Reply-To: <20260609081500.743861-1-martin@kaiser.cx>

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>
---

Arnaldo: I've now gotten to the same point as you. We need two separate
patches ;-)

 tools/perf/arch/powerpc/include/dwarf-regs-table.h | 1 +
 tools/perf/arch/riscv/include/dwarf-regs-table.h   | 1 +
 tools/perf/arch/s390/include/dwarf-regs-table.h    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tools/perf/arch/powerpc/include/dwarf-regs-table.h b/tools/perf/arch/powerpc/include/dwarf-regs-table.h
index 66dc015a733d..7e746cb31b66 100644
--- a/tools/perf/arch/powerpc/include/dwarf-regs-table.h
+++ b/tools/perf/arch/powerpc/include/dwarf-regs-table.h
@@ -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[] = {
diff --git a/tools/perf/arch/riscv/include/dwarf-regs-table.h b/tools/perf/arch/riscv/include/dwarf-regs-table.h
index a45b63a6d5a8..009a4e3c51ab 100644
--- a/tools/perf/arch/riscv/include/dwarf-regs-table.h
+++ b/tools/perf/arch/riscv/include/dwarf-regs-table.h
@@ -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[] = {
diff --git a/tools/perf/arch/s390/include/dwarf-regs-table.h b/tools/perf/arch/s390/include/dwarf-regs-table.h
index 671553525f41..e90b63157702 100644
--- a/tools/perf/arch/s390/include/dwarf-regs-table.h
+++ b/tools/perf/arch/s390/include/dwarf-regs-table.h
@@ -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
 
 /*
-- 
2.43.7


  reply	other threads:[~2026-06-09  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  8:13 [PATCH v2 0/2] perf: riscv: fix register name strings Martin Kaiser
2026-06-09  8:13 ` Martin Kaiser [this message]
2026-06-09  8:13 ` [PATCH v2 2/2] perf " Martin Kaiser
2026-06-10 19:55 ` [PATCH v2 0/2] perf: " Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609081500.743861-2-martin@kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®