Build cleanly on GCC 14 / OpenSSL 3: fix all compiler warnings#327
Open
garacil wants to merge 1 commit into
Open
Build cleanly on GCC 14 / OpenSSL 3: fix all compiler warnings#327garacil wants to merge 1 commit into
garacil wants to merge 1 commit into
Conversation
master built with 25 compiler warnings on GCC 14.2 against OpenSSL 3.x. Fix all of them with no behavior or ABI change, so the library compiles absolutely clean. Array-parameter bound mismatches (-Warray-parameter, GCC 14): align the prototype and definition spellings of the array-of-one / pointer parameters GCC now flags — the internal HEAP_DECLARE (heap.h) and HTABLE bodies (htable.h) macros, and su_home_stat_add(), bsd_localinfo() and nua_destroy_event(). An array-of-N parameter decays to a pointer, so the call ABI is unchanged; public prototypes are left untouched (the definitions are aligned to them instead). OpenSSL 3.0 deprecations (-Wdeprecated-declarations): - ws.c: compute the WebSocket-handshake SHA-1 with the one-shot EVP_Digest() / EVP_sha1() instead of the deprecated SHA1_Init/Update/Final. - ws.c, tport_tls.c: the function name was dropped from OpenSSL 3.0 error records, so keep ERR_func_error_string() below 3.0 and log an empty function field from 3.0 on (version-gated). - tport_tls.c: from OpenSSL 3.0, read the DH parameters as a generic EVP_PKEY and install them with SSL_CTX_set0_tmp_dh_pkey(), verifying the file really holds DH parameters (EVP_PKEY_is_a) and freeing the key only when ownership is not transferred (not-DH or set0 failure); the pre-3.0 PEM_read_bio_DHparams / SSL_CTX_set_tmp_dh / DH_free path is unchanged. - stun.c: TLSv1_client_method() (deprecated in 1.1.0) pinned exactly TLS 1.0, so use TLS_client_method() bounded to TLS 1.0 via the min and max protocol version, preserving the original behavior. Const-qualifier discard (-Wdiscarded-qualifiers): sip_identity_d() writes NUL terminators into its mutable char *s, so its scan pointers are plain char *. Unused static declaration (-Wunused-function): move the private tport_ws_deinit_secondary() prototype out of the shared tport_ws.h header into tport_type_ws.c, its only definition and use site.
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.
Building
masteron GCC 14.2 against OpenSSL 3.x currently emits 25 warnings. This fixes all of them so the library compiles with zero warnings / zero errors, with no behavior or ABI change (soname unchanged).Closes #61, #81, #208. Related: #268, #326.
Changes
-Warray-parameter(new in GCC 14): align the prototype/definition spellings of the array-of-one / pointer parameters GCC now flags — the internalHEAP_DECLARE(heap.h) andHTABLEbodies (htable.h) macros, andsu_home_stat_add(),bsd_localinfo(),nua_destroy_event(). An array-of-N parameter decays to a pointer, so the call ABI is unchanged; public prototypes are left untouched (the definitions are aligned to them).-Wdeprecated-declarations(OpenSSL 3.0):ws.c: compute the WebSocket-handshake SHA-1 with the one-shotEVP_Digest/EVP_sha1instead of the deprecatedSHA1_Init/SHA1_Update/SHA1_Final.ws.c,tport_tls.c: the function name was dropped from OpenSSL 3.0 error records, soERR_func_error_string()is kept below 3.0 and an empty function field is logged from 3.0 on (version-gated).tport_tls.c: from OpenSSL 3.0, read the DH parameters as a genericEVP_PKEYand install them withSSL_CTX_set0_tmp_dh_pkey(), verifying the file really holds DH parameters (EVP_PKEY_is_a("DH")) and freeing the key only when ownership is not transferred; the pre-3.0PEM_read_bio_DHparams/SSL_CTX_set_tmp_dh/DH_freepath is unchanged.stun.c:TLSv1_client_method()(deprecated in 1.1.0) pinned exactly TLS 1.0, so it is replaced withTLS_client_method()bounded to TLS 1.0 via the min and max protocol version, preserving the original behavior.-Wdiscarded-qualifiers:sip_identity_d()writes NUL terminators into its mutablechar *s, so its scan pointers are plainchar *.-Wunused-function: the privatetport_ws_deinit_secondary()prototype is moved out of the sharedtport_ws.hheader intotport_type_ws.c, its only definition and use site.Each change is behavior-preserving; verified by a full
make clean && makeon GCC 14.2 / OpenSSL 3.5.6 (0 warnings, 0 errors). Happy to split this into per-category commits if you'd prefer.