git: 85b07e977b04 - main - libelftc: Const correctness for C23
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Aug 2026 14:30:49 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=85b07e977b04fceec84783facdb308492f17b155
commit 85b07e977b04fceec84783facdb308492f17b155
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2026-08-03 14:10:25 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2026-08-03 14:10:25 +0000
libelftc: 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 libelftc during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
Since the returned pointer is never modified in either case, make
it const.
MFC after: 1 week
Reviewed by: jkoshy, markj, dim, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58497
---
contrib/elftoolchain/libelftc/libelftc_dem_arm.c | 3 +--
contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
index ec87f6f7a11b..872cbce4c4a3 100644
--- a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
+++ b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
@@ -404,8 +404,7 @@ static bool
read_func(struct demangle_data *d)
{
size_t len;
- const char *name;
- char *delim;
+ const char *name, *delim;
if (d == NULL)
return (false);
diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
index a414c7cdab80..df8d4e095384 100644
--- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
+++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
@@ -255,7 +255,7 @@ clean:
bool
is_cpp_mangled_gnu2(const char *org)
{
- char *str;
+ const char *str;
bool rtn = false;
if (org == NULL)
@@ -487,8 +487,7 @@ static bool
read_func(struct demangle_data *d)
{
size_t len;
- const char *name;
- char *delim;
+ const char *name, *delim;
if (d == NULL)
return (false);