[PATCH 1/2] gprof: Fix strchr discarded qualifier call

Mark Wielaard mark@klomp.org
Sat May 2 16:56:51 GMT 2026


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



More information about the Binutils mailing list