binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gprof

Gprof: Fix strchr discarded qualifier call

Fixes a const qualifier issue in gprof's annotate_source function.

The annotate_source function in gprof now correctly handles const char * types when calling strrchr. This resolves a discarded qualifier warning. It ensures type safety when processing source code annotations.

In Details

The commit fixes a type mismatch in gprof/source.c's annotate_source function. The strrchr function, when called on a const char *, should have its result stored in a const char * as well. This was not the case and this commit fixes that by declaring name_only as const char *.

For Context

Gprof is a profiling tool that helps developers understand where their programs spend most of their time. This commit addresses a type safety issue within gprof's source code annotation functionality. It ensures that the code correctly handles constant character pointers, preventing potential errors when processing source code files.

Filed Under: gproftype safetyconst qualifier