git: 1d94e2e0f2ee - main - m4: Const correctness for C23
Lexi Winter <[email protected]> Mon, 03 Aug 2026 14:30:47 +0000
| Newsgroups | gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=1d94e2e0f2ee21d5a4596efc0570d06e3dea0a6e commit 1d94e2e0f2ee21d5a4596efc0570d06e3dea0a6e Author: Lexi Winter <[email protected]> AuthorDate: 2026-08-03 14:09:03 +0000 Commit: Lexi Winter <[email protected]> CommitDate: 2026-08-03 14:09:03 +0000 m4: Const correctness for C23 On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr() now implements the C23 behaviour where passing a const pointer to strchr() also returns a const pointer. This breaks m4 during the bootstrap build, since it assumes the return value is always a mutable pointer. Since the returned value is never modified, simply make the temporary const. MFC after: 1 week Reviewed by: bapt, dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58494 --- usr.bin/m4/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c index 24e91c572f4d..71d0734fa874 100644 --- a/usr.bin/m4/misc.c +++ b/usr.bin/m4/misc.c @@ -70,7 +70,7 @@ unsigned char *endpbb; /* end of push-back buffer */ ptrdiff_t doindex(const char *s1, const char *s2) { - char *t; + const char *t; t = strstr(s1, s2); if (t == NULL)