| Message ID | 20260502170132.3303884-2-mark@klomp.org |
|---|---|
| State | New |
| Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id CC39E4BB8F57 for <patchwork@sourceware.org>; Sat, 2 May 2026 17:02:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC39E4BB8F57 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id C9AEB4B920C7 for <binutils@sourceware.org>; Sat, 2 May 2026 17:01:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9AEB4B920C7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C9AEB4B920C7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777741309; cv=none; b=p2HP51eUAXPe+Vi43GxD5T9jiPhERIoEKpKBS9P0AMz+kge81dc1nOuq+TkA2zxA2lt+enxgN9MnrGCkGs6D1+GaudBU8/Cg+oihqSiV7kHyUz5XKStmB+bZS0PqdUY/f3FkVjnKmGsLAKYG/CqPwTRpdQu7KcSnvu6id7FdfS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777741309; c=relaxed/simple; bh=Sc20opz/SvAVHqXrVHdaO3frgHnpKLqaatzMM/T8Pak=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=QZr0aZFLbU1SQp9oiwcd1FPwKeWECFQpq/+rYgDCS8EqeOK87rg6wY0Pmfh8D/sGXZhnQ4vbzOCI8LgoSVfdhONi1h+sHQz9DWxj2QFI+HDsvkPQ9Xb2BTf0CYyP6Kt0aX+14AjR6MNV83M+WoRhK+vQ3CsnpgKnQv9HC8g38H8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9AEB4B920C7 Received: from 9950x.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id B2F133032F85; Sat, 2 May 2026 19:01:48 +0200 (CEST) Received: by 9950x.localdomain (Postfix, from userid 1000) id 6022DAA004C; Sat, 02 May 2026 19:01:48 +0200 (CEST) From: Mark Wielaard <mark@klomp.org> To: binutils@sourceware.org Cc: Mark Wielaard <mark@klomp.org> Subject: [PATCH 1/2] gprof: Fix strchr discarded qualifier call Date: Sat, 2 May 2026 18:56:51 +0200 Message-ID: <20260502170132.3303884-2-mark@klomp.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260502170132.3303884-1-mark@klomp.org> References: <20260502170132.3303884-1-mark@klomp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
[1/2] gprof: Fix strchr discarded qualifier call
|
|
Commit Message
Mark Wielaard
May 2, 2026, 4:56 p.m. UTC
In annotate_source strrchr is called on a const char *. So the result should also be stored in a const char *. * gprof/source.c (annotate_source): Make name_only a const char *. --- gprof/source.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Sun, May 3, 2026 at 1:02 AM Mark Wielaard <mark@klomp.org> wrote: > > In annotate_source strrchr is called on a const char *. So the result > should also be stored in a const char *. > > * gprof/source.c (annotate_source): Make name_only a const char *. > --- > gprof/source.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gprof/source.c b/gprof/source.c > index 494f6ecc9b20..aae55f6d758f 100644 > --- a/gprof/source.c > +++ b/gprof/source.c > @@ -98,7 +98,8 @@ annotate_source (Source_File *sf, unsigned int max_width, > bool new_line; > char buf[8192]; > char *fname; > - char *annotation, *name_only; > + char *annotation; > + const char *name_only; > FILE *ifp, *ofp; > Search_List_Elem *sle = src_search_list.head; > > -- > 2.54.0 > We should combine this strrchr patch set with the patch set from Calvin Owens <calvin@wbinvd.org>: https://patchwork.sourceware.org/project/binutils/list/?series=60290
On Sun, May 3, 2026 at 6:52 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Sun, May 3, 2026 at 1:02 AM Mark Wielaard <mark@klomp.org> wrote: > > > > In annotate_source strrchr is called on a const char *. So the result > > should also be stored in a const char *. > > > > * gprof/source.c (annotate_source): Make name_only a const char *. > > --- > > gprof/source.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/gprof/source.c b/gprof/source.c > > index 494f6ecc9b20..aae55f6d758f 100644 > > --- a/gprof/source.c > > +++ b/gprof/source.c > > @@ -98,7 +98,8 @@ annotate_source (Source_File *sf, unsigned int max_width, > > bool new_line; > > char buf[8192]; > > char *fname; > > - char *annotation, *name_only; > > + char *annotation; > > + const char *name_only; > > FILE *ifp, *ofp; > > Search_List_Elem *sle = src_search_list.head; > > > > -- > > 2.54.0 > > > > We should combine this strrchr patch set with the patch set from > Calvin Owens <calvin@wbinvd.org>: > > https://patchwork.sourceware.org/project/binutils/list/?series=60290 > Calvin's patch has been checked in. Here is another one for DOS based filesystem: Fix the strrchr error like: gprof/source.c:130:28: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 130 | char *bslash = strrchr (sf->name, '\\'); binutils/ * bucomm.c (template_in_dir): Make bslash const char *. gprof/ * source.c (annotate_source): Make bslash const char *.
On Sun, May 03, 2026 at 08:32:51AM +0800, H.J. Lu wrote: > Calvin's patch has been checked in. Here is another one for DOS based > filesystem: Well, one of them was. > Fix the strrchr error like: > > gprof/source.c:130:28: error: initialization discards ‘const’ > qualifier from pointer target type [-Werror=discarded-qualifiers] > 130 | char *bslash = strrchr (sf->name, '\\'); > > binutils/ > > * bucomm.c (template_in_dir): Make bslash const char *. > > gprof/ > > * source.c (annotate_source): Make bslash const char *. Please commit.
On Sun, May 3, 2026 at 1:02 AM Mark Wielaard <mark@klomp.org> wrote: > > In annotate_source strrchr is called on a const char *. So the result > should also be stored in a const char *. > > * gprof/source.c (annotate_source): Make name_only a const char *. > --- > gprof/source.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gprof/source.c b/gprof/source.c > index 494f6ecc9b20..aae55f6d758f 100644 > --- a/gprof/source.c > +++ b/gprof/source.c > @@ -98,7 +98,8 @@ annotate_source (Source_File *sf, unsigned int max_width, > bool new_line; > char buf[8192]; > char *fname; > - char *annotation, *name_only; > + char *annotation; > + const char *name_only; > FILE *ifp, *ofp; > Search_List_Elem *sle = src_search_list.head; > > -- > 2.54.0 > I think this counts an obvious fix.
diff --git a/gprof/source.c b/gprof/source.c index 494f6ecc9b20..aae55f6d758f 100644 --- a/gprof/source.c +++ b/gprof/source.c @@ -98,7 +98,8 @@ annotate_source (Source_File *sf, unsigned int max_width, bool new_line; char buf[8192]; char *fname; - char *annotation, *name_only; + char *annotation; + const char *name_only; FILE *ifp, *ofp; Search_List_Elem *sle = src_search_list.head;