On Wed, Apr 15, 2026 at 03:45:01PM +0200, Rene Kita wrote:
I played around a bit more and unless we are going to make -Wcast-qual a default warning I don't think it's worth it to fix more warnings coming from that flag.
Let's not take that step right now. We've already done some good cleanup and fixed bugs in the process
If we decide to go all in we should just drop every const where we can't prove that we adhere to it.
Dropping consts all over in mutt would limit the usefulness of some other things, like mutt_b2s(), which returns a const char * because modifying the EOS without adjusting dptr results in bugs...
I'd be interested if we could get a little further along to safety by adopting the same mechanism glibc recently did for strchr and the others. I haven't looked into what dark arts were involved.
Alternatively, we could create wrappers around those kind of "token" functions in mutt that take a string as a parameter and return a pointer inside that same const/noconst string back. Something like:
const char *next_foo_const(const char *foo) { .... ;return foo;}
char *next_foo(char *foo) {return (char *)next_foo_const(foo);}
It still has a cast in the wrapper, but it's controlled, and the caller
can choose the appropriate function without having to make its own,
perhaps more dangerous, cast.
-- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
Description: PGP signature
