build: address some -Weverything warnings, update picky warnings

`-Weverything` is not enabled by curl, and not recommended by LLVM,
because it may enable experimental options, and will result in new
fallouts after toolchain upgrades. This patch aims to fix/silence as much
as possible as found with llvm/clang 21.1.0. It also permanently enables
warnings that were fixed in source and deemed manageable in the future.
`-Wformat` warnings are addressed separately via #18343.

Fix/silence warnings in the source:
- typecheck-gcc.h: fix `-Wreserved-identifier`.
- lib: silence `-Wcast-function-type-strict`.
  For llvm 16+ or Apple clang 16+.
- asyn-ares: limit `HAPPY_EYEBALLS_DNS_TIMEOUT` to old c-ares versions.
- curl_trc: fix `-Wc++-hidden-decl`.
- doh: fix `-Wc++-keyword`.
- ftp: fix `-Wreserved-identifier`.
- ldap: fix `-Wreserved-identifier`.
- mqtt: comment unused macro to avoid warning.
- multi_ev: drop unused macros to avoid warnings.
- setopt: fix useless `break;` after `return;`.
- gtls, mbedtls, rustls: silence `-Wconditional-uninitialized`.
- socks_sspi, schannel, x509asn1: fix `-Wimplicit-int-enum-cast`.
- x509asn1: fix `-Wc++-keyword`.
- openssl: scope `OSSL_UI_METHOD_CAST` to avoid unused macro warning.
- libssh2, wolfssl: drop unused macros.
- curl_ngtcp2, curl_quiche, httpsrr, urlapi: drop/limit unused macros.
- tool_getparam: fix useless `break;` after `return;` or `break;`.
  Not normally enabled because it doesn't work with unity.
  https://github.com/llvm/llvm-project/issues/71046
- tool_operate: fix `-Wc++-keyword`.
- curlinfo: fix a `-Wunsafe-buffer-usage`.
- tests: silence `-Wformat-non-iso`.
- lib557: fix `-Wreserved-identifier`.
- lib1565: silence `-Wconditional-uninitialized`.

Enable the above clang warnings permanently in picky mode:
- `-Wc++-hidden-decl`
- `-Wc++-keyword` (except for Windows, where it collides with `wchar_t`)
- `-Wcast-function-type-strict`
- `-Wcast-function-type`
- `-Wconditional-uninitialized`
- `-Wformat-non-iso` (except for clang-cl)
- `-Wreserved-identifier`
- `-Wtentative-definition-compat`

Silence problematic `-Weverything` warnings globally (in picky mode):
- `-Wused-but-marked-unused` (88000+ hits) and
  `-Wdisabled-macro-expansion` (2600+ hits).
  Triggered by `typecheck-gcc.h` when building with clang 14+.
  Maybe there exists a way to fix within that header?
  Ref: https://discourse.llvm.org/t/removing-wused-but-marked-unused/55310
- `-Wunsafe-buffer-usage`. clang 16+. 7000+ hits.
  May be useful in theory, but such high volume of hits makes it
  impractical to review and possibly address. Meant for C++.
  Ref: https://clang.llvm.org/docs/SafeBuffers.html
  Ref: https://stackoverflow.com/questions/77017567/how-to-fix-code-to-avoid-warning-wunsafe-buffer-usage
  Ref: https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
  Ref: https://github.com/llvm/llvm-project/pull/111624
- `-Wimplicit-void-ptr-cast`. clang 21+. 1700+ hits.
  C++ warning, deemed pure noise.
  Ref: https://github.com/curl/curl/issues/18470#issuecomment-3253506266
- `-Wswitch-default` (180+ hits), `-Wswitch-enum` (190+ hits),
  `-Wcovered-switch-default` (20+ hits).
  Next to impossible to fix cleanly, esp. when the covered `case`
  branches depend on compile-time options.
- `-Wdocumentation-unknown-command` (8+ hits).
  Triggered in a few sources. Seems arbitrary and bogus.
- `-Wpadded` (550+ hits).
- `-Wc++-keyword` on Windows, where it collides with `wchar_t`.
  (100+ hits)
  Ref: https://github.com/llvm/llvm-project/issues/155988
- `-Wreserved-macro-identifier`. clang 13+. 5+ hits.
  Sometimes it's necessary to set external macros that use
  the reserved namespace. E.g. `_CRT_NONSTDC_NO_DEPRECATE`,
  `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__`, `__NO_NET_API`,
  possibly `_REENTRANT`, and more.
  It's not worth trying to silence them individually.
- `-Wnonportable-system-include-path` with `clang-cl`.
  It'd be broken by doing what the warning suggests.
- `-Wformat-non-iso` for clang-cl.

CMake `PICKY_COMPILER=ON` (the default) or `./configure`
`--enable-warnings` (not the default) is required to enable these
silencing rules.

Also:
- autotools, cmake: fix Apple clang and mainline llvm version translations.
  Ref: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
- autotools, cmake: enable `-Warray-compare` for clang 20+.
  Follow-up to 4b7accda5a #17196
- cmake: fix to enable `-Wmissing-variable-declarations` at an earlier
  clang version.
- cmake: update internal logic to handle warning options with `+` in
  them.
- cmake: fix internal logic to match the whole option when looking
  into `CMAKE_C_FLAGS` for custom-disabled warnings.

Follow-up to b85cb8cb4e #18485

Closes #18477
This commit is contained in:
Viktor Szakats
2025-09-04 11:56:33 +02:00
parent 87cbeecee4
commit 92f215fea1
36 changed files with 533 additions and 360 deletions

View File

@@ -47,8 +47,8 @@ endif()
if(APPLE AND
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.6) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.3))
list(APPEND _picky "-Werror=partial-availability") # clang 3.6 appleclang 6.3
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.1))
list(APPEND _picky "-Werror=partial-availability") # clang 3.6 appleclang 6.1
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -87,6 +87,9 @@ if(PICKY_COMPILER)
set(_picky_detect
)
# Notes: -Wno-* options should ideally be disabled at their precise cutoff versions,
# to suppress undesired warnings in case -Weverything is passed as a custom option.
# Assume these options always exist with both clang and gcc.
# Require clang 3.0 / gcc 2.95 or later.
list(APPEND _picky_enable
@@ -121,13 +124,14 @@ if(PICKY_COMPILER)
-Wmissing-field-initializers # clang 2.7 gcc 4.1
-Wmissing-noreturn # clang 2.7 gcc 4.1
-Wno-format-nonliteral # clang 1.0 gcc 2.96 (3.0)
-Wno-padded # clang 2.9 gcc 4.1 # Not used: We cannot change public structs
-Wno-sign-conversion # clang 2.9 gcc 4.3
-Wno-switch-default # clang 2.7 gcc 4.1 # Not used: Annoying to fix or silence
-Wno-switch-enum # clang 2.7 gcc 4.1 # Not used: It basically disallows default case
-Wno-system-headers # clang 1.0 gcc 3.0
# -Wpadded # clang 2.9 gcc 4.1 # Not used: We cannot change public structs
-Wold-style-definition # clang 2.7 gcc 3.4
-Wredundant-decls # clang 2.7 gcc 4.1
-Wstrict-prototypes # clang 1.0 gcc 3.3
# -Wswitch-enum # clang 2.7 gcc 4.1 # Not used: It basically disallows default case
-Wtype-limits # clang 2.7 gcc 4.3
-Wunreachable-code # clang 2.7 gcc 4.1
# -Wunused-macros # clang 2.7 gcc 4.1 # Not practical
@@ -139,6 +143,8 @@ if(PICKY_COMPILER)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
list(APPEND _picky_enable
${_picky_common_old}
-Wconditional-uninitialized # clang 3.0
-Wno-used-but-marked-unused # clang 3.0 # Triggered by typecheck-gcc.h (with clang 14+)
-Wshift-sign-overflow # clang 2.9
-Wshorten-64-to-32 # clang 1.0
-Wformat=2 # clang 3.0 gcc 4.8
@@ -149,39 +155,102 @@ if(PICKY_COMPILER)
)
endif()
# Enable based on compiler version
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.6) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.3))
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1)
list(APPEND _picky_enable
-Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.3
-Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.6 g++ 11.0
-Wno-covered-switch-default # clang 3.1 appleclang 3.1 # Annoying to fix or silence
-Wno-disabled-macro-expansion # clang 3.1 appleclang 3.1 # Triggered by typecheck-gcc.h (with clang 14+)
)
if(MSVC)
list(APPEND _picky_enable
-Wno-format-non-iso # clang 3.1 appleclang 3.1 # 'q' length modifier is not supported by ISO C
)
else()
list(APPEND _picky_enable
-Wformat-non-iso # clang 3.1 appleclang 3.1
)
endif()
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.3) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0))
list(APPEND _picky_enable
-Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.2 g++ 11.0
-Wmissing-variable-declarations # clang 3.2 appleclang 4.2
-Wno-documentation-unknown-command # clang 3.3 appleclang 5.0
-Wsometimes-uninitialized # clang 3.2 appleclang 4.2
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.6) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.1))
list(APPEND _picky_enable
-Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.1
-Wheader-guard # clang 3.4 appleclang 5.1
-Wpragmas # clang 3.5 gcc 4.1 appleclang 6.0
-Wsometimes-uninitialized # clang 3.2 appleclang 4.6
# -Wunreachable-code-break # clang 3.5 appleclang 6.0 # Not used: Silent in "unity" builds
-Wunused-const-variable # clang 3.4 gcc 6.0 appleclang 5.1
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.3))
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1))
list(APPEND _picky_enable
-Wcomma # clang 3.9 appleclang 8.3
-Wmissing-variable-declarations # clang 3.2 appleclang 4.6
-Wcomma # clang 3.9 appleclang 8.1
)
if(MSVC)
list(APPEND _picky_enable
-Wno-nonportable-system-include-path # clang 3.9 appleclang 8.1 # No truly portable solution to this
)
endif()
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.3))
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11))
list(APPEND _picky_enable
-Wassign-enum # clang 7.0 appleclang 10.3
-Wextra-semi-stmt # clang 7.0 appleclang 10.3
-Wassign-enum # clang 7.0 appleclang 11.0
-Wextra-semi-stmt # clang 7.0 appleclang 11.0
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.4))
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12))
list(APPEND _picky_enable
-Wimplicit-fallthrough # clang 4.0 gcc 7.0 appleclang 12.4 # We do silencing for clang 10.0 and above only
-Wxor-used-as-pow # clang 10.0 gcc 13.0
-Wimplicit-fallthrough # clang 4.0 gcc 7.0 appleclang 9.0 # We do silencing for clang 10.0 and above only
-Wxor-used-as-pow # clang 10.0 gcc 13.0 appleclang 12.0
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1))
list(APPEND _picky_enable
-Wcast-function-type # clang 13.0 appleclang 13.1
-Wreserved-identifier # clang 13.0 appleclang 13.1 # Keep it before -Wno-reserved-macro-identifier
-Wno-reserved-macro-identifier # clang 13.0 appleclang 13.1 # External macros have to be set sometimes
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0))
list(APPEND _picky_enable
-Wno-unsafe-buffer-usage # clang 16.0 appleclang 15.0
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))
list(APPEND _picky_enable
-Wcast-function-type-strict # clang 16.0 appleclang 16.0
)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.0)
list(APPEND _picky_enable
-Warray-compare # clang 20.0 gcc 12.0 appleclang ?
-Wc++-hidden-decl # clang 21.0 appleclang ?
-Wno-implicit-void-ptr-cast # clang 21.0 appleclang ?
-Wtentative-definition-compat # clang 21.0 appleclang ?
)
if(WIN32)
list(APPEND _picky_enable
-Wno-c++-keyword # clang 21.0 appleclang ? # `wchar_t` triggers it on Windows
)
else()
list(APPEND _picky_enable
-Wc++-keyword # clang 21.0 appleclang ?
)
endif()
endif()
else() # gcc
# Enable based on compiler version
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.3)
@@ -207,7 +276,7 @@ if(PICKY_COMPILER)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
list(APPEND _picky_enable
-Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.3
-Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.1
-Wformat=2 # clang 3.0 gcc 4.8
-Wtrampolines # gcc 4.6
)
@@ -232,21 +301,21 @@ if(PICKY_COMPILER)
-Walloc-zero # gcc 7.0
-Wduplicated-branches # gcc 7.0
-Wformat-truncation=2 # gcc 7.0
-Wimplicit-fallthrough # clang 4.0 gcc 7.0
-Wimplicit-fallthrough # clang 4.0 gcc 7.0 appleclang 9.0
-Wrestrict # gcc 7.0
)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
list(APPEND _picky_enable
-Warith-conversion # gcc 10.0
-Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.6 g++ 11.0
-Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.2 g++ 11.0
)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
list(APPEND _picky_enable
-Warray-compare # clang 20.0 gcc 12.0
-Warray-compare # clang 20.0 gcc 12.0 appleclang ?
-Wenum-int-mismatch # gcc 13.0
-Wxor-used-as-pow # clang 10.0 gcc 13.0
-Wxor-used-as-pow # clang 10.0 gcc 13.0 appleclang 12.0
)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0)
@@ -262,8 +331,11 @@ if(PICKY_COMPILER)
set(_picky_skipped "")
foreach(_ccopt IN LISTS _picky_enable)
string(REGEX MATCH "-W([a-z0-9-]+)" _ccmatch "${_ccopt}")
if(_ccmatch AND CMAKE_C_FLAGS MATCHES "-Wno-${CMAKE_MATCH_1}" AND NOT _ccopt STREQUAL "-Wall" AND NOT _ccopt MATCHES "^-Wno-")
string(REGEX MATCH "-W([a-z0-9+-]+)" _ccmatch "${_ccopt}")
string(REPLACE "+" "\\+" _cmake_match_1 "${CMAKE_MATCH_1}") # escape '+' to make it a valid regex
if(_ccmatch AND "${CMAKE_C_FLAGS} " MATCHES "-Wno-${_cmake_match_1} " AND
NOT _ccopt STREQUAL "-Wall" AND
NOT _ccopt MATCHES "^-Wno-")
string(APPEND _picky_skipped " ${_ccopt}")
else()
list(APPEND _picky "${_ccopt}")

