From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Li Guan <guanli.oerv@isrc.iscas.ac.cn>
Cc: namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com,
palmer@dabbelt.com, pjw@kernel.org,
linux-perf-users@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf riscv: Fix discarded const qualifier in _get_field()
Date: Sat, 23 May 2026 19:44:36 -0300 [thread overview]
Message-ID: <ahIt1ArEyRH8HIXf@x1> (raw)
In-Reply-To: <6f54fc06-1a75-4910-82a5-172a42f34284@isrc.iscas.ac.cn>
On Sun, May 24, 2026 at 02:41:26AM +0800, Li Guan wrote:
> Hi Arnaldo, Namhyung,
>
> Just a gentle ping on this patch. It has received a Reviewed-by from Ian.
> Could you please consider picking it up for perf-tools-next?
Thanks, applying.
- Arnaldo
> Thanks,
> Li Guan
>
> On 5/14/2026 2:07 AM, Li Guan wrote:
> > The assignment of strrchr() return values to non-const char * variables
> > triggers a -Werror=discarded-qualifiers warning when building with GCC 14.
> > This happens because in newer glibc versions, strrchr() returns a
> > const char * if the input string is const.
> >
> > Properly declare 'line2' and 'nl' as const char * to match the glibc
> > function signature and ensure type safety. This avoids the need for
> > explicit type casting and aligns with the design pattern of not
> > modifying read-only memory in the perf tool.
> >
> > Signed-off-by: Li Guan <guanli.oerv@isrc.iscas.ac.cn>
> > ---
> > v2:
> > - Drop the auxtrace decoupling and weak stub approach as they interfered
> > with the cross-platform analysis intent, per Ian's feedback.
> > - Focus on a clean fix for the const qualifier issue in RISC-V header.c
> > by properly declaring local variables as const.
> > - Use Li Guan as the preferred name format for consistency.
> > - Verified that this fix is not yet present in acme/perf-tools-next.
> >
> > tools/perf/arch/riscv/util/header.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/arch/riscv/util/header.c b/tools/perf/arch/riscv/util/header.c
> > index 4b839203d4..891984e909 100644
> > --- a/tools/perf/arch/riscv/util/header.c
> > +++ b/tools/perf/arch/riscv/util/header.c
> > @@ -19,7 +19,7 @@
> > static char *_get_field(const char *line)
> > {
> > - char *line2, *nl;
> > + const char *line2, *nl;
> > line2 = strrchr(line, ' ');
> > if (!line2)
WARNING: multiple messages have this Message-ID (diff)
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Li Guan <guanli.oerv@isrc.iscas.ac.cn>
Cc: namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com,
palmer@dabbelt.com, pjw@kernel.org,
linux-perf-users@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf riscv: Fix discarded const qualifier in _get_field()
Date: Sat, 23 May 2026 19:44:36 -0300 [thread overview]
Message-ID: <ahIt1ArEyRH8HIXf@x1> (raw)
In-Reply-To: <6f54fc06-1a75-4910-82a5-172a42f34284@isrc.iscas.ac.cn>
On Sun, May 24, 2026 at 02:41:26AM +0800, Li Guan wrote:
> Hi Arnaldo, Namhyung,
>
> Just a gentle ping on this patch. It has received a Reviewed-by from Ian.
> Could you please consider picking it up for perf-tools-next?
Thanks, applying.
- Arnaldo
> Thanks,
> Li Guan
>
> On 5/14/2026 2:07 AM, Li Guan wrote:
> > The assignment of strrchr() return values to non-const char * variables
> > triggers a -Werror=discarded-qualifiers warning when building with GCC 14.
> > This happens because in newer glibc versions, strrchr() returns a
> > const char * if the input string is const.
> >
> > Properly declare 'line2' and 'nl' as const char * to match the glibc
> > function signature and ensure type safety. This avoids the need for
> > explicit type casting and aligns with the design pattern of not
> > modifying read-only memory in the perf tool.
> >
> > Signed-off-by: Li Guan <guanli.oerv@isrc.iscas.ac.cn>
> > ---
> > v2:
> > - Drop the auxtrace decoupling and weak stub approach as they interfered
> > with the cross-platform analysis intent, per Ian's feedback.
> > - Focus on a clean fix for the const qualifier issue in RISC-V header.c
> > by properly declaring local variables as const.
> > - Use Li Guan as the preferred name format for consistency.
> > - Verified that this fix is not yet present in acme/perf-tools-next.
> >
> > tools/perf/arch/riscv/util/header.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/arch/riscv/util/header.c b/tools/perf/arch/riscv/util/header.c
> > index 4b839203d4..891984e909 100644
> > --- a/tools/perf/arch/riscv/util/header.c
> > +++ b/tools/perf/arch/riscv/util/header.c
> > @@ -19,7 +19,7 @@
> > static char *_get_field(const char *line)
> > {
> > - char *line2, *nl;
> > + const char *line2, *nl;
> > line2 = strrchr(line, ' ');
> > if (!line2)
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-05-23 22:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 15:48 [PATCH 0/3] perf build: Fix cross-arch build failures and GCC 14 warnings Li Guan
2026-05-13 15:48 ` Li Guan
2026-05-13 15:48 ` [PATCH 1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects Li Guan
2026-05-13 15:48 ` Li Guan
2026-05-13 16:14 ` Ian Rogers
2026-05-13 16:14 ` Ian Rogers
2026-05-13 16:31 ` guanli
2026-05-13 16:31 ` guanli
2026-05-13 16:37 ` Ian Rogers
2026-05-13 16:37 ` Ian Rogers
2026-05-14 6:59 ` sashiko-bot
2026-05-13 15:48 ` [PATCH 2/3] perf riscv: Fix discarded const qualifier error in _get_field() Li Guan
2026-05-13 15:48 ` Li Guan
2026-05-13 16:18 ` Ian Rogers
2026-05-13 16:18 ` Ian Rogers
2026-05-13 18:07 ` [PATCH v2] perf riscv: Fix discarded const qualifier " Li Guan
2026-05-13 18:07 ` Li Guan
2026-05-13 23:11 ` Ian Rogers
2026-05-13 23:11 ` Ian Rogers
2026-05-23 18:41 ` Li Guan
2026-05-23 18:41 ` Li Guan
2026-05-23 22:44 ` Arnaldo Carvalho de Melo [this message]
2026-05-23 22:44 ` Arnaldo Carvalho de Melo
2026-05-14 7:38 ` [PATCH 2/3] perf riscv: Fix discarded const qualifier error " sashiko-bot
2026-05-13 15:48 ` [PATCH 3/3] perf script: Provide weak stubs for instruction decoding Li Guan
2026-05-13 15:48 ` Li Guan
2026-05-13 16:20 ` Ian Rogers
2026-05-13 16:20 ` Ian Rogers
2026-05-14 8:06 ` sashiko-bot
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=ahIt1ArEyRH8HIXf@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=guanli.oerv@isrc.iscas.ac.cn \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=pjw@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.