Re: Minor cleanup after adding more warnings to CFLAGS
"Kevin J. McCarthy" <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <aeA4hA4fYAH-PBNC@qinghai> |
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
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmngOIQACgkQre92hIAx a9rLXxAA0h9uZG8l7BBP18DbwovT8J5R+xxp3ypwUZzfgAssKb6dkOu5duYPqpKU 2AWVj4AQrHkK4QCe81HQmGZa9ljciogZOEEcFISO2RW3VaHLqrWxgN5rBaqyOWJ1 zfhpzgP3F/VOwYeX4AixDK6ikD7uxEA+6YHmcRwy1YKxDyLOlZYFYs5HKzM1YYHo 75qHiS0B/LefhVP9plKVxlX73IbmNh1mNHmhPv/DlaC/Y0gAyouXN+NcCSHTt+v1 JPexAmgsTHBEuATCeqGfKWRodWZxtrJxlegrgjUiYIZzXFbwj9dwuM4N3iEfYoAI 3nWbUi5G5l3E9cEPbcuznZGXgPM403TX0eTVu9nEsGM7jdUMk4Shzld1290zNjA8 Qld6wOt8asUaqvEhejVx5rMr+DF06I3QL47SgpM38EG6H3c20myXoABJ0nq9axsA IW1QOnF2vywv0p5nXLBpMmjbvNH1qrfOZlAjAr/h8FUjct+Kf5zTVg7OSriCDR19 rD7SsUA8q8xH17Z2tl1WG0/lvGtn8hDD8Akkg/LtFrK44CwBZKlIYgO3VA06QytR p5mpiR+SedYpJUPTNaUNdMxq7Y4hp3KfwhLAsynuMWmhPL1UGfNaKO7cwvshTf8T RPSDG33eHPGxdblbsZJ7EfSVFyncafJC0wghGRdet/zHsEM4Z/Y= =bDlv -----END PGP SIGNATURE-----