[OpenSSL-3.0LTS] TNF local patch - respect -Wcast-qual
Issue #379
wontfix
TNF don’t like cast (const type *)
to (type *)
directly, and they often enables -Wcast-qual
with -Werror
.
they defines __UNCONST
macro in sys/cdefs.h:
const type *a;
type *b;
a = __UNCONST(a);
but in this patch, they dont use it for portability(and maybe its implementation is broken future 128bit pointer era), so use intptr_t
like:
const type *a;
type *b;
a = (type *)(intptr_t)a;
Comments (5)
-
reporter -
reporter and OpenSSL’s coder is completely suck:
I don't understand C anything at all, and I wrote const qualifier in the mood…
this is why so many OpenSSL fork exists such as LibreSSL/BoringSSL.
-
reporter - edited description
- attached patch-Issue379.txt
-
reporter - changed title to [OpenSSL-3.0LTS] TNF local patch - respect -Wcast-qual
-
reporter - changed status to wontfix
it seems that TNF abandoned to pass -Wcast-qual error, they enables -Wno-error=cast-qual already. http://cvsweb.netbsd.org/bsdweb.cgi/src/crypto/Makefile.openssl?only_with_tag=MAIN#rev1.14
- Log in to comment
in terms of C specification, cast
const *type
totype *
is completely legal, but sometimes const qualifier is used for memory protection, see following examples taken from GCC’s manual:so -Wcast-qual may help to detect assignment of read-only location error.
but TNF, they blindly uses __UNCONST macro and never checks these memories can really be writable.
so they work hard, but they got nothing, it is only same result -Wno-cast-qual how idiot!(same as F*BSD, they do as same by __DECONST macro)
O*BSD keeps avoid to use -Wcast-qual, it seems that they believe -Wcast-qual is harmful, i think.