On Mon, Jun 22, 2026 at 3:50 PM Filip Kastl <[email protected]> wrote:
>
> There are two uses of strrchr with const char * parameters in
> lto-plugin.c where the result gets assigned to a non-const char *
> variable.
>
> Make the variable const char * so that we don't throw away const-ness.
> I've seen clang produce warnings about this when compiling lto-plugin.c.
>
> Regtested and bootstrapped on x86_64 linux.

OK.

> lto-plugin/ChangeLog:
>
>         * lto-plugin.c (process_symtab): char *s -> const char *s.
>         (process_symtab_extension): Ditto.
>
> Signed-off-by: Filip Kastl <[email protected]>
> ---
>  lto-plugin/lto-plugin.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
> index 8cd707087e7..778c3d21165 100644
> --- a/lto-plugin/lto-plugin.c
> +++ b/lto-plugin/lto-plugin.c
> @@ -1091,7 +1091,7 @@ static int
>  process_symtab (void *data, const char *name, off_t offset, off_t length)
>  {
>    struct plugin_objfile *obj = (struct plugin_objfile *)data;
> -  char *s;
> +  const char *s;
>    char *secdatastart, *secdata;
>
>    if (!startswith (name, ".gnu.lto_.symtab"))
> @@ -1143,7 +1143,7 @@ process_symtab_extension (void *data, const char *name, 
> off_t offset,
>                           off_t length)
>  {
>    struct plugin_objfile *obj = (struct plugin_objfile *)data;
> -  char *s;
> +  const char *s;
>    char *secdatastart, *secdata;
>
>    if (!startswith (name, ".gnu.lto_.ext_symtab"))
> --
> 2.54.0
>

Reply via email to