Skip to content

Build cleanly on GCC 14 / OpenSSL 3: fix all compiler warnings#327

Open
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:gcc14-openssl3-warning-fixes
Open

Build cleanly on GCC 14 / OpenSSL 3: fix all compiler warnings#327
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:gcc14-openssl3-warning-fixes

Conversation

@garacil

@garacil garacil commented Jul 5, 2026

Copy link
Copy Markdown

Building master on 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 internal HEAP_DECLARE (heap.h) and HTABLE bodies (htable.h) macros, and su_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-shot EVP_Digest/EVP_sha1 instead of the deprecated SHA1_Init/SHA1_Update/SHA1_Final.
    • ws.c, tport_tls.c: the function name was dropped from OpenSSL 3.0 error records, so ERR_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 generic EVP_PKEY and install them with SSL_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.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 it is replaced with TLS_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 mutable char *s, so its scan pointers are plain char *.
  • -Wunused-function: the private tport_ws_deinit_secondary() prototype is moved out of the shared tport_ws.h header into tport_type_ws.c, its only definition and use site.

Each change is behavior-preserving; verified by a full make clean && make on GCC 14.2 / OpenSSL 3.5.6 (0 warnings, 0 errors). Happy to split this into per-category commits if you'd prefer.

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.
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.

compiler warnings on debian 10

1 participant