Skip to content

Fix five compiler warnings in OpenSSL 3.x code paths#191

Draft
toddr-bot wants to merge 2 commits into
cpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-remaining-compiler-warnings
Draft

Fix five compiler warnings in OpenSSL 3.x code paths#191
toddr-bot wants to merge 2 commits into
cpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-remaining-compiler-warnings

Conversation

@toddr-bot
Copy link
Copy Markdown
Contributor

What

Fix five compiler warnings (-Wunused-but-set-variable, -Wmaybe-uninitialized) in the OpenSSL 3.x code paths.

Why

Building with -Wall -Wextra produces 8 warnings. PR #185 addresses 3 of them; this PR fixes the remaining 5, making the 3.x code path warning-clean.

How

  • -Wunused-but-set-variable: rsa_crypt(), get_public_key_string(), sign(), and verify() all use the THROW macro which sets an error variable, but their err: handlers unconditionally croak via CHECK_OPEN_SSL(0) without reading error. Replaced THROW(x) with direct if (!(x)) goto err; and removed the unused error declarations.

  • -Wmaybe-uninitialized: verify_result in verify() could appear uninitialized to the compiler because the err: path (which always croaks) is not provably noreturn. Initialized to -1 so the default: switch case handles it safely.

Testing

🤖 Generated with Claude Code

toddr-bot and others added 2 commits May 22, 2026 23:50
Replace THROW macro with direct if+goto in rsa_crypt(),
get_public_key_string(), sign(), and verify() — these error
handlers always croak unconditionally, making the THROW-set
error variable unused (-Wunused-but-set-variable).

Initialize verify_result to -1 to silence -Wmaybe-uninitialized
warning (the err path croaks before the switch, but the compiler
cannot prove this).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EVP_PKEY_sign_init returns 1 on success, 0 on error, or -2 if the
operation is not supported. The bare truthiness check (!result) treated
-2 as success. Use != 1 for consistency with the other EVP_PKEY_*_init
checks in this file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant