git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH tig] Fix compiler warning with latest gcc

From
Collin Funk <collin.funk1@gmail.com>
Date
Apr 17, 2026, 16:38 UTC
Message-ID
<87pl3xsfrw.fsf@gmail.com>
In-Reply-To
<20260417161228.1578-1-marcel@holtmann.org>
Marcel Holtmann <marcel@holtmann.org> writes:
Show 22 quoted lines
>         CC  src/diff.o
> src/diff.c: In function ‘diff_common_add_diff_stat’:
> src/diff.c:191:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
>   191 |         char *pipe = strchr(data, '|');
>       |                      ^~~~~~
> ---
>  src/diff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/diff.c b/src/diff.c
> index 6c670e4b4fb4..182ea349eb9c 100644
> --- a/src/diff.c
> +++ b/src/diff.c
> @@ -188,7 +188,7 @@ diff_common_add_diff_stat(struct view *view, const char *text, size_t offset)
>  	const char *start = text + offset;
>  	const char *data = start + strspn(start, " ");
>  	size_t len = strlen(data);
> -	char *pipe = strchr(data, '|');
> +	const char *pipe = strchr(data, '|');
>  
>  	/* Ensure that '|' is present and the file name part contains
>  	 * non-space characters. */

Minor nit about the commit message, but this is due to a glibc-2.43 change. It isn't related to GCC versions.

Collin
Previous: Marcel HoltmannNext: Marcel Holtmann
Message 2 of 3 in “Fix compiler warning with latest gcc”
  1. Fix compiler warning with latest gccMarcel Holtmann, Apr 17, 2026
  2. Collin FunkApr 17, 2026
  3. Marcel HoltmannApr 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.