* [PATCH tig] Fix compiler warning with latest gcc
@ 2026-04-17 16:12 Marcel Holtmann
2026-04-17 16:38 ` Collin Funk
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2026-04-17 16:12 UTC (permalink / raw)
To: git; +Cc: Marcel Holtmann
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. */
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH tig] Fix compiler warning with latest gcc
2026-04-17 16:12 [PATCH tig] Fix compiler warning with latest gcc Marcel Holtmann
@ 2026-04-17 16:38 ` Collin Funk
2026-04-17 19:10 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Collin Funk @ 2026-04-17 16:38 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: git
Marcel Holtmann <marcel@holtmann.org> writes:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH tig] Fix compiler warning with latest gcc
2026-04-17 16:38 ` Collin Funk
@ 2026-04-17 19:10 ` Marcel Holtmann
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2026-04-17 19:10 UTC (permalink / raw)
To: Collin Funk; +Cc: git
Hi Collin,
>> 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.
do you want me to fix it and send a v2 or do you just amend it after applying the patch?
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-17 19:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 16:12 [PATCH tig] Fix compiler warning with latest gcc Marcel Holtmann
2026-04-17 16:38 ` Collin Funk
2026-04-17 19:10 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox