aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2026-08-03 14:10:25 +0000
committerLexi Winter <ivy@FreeBSD.org>2026-08-03 14:10:25 +0000
commit85b07e977b04fceec84783facdb308492f17b155 (patch)
tree7205fe2a4fb159e34ddcc6772a7200a9a172baa7
parent9f18614d5353ce513511ccbf59d09e76c93f7bc9 (diff)
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
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_dem_arm.c3
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c5
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);