Skip to content

Conversation

@olszomal
Copy link
Collaborator

@olszomal olszomal commented May 5, 2025

This PR adds conditional diagnostic pragmas to locally suppress -Wcast-qual and -Wdiscarded-qualifiers warnings triggered by legacy OpenSSL APIs (BIO_set_md, PKCS7_dup, i2d_X509) which discard const qualifiers. These warnings are harmless, as OpenSSL does not modify the data. Suppressing them locally avoids build noise while preserving correctness and portability.

Additionally, this fixes build failures with OpenSSL ≥ 3.0 when engines are disabled via OPENSSL_NO_ENGINE or OPENSSL_NO_DEPRECATED.
Fixes #430.

@mtrojnar
Copy link
Owner

mtrojnar commented May 5, 2025

clang also defines __GNUC__ and supports #pragma GCC, so there is no need for separate #if defined(__clang__) cases.

@olszomal olszomal force-pushed the engine_disabled branch from f47e782 to 9a7b416 Compare May 6, 2025 06:56
@olszomal
Copy link
Collaborator Author

olszomal commented May 6, 2025

You're right that Clang defines __GNUC__ and supports some #pragma GCC directives. However, in this case Clang does not recognize -Wdiscarded-qualifiers and emits the following warning:

/home/mo/osslsigncode/helpers.c:783:32: warning: unknown warning group '-Wdiscarded-qualifiers', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
                               ^

Because of this, separate handling for Clang is necessary. Clang requires the use of -Wincompatible-pointer-types-discards-qualifiers instead. Splitting the conditions ensures the correct suppression is applied without introducing new build warnings on either compiler.

@mtrojnar mtrojnar merged commit 10ca3a0 into mtrojnar:master May 6, 2025
9 checks passed
@olszomal olszomal deleted the engine_disabled branch September 22, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: error: ‘GLOBAL_OPTIONS’ has no member named ‘p11cert’

2 participants