[binutils-gdb/binutils-2_46-branch] gprof: Fix strchr discarded qualifier call

"H.J. Lu via Binutils-cvs" <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=36ced277bcc331c14c1fe38f3f9a6b25b12c7118

commit 36ced277bcc331c14c1fe38f3f9a6b25b12c7118
Author: Mark Wielaard <[email protected]>
Date:   Sat May 2 18:56:51 2026 +0200

    gprof: Fix strchr discarded qualifier call
    
    In annotate_source strrchr is called on a const char *. So the result
    should also be stored in a const char *.
    
            PR binutils/34125
            * gprof/source.c (annotate_source): Make name_only a const char *.
    
    (cherry picked from commit b8d39fd810e7373aac4f129c34813f6a609d8d5f)

Diff:
---
 gprof/source.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gprof/source.c b/gprof/source.c
index 494f6ecc9b2..aae55f6d758 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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.