[PATCH 1/2] gprof: Fix strchr discarded qualifier call
H.J. Lu
hjl.tools@gmail.com
Sat May 2 22:52:02 GMT 2026
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
--
H.J.
More information about the Binutils
mailing list