Use of ossl_unused in err.h.in
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Sat Oct 2 16:19:04 UTC 2021
In current master HEAD and 3.0.0 calling ERR_GET_REASON throws the following
warning:
src/lib/tls/session.c:1323:43: warning: 'ERR_GET_REASON' was marked unused but was used [-Wused-but-marked-unused]
while ((ssl_err = ERR_peek_error()) && (ERR_GET_REASON(ssl_err) == BIO_R_UNSUPPORTED_METHOD)) {
This is because the static inline functions in include/openssl/err.h.in have
been marked up with ossl_unused i.e. (__attribute__((unused))).
I'm not sure what compiler the OP of https://github.com/openssl/openssl/issues/12792
was using, but it should not be generating a -Wunused-function for a static inline
function in a header file. These are by their nature public functions, and should not
generate unused function warnings. The only correct place to generate this warnings
is when the functions's visibility is limited to the compilation unit, and those functions
are not called within the compilation unit.
Can 067a3057c3aab0cdd9a3cdb13c2e0000f69a4170 either be reverted, or a guard
added so that ossl_unused is only set in the absence of a macro being defined (happy
to send a PR for this).
As it is currently, calling ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_RFLAGS,
ERR_GET_REASON, ERR_FATAL_ERROR will produce spurious
"used-but-marked-unused" warnings at build time.
-Arran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20211002/7baec9aa/attachment.sig>
More information about the openssl-users
mailing list