Hi,
While compiling 4.95-RC2 I'm still seeing the following warnings emitted :-
cc filter.c
filter.c: In function 'interpret_commands':
filter.c:2018:23: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2018 | else headers_charset = s; /*XXX loses track of const */
| ^
filter.c:2042:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2042 | fmsg = expargs[0]; /*XXX loses track of const */
| ^
filter.c:2129:40: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2129 | if (i != mailarg_index_text) for (p = s; *p != 0; p++)
| ^
filter.c:2179:24: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2179 | commands->args[i].u = s; /*XXX loses track of const */
| ^
cc filtertest.c
I'm compiling using gcc on Alpine Linux :-
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/9.3.0/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-9.3.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 9.3.0' --enable-checking=release
--disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-cloog-backend --enable-languages=c,c++,d,objc,fortran,ada --disable-libssp --disable-libmpx --disable-libmudflap
--disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
gcc version 9.3.0 (Alpine 9.3.0)
I modified the relevant lines in filter.c to cast the RHS :-
2018c2018
< else headers_charset = (uschar *) s; /*XXX loses track of const */
---
> else headers_charset = s; /*XXX loses track of const */
2042c2042
< fmsg = (uschar *) (expargs[0]); /*XXX loses track of const */
---
> fmsg = expargs[0]; /*XXX loses track of const */
2129c2129
< if (i != mailarg_index_text) for (p = (uschar *) s; *p != 0; p++)
---
> if (i != mailarg_index_text) for (p = s; *p != 0; p++)
2179c2179
< commands->args[i].u = (uschar *) s; /*XXX loses track of const */
---
> commands->args[i].u = s; /*XXX loses track of const */
(I left the comments :-) )
and the source compiles clean without warnings.
Whether this breaks big stuff is unknown - my simple tests ran ok.
Regards,
D
lists/exim/users/2021-09-08.tx exim-users
+----------------------------------------------------------------------------+
| Dave Restall, Computer Anorak, Geek, Cyclist, Radio Amateur G4FCU, Bodger |
| Mob +44 (0) 7973 831245 Skype: dave.restall Radio: G4FCU |
| email : dave@??? - Anti-SocialMediaist - Web : Not Ready Yet :-( |
+- QOTD ---------------------------------------------------------------------+
| "You who hate the Jews so, why did you adopt their religion?" |
| -- Friedrich Nietzsche, addressing anti-semitic |
| Christians |
+----------------------------------------------------------------------------+