Skip to content

build: fix -Wunused-macros warnings, and related tidy-ups#20593

Closed
vszakats wants to merge 39 commits intocurl:masterfrom
vszakats:unusedmacro
Closed

build: fix -Wunused-macros warnings, and related tidy-ups#20593
vszakats wants to merge 39 commits intocurl:masterfrom
vszakats:unusedmacro

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Feb 13, 2026

  • fix internal macro AN_APPLE_OS reused between sources without
    resetting it. It may potentially have left the system sha256
    function unused.
  • fix to define WOLFSSL_OPTIONS_IGNORE_SYS so that it always applies
    to wolfSSL headers, also during feature detection.
  • md4, md5, sha256: simplify fallback logic.
  • delete 20+ unused macros.
  • scope or move macros to avoid -Wunused-macros warnings.
  • examples: delete unused code.

The warning detects macros defined but not used within the same C
source. It does not warn for macros defined in headers. It also works
with unity builds, but to a lesser extent.


  • move OPENSSL_SUPPRESS_DEPRECATED to build level, and limit setting
    it for OpenSSL 3 (non-fork). Maybe in a separate PR. (see reverted sub-commit in this PR)
  • cmake: limit OPENSSL_SUPPRESS_DEPRECATED to lib and feature checks. [same as above]
  • decide to enable the warnings as an error, or just a warning, or an error but only in CI (or not at all.)
    or perhaps enable it in scheduled, non-unity, CI jobs? → SEPERATE PR. I'm thinking maybe enable it as a non-error warning could be useful. If there is good chance to fix remaining fallouts, and avoid future ones via CI, the warning can be made an error.
  • consider to avoid MD5_* and EVP_PKEY_get1_RSA, RSA_flags, RSA_free when building with OpenSSL 3,
    to avoid the OPENSSL_SUPPRESS_DEPRECATED warnings in the first place. The logic is already present and used for OpenSSL 3 no-deprecated builds. [RATHER NOT, it'd mean NTLM is no longer available with ossl3]
    This leaves the example [FIXED] and TLS-SRP as the remining reasons. (TLS-SRP is a barely supported, insecure security feature.) [in context of this PR only examples were an issue]

@vszakats vszakats marked this pull request as draft February 13, 2026 16:06
@vszakats vszakats changed the title TEST: -Wunused-macros build: fix -Wunused-macros warnings Feb 14, 2026
@vszakats vszakats changed the title build: fix -Wunused-macros warnings build: fix -Wunused-macros warnings, and related tidy-ups Feb 14, 2026
@vszakats vszakats force-pushed the unusedmacro branch 3 times, most recently from 44e2513 to 7b2a35a Compare February 15, 2026 10:28
vszakats added a commit to vszakats/curl that referenced this pull request Feb 15, 2026
Document functions/features needing it.

Cherry-picked from curl#20593
vszakats added a commit to vszakats/curl that referenced this pull request Feb 15, 2026
Also to avoid `-Wunused-macros` warnings.

Cherry-picked from curl#20593
vszakats added a commit that referenced this pull request Feb 15, 2026
Document functions/features requiring it.

Follow-up to cab0402 #10543
Cherry-picked from #20593

Closes #20600
vszakats added a commit that referenced this pull request Feb 15, 2026
Also to avoid `-Wunused-macros` warnings.

Follow-up to 8a3740b #14059
Cherry-picked from #20593

Closes #20601
@vszakats vszakats force-pushed the unusedmacro branch 2 times, most recently from fa655a6 to 3ab1c68 Compare February 18, 2026 19:37
vszakats added a commit to vszakats/curl that referenced this pull request Feb 18, 2026
vszakats added a commit that referenced this pull request Feb 18, 2026
@vszakats vszakats marked this pull request as ready for review February 18, 2026 21:05
CMakeLists.txt limit OPENSSL_SUPPRESS_DEPRECATED to OpenSSL in feature detections

CMakeLists.txt cleanup openssl3 flow

CMakeLists.txt cleanup openssl3 flow comment

CMakeLists.txt update ossl3 deprec comment

curl-openssl.m4 omit OPENSSL_SUPPRESS_DEPRECATED from version detection

CMakeLists.txt update ossl3 depr funcs

cm try limiting deprec suppression to lib

tweak comment

CMakeLists.txt update comment ossl3

curl_setup.h cleanup
This reverts commit 77cbf1fc9d9a0e702190b84739f0897d4c7c0029.

Simpler/safer the other way. Potential downside is 3rd-party build systems.

Also OPENSSL_SUPPRESS_DEPRECATED and the LIBRESSL macro remains in curl_setup.h,
adding inconsistency.
This reverts commit 74e4792eaf4d76aafe76001f63b6304c101e0a29.
@vszakats vszakats closed this in 5fa5cb3 Feb 18, 2026
@vszakats vszakats deleted the unusedmacro branch February 18, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant