From 36a4bbcec4b31ff7a5fb8e5a2e20acef9344c810 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 5 Dec 2025 14:15:11 +0000 Subject: [PATCH] sim: make local variable 'const' This build error was reported to me off list: common/callback.c:993:13: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 993 | char *q = strchr (m, ','); | ^ ~~~~~~~~~~~~~~~ This is because with C23, strchr returns 'const char *' if a 'const char *' is passed as an argument. In this case M is 'const char *', so Q should also be 'const char *'. And indeed, we don't write via Q at any time, so lets make it 'const'. There should be no user visible changes after this commit. --- sim/common/callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/common/callback.c b/sim/common/callback.c index 54b9476ff7e..7f4ee81bc8b 100644 --- a/sim/common/callback.c +++ b/sim/common/callback.c @@ -990,7 +990,7 @@ cb_host_to_target_stat (host_callback *cb, const struct stat *hs, void *ts) while (m) { - char *q = strchr (m, ','); + const char *q = strchr (m, ','); int size; /* FIXME: Use sscanf? */ -- 2.47.3