fix: macOS compile warnings#171
Merged
Merged
Conversation
The OLD_CRUFTY_SSL_VERSION macro used defined() inside a #define, which produces undefined behavior when expanded in #if directives. Split into #ifdef/#else branches to evaluate the LibreSSL check at preprocessing time instead. Also cast SvPV_nolen() result to UNSIGNED_CHAR* to fix pointer sign mismatch warning in _load_rsa_key(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix two categories of compiler warnings emitted on macOS (and any platform with strict warning flags):
-Wexpansion-to-defined— TheOLD_CRUFTY_SSL_VERSIONmacro useddefined()inside a#define, which is undefined behavior per the C standard when expanded in#ifdirectives. Split into#ifdef/#elsebranches so the LibreSSL check is resolved at preprocessing time.-Wpointer-sign—SvPV_nolen()returnschar*but was assigned to anUNSIGNED_CHAR*variable (which resolves tounsigned char*on OpenSSL 3.x). Added an explicit cast.Fixes #170
Changes
OLD_CRUFTY_SSL_VERSIONmacro into#ifdef LIBRESSL_VERSION_NUMBER/#elsebranches to avoiddefined()inside#defineSvPV_nolen()return value toUNSIGNED_CHAR*in_load_rsa_key()Test plan
perl Makefile.PL && make— zero warnings emittedGenerated by Kōan /fix
Quality Report
Changes: 1 file changed, 6 insertions(+), 2 deletions(-)
Code scan: clean
Tests: failed (18 Failed, 1 test)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline