Use of ossl_unused in

Matt Caswell matt at
Mon Oct 4 07:00:59 UTC 2021

Please raise a github issue for this.


On 02/10/2021 17:19, Arran Cudbard-Bell wrote:
> 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/ have
> been marked up with ossl_unused i.e. (__attribute__((unused))).
> I'm not sure what compiler the OP of
> 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

More information about the openssl-users mailing list