On Sun, Mar 29, 2026 at 05:36:52PM +0200, Rene Kita wrote:
What is the general opinion here regarding such compiler flags and how to handle such situations?
I'm going through these (besides imap_next_word() which I already commented about), but as you said, some of these aren't easy fixes. I think we can note them in TODO but shouldn't strive too hard to fix them all now.
In some cases it's hard to know if the solution wouldn't be worse than the cast is right now.
mutt_socket.c: In function ‘mutt_conn_find’: mutt_socket.c:311:22: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] 311 | mutt_account_tourl((ACCOUNT*) account, &url, 0);
The ACCOUNT stuff is a mess that has been on my todo list for a while. The fact that they don't have a begin/end lifecycle is just a part of the problem. Would definitely advise ignore this for now at least.
mutt_zstrm.c: In function ‘mutt_zstrm_write’: mutt_zstrm.c:190:27: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] 190 | zctx->write.z.next_in = (Bytef*) buf;
Yeah, this is tough because we're inbetween the api and the CONNECTION function pointer signatures. Advise to let it be.
pgppubring.c: In function ‘main’: pgppubring.c:159:34: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] 159 | pgpring_find_candidates(kring, (const char**) argv + optind, argc - optind);
I think this can be fixed by changing the types of main argv back to char *argv[], and the two functions: pgpring_string_matches_hint and pgpring_find_candidates to const char * const hints[]. Does that work
for you?
date.c: In function ‘mutt_mktime’: date.c:88:20: warning: comparison is always false due to limited range of data type [-Wtype-limits] 88 | if ((time_t)year > TM_YEAR_MAX)
I think this warning should be ignored. It's a safety check, that maybe won't be true on all platorms.
sendlib.c:73:15: warning: redundant redeclaration of ‘environ’
[-Wredundant-decls]
73 | extern char **environ;
| ^~~~~~~
In file included from mutt.h:25,
from sendlib.c:26:
/usr/include/unistd.h:566:15: note: previous declaration of ‘environ’ with type
‘char **’
566 | extern char **environ;
Hmm... I added the extern declaration myself four years ago. I presumed I needed to but perhaps it's okay. What happens if you comment it out? For me it builds fine.
sendlib.c: In function ‘convert_file_from_to’:
sendlib.c:864:50: warning: to be safe all intermediate pointers in cast from
‘char **’ to ‘const char **’ must be ‘const’ qualified [-Wcast-qual]
864 | ret = convert_file_to(file, fcode, ncodes, (const char **)tcode,
| ^
sendlib.c:879:52: warning: to be safe all intermediate pointers in cast from
‘char **’ to ‘const char **’ must be ‘const’ qualified [-Wcast-qual]
879 | ret = convert_file_to(file, fromcodes, ncodes, (const char **)tcode,
Does changing the type and parameter case to (const char * const *) not work?
-- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
Description: PGP signature