View File

@@ -29,9 +29,9 @@
/* To add a new kind of warning, add an
* if(curlcheck_sometype_option(_curl_opt))
* if(!curlcheck_sometype(value))
* _curl_easy_setopt_err_sometype();
* Wcurl_easy_setopt_err_sometype();
* block and define curlcheck_sometype_option, curlcheck_sometype and
* _curl_easy_setopt_err_sometype below
* Wcurl_easy_setopt_err_sometype below
*
* NOTE: We use two nested 'if' statements here instead of the && operator, in
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
@@ -47,113 +47,113 @@
CURL_IGNORE_DEPRECATION( \
if(curlcheck_long_option(option)) \
if(!curlcheck_long(value)) \
_curl_easy_setopt_err_long(); \
Wcurl_easy_setopt_err_long(); \
if(curlcheck_off_t_option(option)) \
if(!curlcheck_off_t(value)) \
_curl_easy_setopt_err_curl_off_t(); \
Wcurl_easy_setopt_err_curl_off_t(); \
if(curlcheck_string_option(option)) \
if(!curlcheck_string(value)) \
_curl_easy_setopt_err_string(); \
Wcurl_easy_setopt_err_string(); \
if((option) == CURLOPT_PRIVATE) { } \
if(curlcheck_write_cb_option(option)) \
if(!curlcheck_write_cb(value)) \
_curl_easy_setopt_err_write_callback(); \
Wcurl_easy_setopt_err_write_callback(); \
if(curlcheck_curl_option(option)) \
if(!curlcheck_curl(value)) \
_curl_easy_setopt_err_curl(); \
Wcurl_easy_setopt_err_curl(); \
if((option) == CURLOPT_RESOLVER_START_FUNCTION) \
if(!curlcheck_resolver_start_callback(value)) \
_curl_easy_setopt_err_resolver_start_callback(); \
Wcurl_easy_setopt_err_resolver_start_callback(); \
if((option) == CURLOPT_READFUNCTION) \
if(!curlcheck_read_cb(value)) \
_curl_easy_setopt_err_read_cb(); \
Wcurl_easy_setopt_err_read_cb(); \
if((option) == CURLOPT_IOCTLFUNCTION) \
if(!curlcheck_ioctl_cb(value)) \
_curl_easy_setopt_err_ioctl_cb(); \
Wcurl_easy_setopt_err_ioctl_cb(); \
if((option) == CURLOPT_SOCKOPTFUNCTION) \
if(!curlcheck_sockopt_cb(value)) \
_curl_easy_setopt_err_sockopt_cb(); \
Wcurl_easy_setopt_err_sockopt_cb(); \
if((option) == CURLOPT_OPENSOCKETFUNCTION) \
if(!curlcheck_opensocket_cb(value)) \
_curl_easy_setopt_err_opensocket_cb(); \
Wcurl_easy_setopt_err_opensocket_cb(); \
if((option) == CURLOPT_PROGRESSFUNCTION) \
if(!curlcheck_progress_cb(value)) \
_curl_easy_setopt_err_progress_cb(); \
Wcurl_easy_setopt_err_progress_cb(); \
if((option) == CURLOPT_XFERINFOFUNCTION) \
if(!curlcheck_xferinfo_cb(value)) \
_curl_easy_setopt_err_xferinfo_cb(); \
Wcurl_easy_setopt_err_xferinfo_cb(); \
if((option) == CURLOPT_DEBUGFUNCTION) \
if(!curlcheck_debug_cb(value)) \
_curl_easy_setopt_err_debug_cb(); \
Wcurl_easy_setopt_err_debug_cb(); \
if((option) == CURLOPT_SSL_CTX_FUNCTION) \
if(!curlcheck_ssl_ctx_cb(value)) \
_curl_easy_setopt_err_ssl_ctx_cb(); \
Wcurl_easy_setopt_err_ssl_ctx_cb(); \
if(curlcheck_conv_cb_option(option)) \
if(!curlcheck_conv_cb(value)) \
_curl_easy_setopt_err_conv_cb(); \
Wcurl_easy_setopt_err_conv_cb(); \
if((option) == CURLOPT_SEEKFUNCTION) \
if(!curlcheck_seek_cb(value)) \
_curl_easy_setopt_err_seek_cb(); \
Wcurl_easy_setopt_err_seek_cb(); \
if((option) == CURLOPT_CHUNK_BGN_FUNCTION) \
if(!curlcheck_chunk_bgn_cb(value)) \
_curl_easy_setopt_err_chunk_bgn_cb(); \
Wcurl_easy_setopt_err_chunk_bgn_cb(); \
if((option) == CURLOPT_CHUNK_END_FUNCTION) \
if(!curlcheck_chunk_end_cb(value)) \
_curl_easy_setopt_err_chunk_end_cb(); \
Wcurl_easy_setopt_err_chunk_end_cb(); \
if((option) == CURLOPT_CLOSESOCKETFUNCTION) \
if(!curlcheck_close_socket_cb(value)) \
_curl_easy_setopt_err_close_socket_cb(); \
Wcurl_easy_setopt_err_close_socket_cb(); \
if((option) == CURLOPT_FNMATCH_FUNCTION) \
if(!curlcheck_fnmatch_cb(value)) \
_curl_easy_setopt_err_fnmatch_cb(); \
Wcurl_easy_setopt_err_fnmatch_cb(); \
if((option) == CURLOPT_HSTSREADFUNCTION) \
if(!curlcheck_hstsread_cb(value)) \
_curl_easy_setopt_err_hstsread_cb(); \
Wcurl_easy_setopt_err_hstsread_cb(); \
if((option) == CURLOPT_HSTSWRITEFUNCTION) \
if(!curlcheck_hstswrite_cb(value)) \
_curl_easy_setopt_err_hstswrite_cb(); \
Wcurl_easy_setopt_err_hstswrite_cb(); \
if((option) == CURLOPT_SSH_HOSTKEYFUNCTION) \
if(!curlcheck_ssh_hostkey_cb(value)) \
_curl_easy_setopt_err_ssh_hostkey_cb(); \
Wcurl_easy_setopt_err_ssh_hostkey_cb(); \
if((option) == CURLOPT_SSH_KEYFUNCTION) \
if(!curlcheck_ssh_key_cb(value)) \
_curl_easy_setopt_err_ssh_key_cb(); \
Wcurl_easy_setopt_err_ssh_key_cb(); \
if((option) == CURLOPT_INTERLEAVEFUNCTION) \
if(!curlcheck_interleave_cb(value)) \
_curl_easy_setopt_err_interleave_cb(); \
Wcurl_easy_setopt_err_interleave_cb(); \
if((option) == CURLOPT_PREREQFUNCTION) \
if(!curlcheck_prereq_cb(value)) \
_curl_easy_setopt_err_prereq_cb(); \
Wcurl_easy_setopt_err_prereq_cb(); \
if((option) == CURLOPT_TRAILERFUNCTION) \
if(!curlcheck_trailer_cb(value)) \
_curl_easy_setopt_err_trailer_cb(); \
Wcurl_easy_setopt_err_trailer_cb(); \
if(curlcheck_cb_data_option(option)) \
if(!curlcheck_cb_data(value)) \
_curl_easy_setopt_err_cb_data(); \
Wcurl_easy_setopt_err_cb_data(); \
if((option) == CURLOPT_ERRORBUFFER) \
if(!curlcheck_error_buffer(value)) \
_curl_easy_setopt_err_error_buffer(); \
Wcurl_easy_setopt_err_error_buffer(); \
if((option) == CURLOPT_CURLU) \
if(!curlcheck_ptr((value), CURLU)) \
_curl_easy_setopt_err_curlu(); \
Wcurl_easy_setopt_err_curlu(); \
if((option) == CURLOPT_STDERR) \
if(!curlcheck_FILE(value)) \
_curl_easy_setopt_err_FILE(); \
Wcurl_easy_setopt_err_FILE(); \
if(curlcheck_postfields_option(option)) \
if(!curlcheck_postfields(value)) \
_curl_easy_setopt_err_postfields(); \
Wcurl_easy_setopt_err_postfields(); \
if((option) == CURLOPT_HTTPPOST) \
if(!curlcheck_arr((value), struct curl_httppost)) \
_curl_easy_setopt_err_curl_httpost(); \
Wcurl_easy_setopt_err_curl_httpost(); \
if((option) == CURLOPT_MIMEPOST) \
if(!curlcheck_ptr((value), curl_mime)) \
_curl_easy_setopt_err_curl_mimepost(); \
Wcurl_easy_setopt_err_curl_mimepost(); \
if(curlcheck_slist_option(option)) \
if(!curlcheck_arr((value), struct curl_slist)) \
_curl_easy_setopt_err_curl_slist(); \
Wcurl_easy_setopt_err_curl_slist(); \
if((option) == CURLOPT_SHARE) \
if(!curlcheck_ptr((value), CURLSH)) \
_curl_easy_setopt_err_CURLSH(); \
Wcurl_easy_setopt_err_CURLSH(); \
) \
} \
curl_easy_setopt(handle, option, value); \
@@ -166,28 +166,28 @@
CURL_IGNORE_DEPRECATION( \
if(curlcheck_string_info(info)) \
if(!curlcheck_arr((arg), char *)) \
_curl_easy_getinfo_err_string(); \
Wcurl_easy_getinfo_err_string(); \
if(curlcheck_long_info(info)) \
if(!curlcheck_arr((arg), long)) \
_curl_easy_getinfo_err_long(); \
Wcurl_easy_getinfo_err_long(); \
if(curlcheck_double_info(info)) \
if(!curlcheck_arr((arg), double)) \
_curl_easy_getinfo_err_double(); \
Wcurl_easy_getinfo_err_double(); \
if(curlcheck_slist_info(info)) \
if(!curlcheck_arr((arg), struct curl_slist *)) \
_curl_easy_getinfo_err_curl_slist(); \
Wcurl_easy_getinfo_err_curl_slist(); \
if(curlcheck_tlssessioninfo_info(info)) \
if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
_curl_easy_getinfo_err_curl_tlssessioninfo(); \
Wcurl_easy_getinfo_err_curl_tlssessioninfo(); \
if(curlcheck_certinfo_info(info)) \
if(!curlcheck_arr((arg), struct curl_certinfo *)) \
_curl_easy_getinfo_err_curl_certinfo(); \
Wcurl_easy_getinfo_err_curl_certinfo(); \
if(curlcheck_socket_info(info)) \
if(!curlcheck_arr((arg), curl_socket_t)) \
_curl_easy_getinfo_err_curl_socket(); \
Wcurl_easy_getinfo_err_curl_socket(); \
if(curlcheck_off_t_info(info)) \
if(!curlcheck_arr((arg), curl_off_t)) \
_curl_easy_getinfo_err_curl_off_t(); \
Wcurl_easy_getinfo_err_curl_off_t(); \
) \
} \
curl_easy_getinfo(handle, info, arg); \
@@ -198,25 +198,25 @@
if(__builtin_constant_p(option)) { \
if(curlcheck_long_option(option)) \
if(!curlcheck_long(value)) \
_curl_multi_setopt_err_long(); \
Wcurl_multi_setopt_err_long(); \
if(curlcheck_off_t_option(option)) \
if(!curlcheck_off_t(value)) \
_curl_multi_setopt_err_curl_off_t(); \
Wcurl_multi_setopt_err_curl_off_t(); \
if(curlcheck_multicb_data_option(option)) \
if(!curlcheck_cb_data(value)) \
_curl_multi_setopt_err_cb_data(); \
Wcurl_multi_setopt_err_cb_data(); \
if(curlcheck_charpp_option(option)) \
if(!curlcheck_ptrptr(value, char)) \
_curl_multi_setopt_err_charpp(); \
Wcurl_multi_setopt_err_charpp(); \
if((option) == CURLMOPT_PUSHFUNCTION) \
if(!curlcheck_multipush_cb(value)) \
_curl_multi_setopt_err_pushcb(); \
Wcurl_multi_setopt_err_pushcb(); \
if((option) == CURLMOPT_SOCKETFUNCTION) \
if(!curlcheck_multisocket_cb(value)) \
_curl_multi_setopt_err_socketcb(); \
Wcurl_multi_setopt_err_socketcb(); \
if((option) == CURLMOPT_TIMERFUNCTION) \
if(!curlcheck_multitimer_cb(value)) \
_curl_multi_setopt_err_timercb(); \
Wcurl_multi_setopt_err_timercb(); \
} \
curl_multi_setopt(handle, option, value); \
})
@@ -256,7 +256,7 @@
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
/* the actual warnings, triggered by calling the Wcurl_easy_setopt_err*
* functions */
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
@@ -265,117 +265,117 @@
__attribute__((__unused__)) __attribute__((__noinline__)) \
id(void) { __asm__(""); }
CURLWARNING(_curl_multi_setopt_err_long,
CURLWARNING(Wcurl_multi_setopt_err_long,
"curl_multi_setopt expects a long argument")
CURLWARNING(_curl_multi_setopt_err_curl_off_t,
CURLWARNING(Wcurl_multi_setopt_err_curl_off_t,
"curl_multi_setopt expects a curl_off_t argument")
CURLWARNING(_curl_multi_setopt_err_cb_data,
CURLWARNING(Wcurl_multi_setopt_err_cb_data,
"curl_multi_setopt expects a 'void *' argument")
CURLWARNING(_curl_multi_setopt_err_charpp,
CURLWARNING(Wcurl_multi_setopt_err_charpp,
"curl_multi_setopt expects a 'char **' argument")
CURLWARNING(_curl_multi_setopt_err_pushcb,
CURLWARNING(Wcurl_multi_setopt_err_pushcb,
"curl_multi_setopt expects a curl_push_callback argument")
CURLWARNING(_curl_multi_setopt_err_socketcb,
CURLWARNING(Wcurl_multi_setopt_err_socketcb,
"curl_multi_setopt expects a curl_socket_callback argument")
CURLWARNING(_curl_multi_setopt_err_timercb,
CURLWARNING(Wcurl_multi_setopt_err_timercb,
"curl_multi_setopt expects a curl_multi_timer_callback argument")
CURLWARNING(_curl_easy_setopt_err_long,
CURLWARNING(Wcurl_easy_setopt_err_long,
"curl_easy_setopt expects a long argument")
CURLWARNING(_curl_easy_setopt_err_curl_off_t,
CURLWARNING(Wcurl_easy_setopt_err_curl_off_t,
"curl_easy_setopt expects a curl_off_t argument")
CURLWARNING(_curl_easy_setopt_err_string,
CURLWARNING(Wcurl_easy_setopt_err_string,
"curl_easy_setopt expects a "
"string ('char *' or char[]) argument")
CURLWARNING(_curl_easy_setopt_err_write_callback,
CURLWARNING(Wcurl_easy_setopt_err_write_callback,
"curl_easy_setopt expects a curl_write_callback argument")
CURLWARNING(_curl_easy_setopt_err_resolver_start_callback,
CURLWARNING(Wcurl_easy_setopt_err_resolver_start_callback,
"curl_easy_setopt expects a "
"curl_resolver_start_callback argument")
CURLWARNING(_curl_easy_setopt_err_read_cb,
CURLWARNING(Wcurl_easy_setopt_err_read_cb,
"curl_easy_setopt expects a curl_read_callback argument")
CURLWARNING(_curl_easy_setopt_err_ioctl_cb,
CURLWARNING(Wcurl_easy_setopt_err_ioctl_cb,
"curl_easy_setopt expects a curl_ioctl_callback argument")
CURLWARNING(_curl_easy_setopt_err_sockopt_cb,
CURLWARNING(Wcurl_easy_setopt_err_sockopt_cb,
"curl_easy_setopt expects a curl_sockopt_callback argument")
CURLWARNING(_curl_easy_setopt_err_opensocket_cb,
CURLWARNING(Wcurl_easy_setopt_err_opensocket_cb,
"curl_easy_setopt expects a "
"curl_opensocket_callback argument")
CURLWARNING(_curl_easy_setopt_err_progress_cb,
CURLWARNING(Wcurl_easy_setopt_err_progress_cb,
"curl_easy_setopt expects a curl_progress_callback argument")
CURLWARNING(_curl_easy_setopt_err_xferinfo_cb,
CURLWARNING(Wcurl_easy_setopt_err_xferinfo_cb,
"curl_easy_setopt expects a curl_xferinfo_callback argument")
CURLWARNING(_curl_easy_setopt_err_debug_cb,
CURLWARNING(Wcurl_easy_setopt_err_debug_cb,
"curl_easy_setopt expects a curl_debug_callback argument")
CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb,
CURLWARNING(Wcurl_easy_setopt_err_ssl_ctx_cb,
"curl_easy_setopt expects a curl_ssl_ctx_callback argument")
CURLWARNING(_curl_easy_setopt_err_conv_cb,
CURLWARNING(Wcurl_easy_setopt_err_conv_cb,
"curl_easy_setopt expects a curl_conv_callback argument")
CURLWARNING(_curl_easy_setopt_err_seek_cb,
CURLWARNING(Wcurl_easy_setopt_err_seek_cb,
"curl_easy_setopt expects a curl_seek_callback argument")
CURLWARNING(_curl_easy_setopt_err_cb_data,
CURLWARNING(Wcurl_easy_setopt_err_cb_data,
"curl_easy_setopt expects a "
"private data pointer as argument")
CURLWARNING(_curl_easy_setopt_err_chunk_bgn_cb,
CURLWARNING(Wcurl_easy_setopt_err_chunk_bgn_cb,
"curl_easy_setopt expects a curl_chunk_bgn_callback argument")
CURLWARNING(_curl_easy_setopt_err_chunk_end_cb,
CURLWARNING(Wcurl_easy_setopt_err_chunk_end_cb,
"curl_easy_setopt expects a curl_chunk_end_callback argument")
CURLWARNING(_curl_easy_setopt_err_close_socket_cb,
CURLWARNING(Wcurl_easy_setopt_err_close_socket_cb,
"curl_easy_setopt expects a curl_closesocket_callback argument")
CURLWARNING(_curl_easy_setopt_err_fnmatch_cb,
CURLWARNING(Wcurl_easy_setopt_err_fnmatch_cb,
"curl_easy_setopt expects a curl_fnmatch_callback argument")
CURLWARNING(_curl_easy_setopt_err_hstsread_cb,
CURLWARNING(Wcurl_easy_setopt_err_hstsread_cb,
"curl_easy_setopt expects a curl_hstsread_callback argument")
CURLWARNING(_curl_easy_setopt_err_hstswrite_cb,
CURLWARNING(Wcurl_easy_setopt_err_hstswrite_cb,
"curl_easy_setopt expects a curl_hstswrite_callback argument")
CURLWARNING(_curl_easy_setopt_err_ssh_key_cb,
CURLWARNING(Wcurl_easy_setopt_err_ssh_key_cb,
"curl_easy_setopt expects a curl_sshkeycallback argument")
CURLWARNING(_curl_easy_setopt_err_ssh_hostkey_cb,
CURLWARNING(Wcurl_easy_setopt_err_ssh_hostkey_cb,
"curl_easy_setopt expects a curl_sshhostkeycallback argument")
CURLWARNING(_curl_easy_setopt_err_interleave_cb,
CURLWARNING(Wcurl_easy_setopt_err_interleave_cb,
"curl_easy_setopt expects a curl_interleave_callback argument")
CURLWARNING(_curl_easy_setopt_err_prereq_cb,
CURLWARNING(Wcurl_easy_setopt_err_prereq_cb,
"curl_easy_setopt expects a curl_prereq_callback argument")
CURLWARNING(_curl_easy_setopt_err_trailer_cb,
CURLWARNING(Wcurl_easy_setopt_err_trailer_cb,
"curl_easy_setopt expects a curl_trailerfunc_ok argument")
CURLWARNING(_curl_easy_setopt_err_error_buffer,
CURLWARNING(Wcurl_easy_setopt_err_error_buffer,
"curl_easy_setopt expects a "
"char buffer of CURL_ERROR_SIZE as argument")
CURLWARNING(_curl_easy_setopt_err_curlu,
CURLWARNING(Wcurl_easy_setopt_err_curlu,
"curl_easy_setopt expects a 'CURLU *' argument")
CURLWARNING(_curl_easy_setopt_err_curl,
CURLWARNING(Wcurl_easy_setopt_err_curl,
"curl_easy_setopt expects a 'CURL *' argument")
CURLWARNING(_curl_easy_setopt_err_FILE,
CURLWARNING(Wcurl_easy_setopt_err_FILE,
"curl_easy_setopt expects a 'FILE *' argument")
CURLWARNING(_curl_easy_setopt_err_postfields,
CURLWARNING(Wcurl_easy_setopt_err_postfields,
"curl_easy_setopt expects a 'void *' or 'char *' argument")
CURLWARNING(_curl_easy_setopt_err_curl_httpost,
CURLWARNING(Wcurl_easy_setopt_err_curl_httpost,
"curl_easy_setopt expects a 'struct curl_httppost *' "
"argument")
CURLWARNING(_curl_easy_setopt_err_curl_mimepost,
CURLWARNING(Wcurl_easy_setopt_err_curl_mimepost,
"curl_easy_setopt expects a 'curl_mime *' "
"argument")
CURLWARNING(_curl_easy_setopt_err_curl_slist,
CURLWARNING(Wcurl_easy_setopt_err_curl_slist,
"curl_easy_setopt expects a 'struct curl_slist *' argument")
CURLWARNING(_curl_easy_setopt_err_CURLSH,
CURLWARNING(Wcurl_easy_setopt_err_CURLSH,
"curl_easy_setopt expects a CURLSH* argument")
CURLWARNING(_curl_easy_getinfo_err_string,
CURLWARNING(Wcurl_easy_getinfo_err_string,
"curl_easy_getinfo expects a pointer to 'char *'")
CURLWARNING(_curl_easy_getinfo_err_long,
CURLWARNING(Wcurl_easy_getinfo_err_long,
"curl_easy_getinfo expects a pointer to long")
CURLWARNING(_curl_easy_getinfo_err_double,
CURLWARNING(Wcurl_easy_getinfo_err_double,
"curl_easy_getinfo expects a pointer to double")
CURLWARNING(_curl_easy_getinfo_err_curl_slist,
CURLWARNING(Wcurl_easy_getinfo_err_curl_slist,
"curl_easy_getinfo expects a pointer to 'struct curl_slist *'")
CURLWARNING(_curl_easy_getinfo_err_curl_tlssessioninfo,
CURLWARNING(Wcurl_easy_getinfo_err_curl_tlssessioninfo,
"curl_easy_getinfo expects a pointer to "
"'struct curl_tlssessioninfo *'")
CURLWARNING(_curl_easy_getinfo_err_curl_certinfo,
CURLWARNING(Wcurl_easy_getinfo_err_curl_certinfo,
"curl_easy_getinfo expects a pointer to "
"'struct curl_certinfo *'")
CURLWARNING(_curl_easy_getinfo_err_curl_socket,
CURLWARNING(Wcurl_easy_getinfo_err_curl_socket,
"curl_easy_getinfo expects a pointer to curl_socket_t")
CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
CURLWARNING(Wcurl_easy_getinfo_err_curl_off_t,
"curl_easy_getinfo expects a pointer to curl_off_t")
/* groups of curl_easy_setops options that take the same type of argument */
@@ -704,60 +704,60 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), __typeof__(fread) *) || \
curlcheck_cb_compatible((expr), curl_read_callback) || \
curlcheck_cb_compatible((expr), _curl_read_callback1) || \
curlcheck_cb_compatible((expr), _curl_read_callback2) || \
curlcheck_cb_compatible((expr), _curl_read_callback3) || \
curlcheck_cb_compatible((expr), _curl_read_callback4) || \
curlcheck_cb_compatible((expr), _curl_read_callback5) || \
curlcheck_cb_compatible((expr), _curl_read_callback6))
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
curlcheck_cb_compatible((expr), Wcurl_read_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_read_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_read_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_read_callback4) || \
curlcheck_cb_compatible((expr), Wcurl_read_callback5) || \
curlcheck_cb_compatible((expr), Wcurl_read_callback6))
typedef size_t (*Wcurl_read_callback1)(char *, size_t, size_t, void *);
typedef size_t (*Wcurl_read_callback2)(char *, size_t, size_t, const void *);
typedef size_t (*Wcurl_read_callback3)(char *, size_t, size_t, FILE *);
typedef size_t (*Wcurl_read_callback4)(void *, size_t, size_t, void *);
typedef size_t (*Wcurl_read_callback5)(void *, size_t, size_t, const void *);
typedef size_t (*Wcurl_read_callback6)(void *, size_t, size_t, FILE *);
/* evaluates to true if expr is of type curl_write_callback or "similar" */
#define curlcheck_write_cb(expr) \
(curlcheck_read_cb(expr) || \
curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \
curlcheck_cb_compatible((expr), curl_write_callback) || \
curlcheck_cb_compatible((expr), _curl_write_callback1) || \
curlcheck_cb_compatible((expr), _curl_write_callback2) || \
curlcheck_cb_compatible((expr), _curl_write_callback3) || \
curlcheck_cb_compatible((expr), _curl_write_callback4) || \
curlcheck_cb_compatible((expr), _curl_write_callback5) || \
curlcheck_cb_compatible((expr), _curl_write_callback6))
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
curlcheck_cb_compatible((expr), Wcurl_write_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_write_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_write_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_write_callback4) || \
curlcheck_cb_compatible((expr), Wcurl_write_callback5) || \
curlcheck_cb_compatible((expr), Wcurl_write_callback6))
typedef size_t (*Wcurl_write_callback1)(const char *, size_t, size_t, void *);
typedef size_t (*Wcurl_write_callback2)(const char *, size_t, size_t,
const void *);
typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
typedef size_t (*Wcurl_write_callback3)(const char *, size_t, size_t, FILE *);
typedef size_t (*Wcurl_write_callback4)(const void *, size_t, size_t, void *);
typedef size_t (*Wcurl_write_callback5)(const void *, size_t, size_t,
const void *);
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
typedef size_t (*Wcurl_write_callback6)(const void *, size_t, size_t, FILE *);
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
#define curlcheck_ioctl_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_ioctl_callback) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback4))
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
curlcheck_cb_compatible((expr), Wcurl_ioctl_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_ioctl_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_ioctl_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_ioctl_callback4))
typedef curlioerr (*Wcurl_ioctl_callback1)(CURL *, int, void *);
typedef curlioerr (*Wcurl_ioctl_callback2)(CURL *, int, const void *);
typedef curlioerr (*Wcurl_ioctl_callback3)(CURL *, curliocmd, void *);
typedef curlioerr (*Wcurl_ioctl_callback4)(CURL *, curliocmd, const void *);
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
#define curlcheck_sockopt_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_sockopt_callback) || \
curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \
curlcheck_cb_compatible((expr), _curl_sockopt_callback2))
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
curlcheck_cb_compatible((expr), Wcurl_sockopt_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_sockopt_callback2))
typedef int (*Wcurl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
typedef int (*Wcurl_sockopt_callback2)(const void *, curl_socket_t,
curlsocktype);
/* evaluates to true if expr is of type curl_opensocket_callback or
@@ -765,28 +765,28 @@ typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
#define curlcheck_opensocket_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_opensocket_callback) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback4))
typedef curl_socket_t (*_curl_opensocket_callback1)
curlcheck_cb_compatible((expr), Wcurl_opensocket_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_opensocket_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_opensocket_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_opensocket_callback4))
typedef curl_socket_t (*Wcurl_opensocket_callback1)
(void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback2)
typedef curl_socket_t (*Wcurl_opensocket_callback2)
(void *, curlsocktype, const struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback3)
typedef curl_socket_t (*Wcurl_opensocket_callback3)
(const void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback4)
typedef curl_socket_t (*Wcurl_opensocket_callback4)
(const void *, curlsocktype, const struct curl_sockaddr *);
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
#define curlcheck_progress_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_progress_callback) || \
curlcheck_cb_compatible((expr), _curl_progress_callback1) || \
curlcheck_cb_compatible((expr), _curl_progress_callback2))
typedef int (*_curl_progress_callback1)(void *,
curlcheck_cb_compatible((expr), Wcurl_progress_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_progress_callback2))
typedef int (*Wcurl_progress_callback1)(void *,
double, double, double, double);
typedef int (*_curl_progress_callback2)(const void *,
typedef int (*Wcurl_progress_callback2)(const void *,
double, double, double, double);
/* evaluates to true if expr is of type curl_xferinfo_callback */
@@ -798,29 +798,29 @@ typedef int (*_curl_progress_callback2)(const void *,
#define curlcheck_debug_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_debug_callback) || \
curlcheck_cb_compatible((expr), _curl_debug_callback1) || \
curlcheck_cb_compatible((expr), _curl_debug_callback2) || \
curlcheck_cb_compatible((expr), _curl_debug_callback3) || \
curlcheck_cb_compatible((expr), _curl_debug_callback4) || \
curlcheck_cb_compatible((expr), _curl_debug_callback5) || \
curlcheck_cb_compatible((expr), _curl_debug_callback6) || \
curlcheck_cb_compatible((expr), _curl_debug_callback7) || \
curlcheck_cb_compatible((expr), _curl_debug_callback8))
typedef int (*_curl_debug_callback1) (CURL *,
curlcheck_cb_compatible((expr), Wcurl_debug_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback4) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback5) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback6) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback7) || \
curlcheck_cb_compatible((expr), Wcurl_debug_callback8))
typedef int (*Wcurl_debug_callback1) (CURL *,
curl_infotype, char *, size_t, void *);
typedef int (*_curl_debug_callback2) (CURL *,
typedef int (*Wcurl_debug_callback2) (CURL *,
curl_infotype, char *, size_t, const void *);
typedef int (*_curl_debug_callback3) (CURL *,
typedef int (*Wcurl_debug_callback3) (CURL *,
curl_infotype, const char *, size_t, void *);
typedef int (*_curl_debug_callback4) (CURL *,
typedef int (*Wcurl_debug_callback4) (CURL *,
curl_infotype, const char *, size_t, const void *);
typedef int (*_curl_debug_callback5) (CURL *,
typedef int (*Wcurl_debug_callback5) (CURL *,
curl_infotype, unsigned char *, size_t, void *);
typedef int (*_curl_debug_callback6) (CURL *,
typedef int (*Wcurl_debug_callback6) (CURL *,
curl_infotype, unsigned char *, size_t, const void *);
typedef int (*_curl_debug_callback7) (CURL *,
typedef int (*Wcurl_debug_callback7) (CURL *,
curl_infotype, const unsigned char *, size_t, void *);
typedef int (*_curl_debug_callback8) (CURL *,
typedef int (*Wcurl_debug_callback8) (CURL *,
curl_infotype, const unsigned char *, size_t, const void *);
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
@@ -828,66 +828,66 @@ typedef int (*_curl_debug_callback8) (CURL *,
#define curlcheck_ssl_ctx_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8))
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback4) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback5) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback6) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback7) || \
curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback8))
typedef CURLcode (*Wcurl_ssl_ctx_callback1)(CURL *, void *, void *);
typedef CURLcode (*Wcurl_ssl_ctx_callback2)(CURL *, void *, const void *);
typedef CURLcode (*Wcurl_ssl_ctx_callback3)(CURL *, const void *, void *);
typedef CURLcode (*Wcurl_ssl_ctx_callback4)(CURL *, const void *,
const void *);
#ifdef HEADER_SSL_H
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
* this will of course break if we are included before OpenSSL headers...
*/
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
typedef CURLcode (*Wcurl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
typedef CURLcode (*Wcurl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
typedef CURLcode (*Wcurl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
typedef CURLcode (*Wcurl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
const void *);
#else
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback5;
typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback6;
typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback7;
typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback8;
#endif
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
#define curlcheck_conv_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_conv_callback) || \
curlcheck_cb_compatible((expr), _curl_conv_callback1) || \
curlcheck_cb_compatible((expr), _curl_conv_callback2) || \
curlcheck_cb_compatible((expr), _curl_conv_callback3) || \
curlcheck_cb_compatible((expr), _curl_conv_callback4))
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
curlcheck_cb_compatible((expr), Wcurl_conv_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_conv_callback2) || \
curlcheck_cb_compatible((expr), Wcurl_conv_callback3) || \
curlcheck_cb_compatible((expr), Wcurl_conv_callback4))
typedef CURLcode (*Wcurl_conv_callback1)(char *, size_t length);
typedef CURLcode (*Wcurl_conv_callback2)(const char *, size_t length);
typedef CURLcode (*Wcurl_conv_callback3)(void *, size_t length);
typedef CURLcode (*Wcurl_conv_callback4)(const void *, size_t length);
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
#define curlcheck_seek_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_seek_callback) || \
curlcheck_cb_compatible((expr), _curl_seek_callback1) || \
curlcheck_cb_compatible((expr), _curl_seek_callback2))
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
curlcheck_cb_compatible((expr), Wcurl_seek_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_seek_callback2))
typedef CURLcode (*Wcurl_seek_callback1)(void *, curl_off_t, int);
typedef CURLcode (*Wcurl_seek_callback2)(const void *, curl_off_t, int);
/* evaluates to true if expr is of type curl_chunk_bgn_callback */
#define curlcheck_chunk_bgn_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_chunk_bgn_callback) || \
curlcheck_cb_compatible((expr), _curl_chunk_bgn_callback1) || \
curlcheck_cb_compatible((expr), _curl_chunk_bgn_callback2))
typedef long (*_curl_chunk_bgn_callback1)(struct curl_fileinfo *,
curlcheck_cb_compatible((expr), Wcurl_chunk_bgn_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_chunk_bgn_callback2))
typedef long (*Wcurl_chunk_bgn_callback1)(struct curl_fileinfo *,
void *, int);
typedef long (*_curl_chunk_bgn_callback2)(void *, void *, int);
typedef long (*Wcurl_chunk_bgn_callback2)(void *, void *, int);
/* evaluates to true if expr is of type curl_chunk_end_callback */
#define curlcheck_chunk_end_cb(expr) \
@@ -927,11 +927,11 @@ typedef long (*_curl_chunk_bgn_callback2)(void *, void *, int);
/* evaluates to true if expr is of type curl_interleave_callback */
#define curlcheck_interleave_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), _curl_interleave_callback1) || \
curlcheck_cb_compatible((expr), _curl_interleave_callback2))
typedef size_t (*_curl_interleave_callback1)(void *p, size_t s,
curlcheck_cb_compatible((expr), Wcurl_interleave_callback1) || \
curlcheck_cb_compatible((expr), Wcurl_interleave_callback2))
typedef size_t (*Wcurl_interleave_callback1)(void *p, size_t s,
size_t n, void *u);
typedef size_t (*_curl_interleave_callback2)(char *p, size_t s,
typedef size_t (*Wcurl_interleave_callback2)(char *p, size_t s,
size_t n, void *u);
/* evaluates to true if expr is of type curl_prereq_callback */

View File

@@ -85,6 +85,17 @@
#if ARES_VERSION >= 0x011000
/* 1.16.0 or later has ares_getaddrinfo */
#define HAVE_CARES_GETADDRINFO 1
#else
/* How long we are willing to wait for additional parallel responses after
obtaining a "definitive" one. For old c-ares without getaddrinfo.
This is intended to equal the c-ares default timeout. cURL always uses that
default value. Unfortunately, c-ares does not expose its default timeout in
its API, but it is officially documented as 5 seconds.
See query_completed_cb() for an explanation of how this is used.
*/
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000
#endif
#ifdef USE_HTTPSRR
@@ -99,17 +110,6 @@
#include "curl_memory.h"
#include "memdebug.h"
/* How long we are willing to wait for additional parallel responses after
obtaining a "definitive" one. For old c-ares without getaddrinfo.
This is intended to equal the c-ares default timeout. cURL always uses that
default value. Unfortunately, c-ares does not expose its default timeout in
its API, but it is officially documented as 5 seconds.
See query_completed_cb() for an explanation of how this is used.
*/
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000
#define CARES_TIMEOUT_PER_ATTEMPT 2000
static int ares_ver = 0;

View File

@@ -640,8 +640,6 @@ void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf,
(void)data; (void)cf; (void)fmt;
}
struct curl_trc_feat;
void Curl_trc_multi(struct Curl_easy *data, const char *fmt, ...)
{
(void)data; (void)fmt;

View File

@@ -95,6 +95,11 @@ void Curl_trc_read(struct Curl_easy *data,
void Curl_trc_dns(struct Curl_easy *data,
const char *fmt, ...) CURL_PRINTF(2, 3);
struct curl_trc_feat {
const char *name;
int log_level;
};
#ifndef CURL_DISABLE_FTP
extern struct curl_trc_feat Curl_trc_feat_ftp;
void Curl_trc_ftp(struct Curl_easy *data,
@@ -184,11 +189,6 @@ void Curl_trc_ws(struct Curl_easy *data,
#endif /* !CURL_HAVE_C99 */
struct curl_trc_feat {
const char *name;
int log_level;
};
#ifndef CURL_DISABLE_VERBOSE_STRINGS
/* informational messages enabled */

View File

@@ -134,8 +134,15 @@ bool curlx_verify_windows_version(const unsigned int majorVersion,
static bool onetime = TRUE; /* safe because first call is during init */
if(onetime) {
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
pRtlVerifyVersionInfo = CURLX_FUNCTION_CAST(RTLVERIFYVERSIONINFO_FN,
(GetProcAddress(GetModuleHandleA("ntdll"), "RtlVerifyVersionInfo")));
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
onetime = FALSE;
}

View File

@@ -759,7 +759,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
ancount = doh_get16bit(doh, 6);
while(ancount) {
unsigned short class;
unsigned short dnsclass;
unsigned int ttl;
rc = doh_skipqname(doh, dohlen, &index);
@@ -779,8 +779,8 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
class = doh_get16bit(doh, index);
if(DNS_CLASS_IN != class)
dnsclass = doh_get16bit(doh, index);
if(DNS_CLASS_IN != dnsclass)
return DOH_DNS_UNEXPECTED_CLASS; /* unsupported */
index += 2;
@@ -816,7 +816,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
if(dohlen < (index + 8))
return DOH_DNS_OUT_OF_RANGE;
index += 2 + 2 + 4; /* type, class and ttl */
index += 2 + 2 + 4; /* type, dnsclass and ttl */
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
@@ -838,7 +838,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
if(dohlen < (index + 8))
return DOH_DNS_OUT_OF_RANGE;
index += 2 + 2 + 4; /* type, class and ttl */
index += 2 + 2 + 4; /* type, dnsclass and ttl */
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;

View File

@@ -868,10 +868,17 @@ CURLcode Curl_getformdata(CURL *data,
particular, freopen(stdin) by the caller is not guaranteed
to result as expected. This feature has been kept for backward
compatibility: use of "-" pseudo filename should be avoided. */
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
result = curl_mime_data_cb(part, (curl_off_t) -1,
(curl_read_callback) fread,
fseeko_wrapper,
NULL, (void *) stdin);
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
}
else
result = curl_mime_filedata(part, file->contents);

View File

@@ -142,11 +142,11 @@ static const char * const ftp_state_names[]={
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
/* This is the ONLY way to change FTP state! */
static void _ftp_state(struct Curl_easy *data,
struct ftp_conn *ftpc,
ftpstate newstate
static void ftp_state_low(struct Curl_easy *data,
struct ftp_conn *ftpc,
ftpstate newstate
#ifdef DEBUGBUILD
, int lineno
, int lineno
#endif
)
{
@@ -172,9 +172,9 @@ static void _ftp_state(struct Curl_easy *data,
/* Local API functions */
#ifndef DEBUGBUILD
#define ftp_state(x,y,z) _ftp_state(x,y,z)
#define ftp_state(x,y,z) ftp_state_low(x,y,z)
#else /* !DEBUGBUILD */
#define ftp_state(x,y,z) _ftp_state(x,y,z,__LINE__)
#define ftp_state(x,y,z) ftp_state_low(x,y,z,__LINE__)
#endif /* DEBUGBUILD */
static CURLcode ftp_sendquote(struct Curl_easy *data,

View File

@@ -38,8 +38,6 @@
#include "curl_memory.h"
#include "memdebug.h"
#define MAX_ALPN_LENGTH 255
static CURLcode httpsrr_decode_alpn(const char *cp, size_t len,
unsigned char *alpns)
{

View File

@@ -119,30 +119,30 @@ struct ldap_urldesc {
char *lud_filter;
#endif
char **lud_exts;
size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the
"real" struct so can only be used in code
without HAVE_LDAP_URL_PARSE defined */
size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the
"real" struct so can only be used in code
without HAVE_LDAP_URL_PARSE defined */
};
#undef LDAPURLDesc
#define LDAPURLDesc struct ldap_urldesc
static int _ldap_url_parse(struct Curl_easy *data,
const struct connectdata *conn,
LDAPURLDesc **ludp);
static void _ldap_free_urldesc(LDAPURLDesc *ludp);
static int ldap_url_parse_low(struct Curl_easy *data,
const struct connectdata *conn,
LDAPURLDesc **ludp);
static void ldap_free_urldesc_low(LDAPURLDesc *ludp);
#undef ldap_free_urldesc
#define ldap_free_urldesc _ldap_free_urldesc
#define ldap_free_urldesc ldap_free_urldesc_low
#endif
#ifdef DEBUG_LDAP
#define LDAP_TRACE(x) do { \
_ldap_trace("%u: ", __LINE__); \
_ldap_trace x; \
ldap_trace_low("%u: ", __LINE__); \
ldap_trace_low x; \
} while(0)
static void _ldap_trace(const char *fmt, ...) CURL_PRINTF(1, 2);
static void ldap_trace_low(const char *fmt, ...) CURL_PRINTF(1, 2);
#else
#define LDAP_TRACE(x) Curl_nop_stmt
#endif
@@ -346,7 +346,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
#ifdef HAVE_LDAP_URL_PARSE
rc = ldap_url_parse(data->state.url, &ludp);
#else
rc = _ldap_url_parse(data, conn, &ludp);
rc = ldap_url_parse_low(data, conn, &ludp);
#endif
if(rc) {
failf(data, "Bad LDAP URL: %s", ldap_err2string((curl_ldap_num_t)rc));
@@ -728,7 +728,7 @@ quit:
}
#ifdef DEBUG_LDAP
static void _ldap_trace(const char *fmt, ...)
static void ldap_trace_low(const char *fmt, ...)
{
static int do_trace = -1;
va_list args;
@@ -795,8 +795,9 @@ static size_t num_entries(const char *s)
*
* Defined in RFC4516 section 2.
*/
static int _ldap_url_parse2(struct Curl_easy *data,
const struct connectdata *conn, LDAPURLDesc *ludp)
static int ldap_url_parse2_low(struct Curl_easy *data,
const struct connectdata *conn,
LDAPURLDesc *ludp)
{
int rc = LDAP_SUCCESS;
char *p;
@@ -999,9 +1000,9 @@ quit:
return rc;
}
static int _ldap_url_parse(struct Curl_easy *data,
const struct connectdata *conn,
LDAPURLDesc **ludpp)
static int ldap_url_parse_low(struct Curl_easy *data,
const struct connectdata *conn,
LDAPURLDesc **ludpp)
{
LDAPURLDesc *ludp = calloc(1, sizeof(*ludp));
int rc;
@@ -1010,16 +1011,16 @@ static int _ldap_url_parse(struct Curl_easy *data,
if(!ludp)
return LDAP_NO_MEMORY;
rc = _ldap_url_parse2(data, conn, ludp);
rc = ldap_url_parse2_low(data, conn, ludp);
if(rc != LDAP_SUCCESS) {
_ldap_free_urldesc(ludp);
ldap_free_urldesc_low(ludp);
ludp = NULL;
}
*ludpp = ludp;
return rc;
}
static void _ldap_free_urldesc(LDAPURLDesc *ludp)
static void ldap_free_urldesc_low(LDAPURLDesc *ludp)
{
if(!ludp)
return;

View File

@@ -54,7 +54,7 @@
#define MQTT_MSG_SUBSCRIBE 0x82
#define MQTT_MSG_SUBACK 0x90
#define MQTT_MSG_DISCONNECT 0xe0
#define MQTT_MSG_PINGREQ 0xC0
/* #define MQTT_MSG_PINGREQ 0xC0 */
#define MQTT_MSG_PINGRESP 0xD0
#define MQTT_CONNACK_LEN 2

View File

@@ -51,8 +51,6 @@ static void mev_in_callback(struct Curl_multi *multi, bool value)
multi->in_callback = value;
}
#define CURL_MEV_CONN_HASH_SIZE 3
/* Information about a socket for which we inform the libcurl application
* what to supervise (CURL_POLL_IN/CURL_POLL_OUT/CURL_POLL_REMOVE)
*/
@@ -636,8 +634,6 @@ void Curl_multi_ev_conn_done(struct Curl_multi *multi,
Curl_conn_meta_remove(conn, CURL_META_MEV_POLLSET);
}
#define CURL_MEV_PS_HASH_SLOTS (991) /* nice prime */
void Curl_multi_ev_init(struct Curl_multi *multi, size_t hashsize)
{
Curl_hash_init(&multi->ev.sh_entries, hashsize, mev_sh_entry_hash,

View File

@@ -878,7 +878,14 @@ static CURLcode cr_in_rewind(struct Curl_easy *data,
/* If no CURLOPT_READFUNCTION is used, we know that we operate on a
given FILE * stream and we can actually attempt to rewind that
ourselves with fseek() */
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
if(data->state.fread_func == (curl_read_callback)fread) {
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
int err = fseek(data->state.in, 0, SEEK_SET);
CURL_TRC_READ(data, "cr_in, rewind via fseek -> %d(%d)",
(int)err, (int)errno);

View File

@@ -818,10 +818,10 @@ static CURLcode setopt_bool(struct Curl_easy *data, CURLoption option,
#if defined(CONNECT_DATA_IDEMPOTENT) || defined(MSG_FASTOPEN) || \
defined(TCP_FASTOPEN_CONNECT)
s->tcp_fastopen = enabled;
break;
#else
return CURLE_NOT_BUILT_IN;
#endif
break;
case CURLOPT_SSL_ENABLE_ALPN:
s->ssl_enable_alpn = enabled;
break;
@@ -2637,8 +2637,15 @@ static CURLcode setopt_func(struct Curl_easy *data, CURLoption option,
*/
s->fwrite_func = va_arg(param, curl_write_callback);
if(!s->fwrite_func)
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
/* When set to NULL, reset to our internal default function */
s->fwrite_func = (curl_write_callback)fwrite;
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
break;
case CURLOPT_READFUNCTION:
/*
@@ -2647,8 +2654,15 @@ static CURLcode setopt_func(struct Curl_easy *data, CURLoption option,
s->fread_func_set = va_arg(param, curl_read_callback);
if(!s->fread_func_set) {
s->is_fread_set = 0;
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
/* When set to NULL, reset to our internal default function */
s->fread_func_set = (curl_read_callback)fread;
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
}
else
s->is_fread_set = 1;

View File

@@ -71,7 +71,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
CURLcode code;
size_t actualread;
size_t written;
int result;
CURLcode result;
int err;
/* Needs GSS-API authentication */
SECURITY_STATUS status;
unsigned long sspi_ret_flags = 0;
@@ -236,8 +237,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
* +----+------+-----+----------------+
*/
result = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
if(result || (actualread != 4)) {
err = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
if(err || (actualread != 4)) {
failf(data, "Failed to receive SSPI authentication response.");
result = CURLE_COULDNT_CONNECT;
goto error;
@@ -268,10 +269,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
result = CURLE_OUT_OF_MEMORY;
goto error;
}
result = Curl_blockread_all(cf, data, (char *)sspi_recv_token.pvBuffer,
sspi_recv_token.cbBuffer, &actualread);
err = Curl_blockread_all(cf, data, (char *)sspi_recv_token.pvBuffer,
sspi_recv_token.cbBuffer, &actualread);
if(result || (actualread != us_length)) {
if(err || (actualread != us_length)) {
failf(data, "Failed to receive SSPI authentication token.");
result = CURLE_COULDNT_CONNECT;
goto error;
@@ -452,8 +453,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
Curl_safefree(etbuf);
}
result = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
if(result || (actualread != 4)) {
err = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
if(err || (actualread != 4)) {
failf(data, "Failed to receive SSPI encryption response.");
result = CURLE_COULDNT_CONNECT;
goto error;
@@ -484,10 +485,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
goto error;
}
result = Curl_blockread_all(cf, data, (char *)sspi_w_token[0].pvBuffer,
sspi_w_token[0].cbBuffer, &actualread);
err = Curl_blockread_all(cf, data, (char *)sspi_w_token[0].pvBuffer,
sspi_w_token[0].cbBuffer, &actualread);
if(result || (actualread != us_length)) {
if(err || (actualread != us_length)) {
failf(data, "Failed to receive SSPI encryption type.");
result = CURLE_COULDNT_CONNECT;
goto error;

View File

@@ -365,11 +365,18 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
set->in_set = stdin; /* default input from stdin */
set->err = stderr; /* default stderr to stderr */
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
/* use fwrite as default function to store output */
set->fwrite_func = (curl_write_callback)fwrite;
/* use fread as default function to read input */
set->fread_func_set = (curl_read_callback)fread;
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
set->is_fread_set = 0;
set->seek_client = ZERO_NULL;

View File

@@ -42,11 +42,13 @@
#include "curl_memory.h"
#include "memdebug.h"
#ifdef _WIN32
/* MS-DOS/Windows style drive prefix, eg c: in c:foo */
#define STARTS_WITH_DRIVE_PREFIX(str) \
((('a' <= str[0] && str[0] <= 'z') || \
('A' <= str[0] && str[0] <= 'Z')) && \
(str[1] == ':'))
#endif
/* MS-DOS/Windows style drive prefix, optionally with
* a '|' instead of ':', followed by a slash or NUL */

View File

@@ -80,7 +80,6 @@
#define QUIC_MAX_STREAMS (256*1024)
#define QUIC_MAX_DATA (1*1024*1024)
#define QUIC_HANDSHAKE_TIMEOUT (10*NGTCP2_SECONDS)
/* A stream window is the maximum amount we need to buffer for
@@ -102,8 +101,6 @@
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE ) / 2
/* Receive and Send max number of chunks just follows from the
* chunk size and window size */
#define H3_STREAM_RECV_CHUNKS \
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
#define H3_STREAM_SEND_CHUNKS \
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
@@ -1445,10 +1442,6 @@ cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id,
return (nghttp3_ssize)nvecs;
}
/* Index where :authority header field will appear in request header
field list. */
#define AUTHORITY_DST_IDX 3
static CURLcode h3_stream_open(struct Curl_cfilter *cf,
struct Curl_easy *data,
const void *buf, size_t len,

View File

@@ -75,8 +75,6 @@
* chunk size and window size */
#define H3_STREAM_RECV_CHUNKS \
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
#define H3_STREAM_SEND_CHUNKS \
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
/*
* Store quiche version info in this buffer.
@@ -955,10 +953,6 @@ static CURLcode cf_quiche_send_body(struct Curl_cfilter *cf,
}
}
/* Index where :authority header field will appear in request header
field list. */
#define AUTHORITY_DST_IDX 3
static CURLcode h3_open_stream(struct Curl_cfilter *cf,
struct Curl_easy *data,
const char *buf, size_t blen, bool eos,

View File

@@ -1216,9 +1216,6 @@ sftp_upload_init(struct Curl_easy *data,
return CURLE_OK;
}
/* make sure that this does not collide with an actual libssh2 error code */
#define ERROR_LIBBSH2 1
static CURLcode ssh_state_pkey_init(struct Curl_easy *data,
struct ssh_conn *sshc)
{
@@ -3411,12 +3408,19 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
*/
#if LIBSSH2_VERSION_NUM >= 0x010b01
infof(data, "Uses HTTPS proxy");
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
libssh2_session_callback_set2(sshc->ssh_session,
LIBSSH2_CALLBACK_RECV,
(libssh2_cb_generic *)ssh_tls_recv);
libssh2_session_callback_set2(sshc->ssh_session,
LIBSSH2_CALLBACK_SEND,
(libssh2_cb_generic *)ssh_tls_send);
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
#else
/*
* This crazy union dance is here to avoid assigning a void pointer a

View File

@@ -2064,7 +2064,7 @@ static CURLcode gtls_shutdown(struct Curl_cfilter *cf,
(struct gtls_ssl_backend_data *)connssl->backend;
char buf[1024];
CURLcode result = CURLE_OK;
ssize_t nread;
ssize_t nread = 0;
size_t i;
DEBUGASSERT(backend);

View File

@@ -1160,7 +1160,7 @@ static CURLcode mbedtls_shutdown(struct Curl_cfilter *cf,
(struct mbed_ssl_backend_data *)connssl->backend;
unsigned char buf[1024];
CURLcode result = CURLE_OK;
int ret;
int ret = 0;
size_t i;
DEBUGASSERT(backend);

View File

@@ -137,13 +137,13 @@ static void ossl_provider_cleanup(struct Curl_easy *data);
#if defined(USE_OPENSSL_ENGINE) || defined(OPENSSL_HAS_PROVIDERS)
#include <openssl/ui.h>
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#define OSSL_UI_METHOD_CAST(x) (x)
#else
#define OSSL_UI_METHOD_CAST(x) CURL_UNCONST(x)
#endif
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* OpenSSL 1.1.0+ and LibreSSL */
#define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */
@@ -1631,7 +1631,14 @@ static int pkcs12load(struct Curl_easy *data,
fail:
EVP_PKEY_free(pri);
X509_free(x509);
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
sk_X509_pop_free(ca, X509_free);
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
if(!cert_done)
return 0; /* failure! */
return 1;
@@ -3158,7 +3165,14 @@ static CURLcode load_cacert_from_memory(X509_STORE *store,
}
}
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
sk_X509_INFO_pop_free(inf, X509_INFO_free);
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
BIO_free(cbio);
/* if we did not end up importing anything, treat that as an error */

View File

@@ -432,7 +432,7 @@ cr_get_selected_ciphers(struct Curl_easy *data,
{
const size_t supported_len = *selected_size;
const size_t default_len = rustls_default_crypto_provider_ciphersuites_len();
const struct rustls_supported_ciphersuite *entry;
const struct rustls_supported_ciphersuite *entry = NULL;
const char *ciphers = ciphers12;
size_t count = 0, default13_count = 0, i, j;
const char *ptr, *end;
@@ -1315,7 +1315,7 @@ cr_shutdown(struct Curl_cfilter *cf,
struct rustls_ssl_backend_data *backend =
(struct rustls_ssl_backend_data *)connssl->backend;
CURLcode result = CURLE_OK;
size_t i, nread, nwritten;
size_t i, nread = 0, nwritten;
DEBUGASSERT(backend);
if(!backend->conn || cf->shutdown) {

View File

@@ -771,7 +771,9 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
SCH_CREDENTIALS credentials = { 0 };
TLS_PARAMETERS tls_parameters = { 0 };
CRYPTO_SETTINGS crypto_settings[1] = { { 0 } };
CRYPTO_SETTINGS crypto_settings[1];
memset(crypto_settings, 0, sizeof(crypto_settings));
tls_parameters.pDisabledCrypto = crypto_settings;
@@ -2551,10 +2553,17 @@ static int schannel_init(void)
{
#if defined(HAS_ALPN_SCHANNEL) && !defined(UNDER_CE)
typedef const char *(APIENTRY *WINE_GET_VERSION_FN)(void);
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
#endif
WINE_GET_VERSION_FN p_wine_get_version =
CURLX_FUNCTION_CAST(WINE_GET_VERSION_FN,
(GetProcAddress(GetModuleHandleA("ntdll"),
"wine_get_version")));
#if defined(__clang__) && __clang_major__ >= 16
#pragma clang diagnostic pop
#endif
if(p_wine_get_version) { /* WINE detected */
const char *wine_version = p_wine_get_version(); /* e.g. "6.0.2" */
/* Assume ALPN support with WINE 6.0 or upper */

View File

@@ -1095,9 +1095,6 @@ static CURLcode ssl_version(struct Curl_easy *data,
}
#define QUIC_CIPHERS \
"TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_" \
"POLY1305_SHA256:TLS_AES_128_CCM_SHA256"
#define QUIC_GROUPS "P-256:P-384:P-521"
CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,

View File

@@ -199,7 +199,7 @@ static const char *getASN1Element_(struct Curl_asn1Element *elem,
elem->header = beg;
b = (unsigned char) *beg++;
elem->constructed = (b & 0x20) != 0;
elem->class = (b >> 6) & 3;
elem->eclass = (b >> 6) & 3;
b &= 0x1F;
if(b == 0x1F)
return NULL; /* Long tag values not supported here. */
@@ -456,7 +456,7 @@ static CURLcode encodeOID(struct dynbuf *store,
x = 0;
do {
if(x & 0xFF000000)
return 0;
return CURLE_OK;
y = *(const unsigned char *) beg++;
x = (x << 7) | (y & 0x7F);
} while(y & 0x80);

View File

@@ -42,7 +42,7 @@ struct Curl_asn1Element {
const char *header; /* Pointer to header byte. */
const char *beg; /* Pointer to element data. */
const char *end; /* Pointer to 1st byte after element. */
unsigned char class; /* ASN.1 element class. */
unsigned char eclass; /* ASN.1 element class. */
unsigned char tag; /* ASN.1 element tag. */
BIT(constructed); /* Element is constructed. */
};

View File

@@ -120,16 +120,18 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
if test "$appleclang" = '1' && test "$oldapple" = '0'; then
dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version
if test "$compiler_num" -ge '1300'; then compiler_num='1200'
elif test "$compiler_num" -ge '1205'; then compiler_num='1101'
elif test "$compiler_num" -ge '1204'; then compiler_num='1000'
elif test "$compiler_num" -ge '1107'; then compiler_num='900'
elif test "$compiler_num" -ge '1103'; then compiler_num='800'
elif test "$compiler_num" -ge '1003'; then compiler_num='700'
elif test "$compiler_num" -ge '1001'; then compiler_num='600'
elif test "$compiler_num" -ge '904'; then compiler_num='500'
elif test "$compiler_num" -ge '902'; then compiler_num='400'
elif test "$compiler_num" -ge '803'; then compiler_num='309'
if test "$compiler_num" -ge '1700'; then compiler_num='1901'
elif test "$compiler_num" -ge '1600'; then compiler_num='1700'
elif test "$compiler_num" -ge '1500'; then compiler_num='1600'
elif test "$compiler_num" -ge '1400'; then compiler_num='1400'
elif test "$compiler_num" -ge '1301'; then compiler_num='1300'
elif test "$compiler_num" -ge '1300'; then compiler_num='1200'
elif test "$compiler_num" -ge '1200'; then compiler_num='1000'
elif test "$compiler_num" -ge '1100'; then compiler_num='800'
elif test "$compiler_num" -ge '1000'; then compiler_num='600'
elif test "$compiler_num" -ge '901'; then compiler_num='500'
elif test "$compiler_num" -ge '900'; then compiler_num='400'
elif test "$compiler_num" -ge '801'; then compiler_num='309'
elif test "$compiler_num" -ge '703'; then compiler_num='308'
else compiler_num='307'
fi
@@ -827,9 +829,10 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [empty-body])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-field-initializers])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn])
tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-default"
tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-enum" # Not used because this basically disallows default case
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [old-style-definition])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical
# tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros"
@@ -845,15 +848,23 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
dnl Only clang 2.9 or later
if test "$compiler_num" -ge "209"; then
tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion"
tmp_CFLAGS="$tmp_CFLAGS -Wno-padded" # Not used because we cannot change public structs
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used because we cannot change public structs
fi
#
dnl Only clang 3.0 or later
if test "$compiler_num" -ge "300"; then
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conditional-uninitialized])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [language-extension-token])
tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
tmp_CFLAGS="$tmp_CFLAGS -Wno-used-but-marked-unused" # Triggered by typecheck-gcc.h (with clang 14+)
fi
dnl Only clang 3.1 or later
if test "$compiler_num" -ge "301"; then
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [format-non-iso])
tmp_CFLAGS="$tmp_CFLAGS -Wno-covered-switch-default" # Annoying to fix or silence
tmp_CFLAGS="$tmp_CFLAGS -Wno-disabled-macro-expansion" # Triggered by typecheck-gcc.h (with clang 14+)
fi
#
dnl Only clang 3.2 or later
@@ -870,6 +881,10 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
;;
esac
fi
dnl Only clang 3.3 or later
if test "$compiler_num" -ge "303"; then
tmp_CFLAGS="$tmp_CFLAGS -Wno-documentation-unknown-command"
fi
#
dnl Only clang 3.4 or later
if test "$compiler_num" -ge "304"; then
@@ -907,6 +922,35 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough" # we have silencing markup for clang 10.0 and above only
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [xor-used-as-pow])
fi
dnl clang 13 or later
if test "$compiler_num" -ge "1300"; then
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-function-type])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [reserved-identifier]) # Keep it before -Wno-reserved-macro-identifier
tmp_CFLAGS="$tmp_CFLAGS -Wno-reserved-macro-identifier" # Sometimes such external macros need to be set
fi
dnl clang 16 or later
if test "$compiler_num" -ge "1600"; then
tmp_CFLAGS="$tmp_CFLAGS -Wno-unsafe-buffer-usage"
fi
dnl clang 17 or later
if test "$compiler_num" -ge "1700"; then
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-function-type-strict]) # with Apple clang it requires 16.0 or above
fi
dnl clang 20 or later
if test "$compiler_num" -ge "2000"; then
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [array-compare])
fi
dnl clang 21 or later
if test "$compiler_num" -ge "2100"; then
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-hidden-decl])
tmp_CFLAGS="$tmp_CFLAGS -Wno-implicit-void-ptr-cast"
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [tentative-definition-compat])
if test "$curl_cv_native_windows" = "yes"; then
tmp_CFLAGS="$tmp_CFLAGS -Wno-c++-keyword" # `wchar_t` triggers it on Windows
else
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-keyword])
fi
fi
fi
;;
#
@@ -1015,10 +1059,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
;;
esac
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used because we cannot change public structs
tmp_CFLAGS="$tmp_CFLAGS -Wno-padded" # Not used because we cannot change public structs
tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-default"
tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-enum" # Not used because this basically disallows default case
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pragmas])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical
# tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros"
fi

View File

@@ -236,18 +236,16 @@ static const char *disabled[]={
#else
"OFF"
#endif
,
NULL
};
int main(int argc, char **argv)
{
int i;
size_t i;
(void)argc;
(void)argv;
for(i = 0; disabled[i]; i++)
for(i = 0; i < CURL_ARRAYSIZE(disabled); i++)
printf("%s\n", disabled[i]);
return 0;

View File

@@ -2109,7 +2109,6 @@ static ParameterError opt_bool(struct OperationConfig *config,
break;
case C_REMOTE_NAME: /* --remote-name */
return parse_remote_name(config, toggle);
break;
case C_PROXYTUNNEL: /* --proxytunnel */
config->proxytunnel = toggle;
break;
@@ -2131,7 +2130,6 @@ static ParameterError opt_bool(struct OperationConfig *config,
break;
case C_VERBOSE: /* --verbose */
return parse_verbose(toggle);
break;
case C_VERSION: /* --version */
if(toggle) /* --no-version yields no output! */
return PARAM_VERSION_INFO_REQUESTED;
@@ -2801,7 +2799,6 @@ static ParameterError opt_string(struct OperationConfig *config,
else
global->parallel_host = (unsigned short)val;
break;
break;
case C_PARALLEL_MAX: /* --parallel-max */
err = str2unum(&val, nextarg);
if(err)

View File

@@ -1934,7 +1934,7 @@ static CURLcode serial_transfers(CURLSH *share)
return result;
}
static CURLcode is_using_schannel(int *using)
static CURLcode is_using_schannel(int *pusing)
{
CURLcode result = CURLE_OK;
static int using_schannel = -1; /* -1 = not checked
@@ -1958,7 +1958,7 @@ static CURLcode is_using_schannel(int *using)
if(result)
return result;
}
*using = using_schannel;
*pusing = using_schannel;
return result;
}

View File

@@ -95,7 +95,7 @@ static CURLcode test_lib1565(const char *URL)
CURL *started_handles[CONN_NUM];
int started_num = 0;
int finished_num = 0;
pthread_t tid;
pthread_t tid = 0;
bool tid_valid = false;
struct CURLMsg *message;

View File

@@ -42,6 +42,10 @@
#if !defined(__clang__) && __GNUC__ >= 7
#pragma GCC diagnostic ignored "-Wformat-overflow"
#endif
#if defined(__clang__) && \
(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1))
#pragma clang diagnostic ignored "-Wformat-non-iso"
#endif
#endif
#define BUFSZ 256
@@ -1101,7 +1105,7 @@ static int test_curl_off_t_formatting(void)
return failed;
}
static int _string_check(int linenumber, char *buf, const char *buf2)
static int string_check_low(int linenumber, char *buf, const char *buf2)
{
if(strcmp(buf, buf2)) {
/* they shouldn't differ */
@@ -1111,9 +1115,9 @@ static int _string_check(int linenumber, char *buf, const char *buf2)
}
return 0;
}
#define string_check(x,y) _string_check(__LINE__, x, y)
#define string_check(x,y) string_check_low(__LINE__, x, y)
static int _strlen_check(int linenumber, char *buf, size_t len)
static int strlen_check_low(int linenumber, char *buf, size_t len)
{
size_t buflen = strlen(buf);
if(len != buflen) {
@@ -1124,8 +1128,7 @@ static int _strlen_check(int linenumber, char *buf, size_t len)
}
return 0;
}
#define strlen_check(x,y) _strlen_check(__LINE__, x, y)
#define strlen_check(x,y) strlen_check_low(__LINE__, x, y)
/*
* The output strings in this test need to have been verified with a system

View File

@@ -91,9 +91,18 @@ static CURLcode test_unit1398(const char *arg)
fail_unless(rc == 15, "return code should be 15");
fail_unless(!strcmp(output, " 1234 567"), "wrong output");
#if defined(__clang__) && \
(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1))
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-non-iso"
#endif
/* double precision */
rc = curl_msnprintf(output, 24, "%2$.*1$.99d", 3, 5678);
fail_unless(rc == 0, "return code should be 0");
#if defined(__clang__) && \
(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1))
#pragma clang diagnostic pop
#endif
/* 129 input % flags */
rc = curl_msnprintf(output, 130,