[binutils-gdb] 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=b8d39fd810e7373aac4f129c34813f6a609d8d5f

commit b8d39fd810e7373aac4f129c34813f6a609d8d5f
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 *.
    
            * gprof/source.c (annotate_source): Make name_only a const char *.

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

diff --git a/gprof/source.c b/gprof/source.c
index 860c0b5fec0..4aa7504e8df 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.