From 050cf655a8ec6e523e7f0bde3a04b690a70f2aaf Mon Sep 17 00:00:00 2001 From: Scott Munro Date: Thu, 30 Apr 2026 10:39:02 -0700 Subject: [PATCH 1/5] fix CURL_CALL warnings --- Source/HTTP/Curl/CurlMulti.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Source/HTTP/Curl/CurlMulti.cpp b/Source/HTTP/Curl/CurlMulti.cpp index de615cc8..5d5f48d1 100644 --- a/Source/HTTP/Curl/CurlMulti.cpp +++ b/Source/HTTP/Curl/CurlMulti.cpp @@ -187,8 +187,8 @@ void CALLBACK CurlMulti::TaskQueueCallback(_In_opt_ void* context, _In_ bool can if (--multi->m_taskQueueCallbacksPending == 0 && multi->m_cleanupAsyncBlock) { // If CurlMulti::CleanupAsync was called and there are no remaining task queue callbacks, schedule cleanup now. - // We *MUST* schedule the cleanup outside of holding the lock though. Scheduling cleanup may free the CurlMulti - // object memory before we're done using it here and we don't want that to happen while we're holding the lock + // We *MUST* schedule the cleanup outside of holding the lock though. Scheduling cleanup may free the CurlMulti + // object memory before we're done using it here and we don't want that to happen while we're holding the lock // or still otherwise referencing the CurlMulti object memory cleanupAsyncBlock = multi->m_cleanupAsyncBlock; } @@ -259,7 +259,7 @@ HRESULT CurlMulti::Perform() noexcept int workAvailable{ 0 }; #if HC_PLATFORM == HC_PLATFORM_GDK // Try curl_multi_poll first, fall back to curl_multi_wait if not available - if (CURL_CALL(curl_multi_poll)) + if (CURL_CALL(curl_multi_poll) != nullptr) { result = CURL_CALL(curl_multi_poll)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); } @@ -268,17 +268,10 @@ HRESULT CurlMulti::Perform() noexcept result = CURL_CALL(curl_multi_wait)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); } #elif defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7,69,0) - // Try curl_multi_poll first, fall back to curl_multi_wait if not available - // For non-GDK, CURL_CALL expands directly to the symbol - if (CURL_CALL(curl_multi_poll)) - { - result = CURL_CALL(curl_multi_poll)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); - } - else - { - result = CURL_CALL(curl_multi_wait)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); - } + // On supported non-GDK platforms with libcurl >= 7.69.0, we can call curl_multi_poll directly. + result = CURL_CALL(curl_multi_poll)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); #else + // On supported non-GDK platforms with libcurl < 7.69.0, we must fall back to curl_multi_wait. result = CURL_CALL(curl_multi_wait)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); #endif From ec3ae6881aebae83a8ccbd2301525694fbaa45a9 Mon Sep 17 00:00:00 2001 From: Scott Munro Date: Thu, 30 Apr 2026 11:24:22 -0700 Subject: [PATCH 2/5] avoid pointless diff --- Source/HTTP/Curl/CurlMulti.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/HTTP/Curl/CurlMulti.cpp b/Source/HTTP/Curl/CurlMulti.cpp index 5d5f48d1..214f7261 100644 --- a/Source/HTTP/Curl/CurlMulti.cpp +++ b/Source/HTTP/Curl/CurlMulti.cpp @@ -259,7 +259,7 @@ HRESULT CurlMulti::Perform() noexcept int workAvailable{ 0 }; #if HC_PLATFORM == HC_PLATFORM_GDK // Try curl_multi_poll first, fall back to curl_multi_wait if not available - if (CURL_CALL(curl_multi_poll) != nullptr) + if (CURL_CALL(curl_multi_poll)) { result = CURL_CALL(curl_multi_poll)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); } From f28fbbadddac42d47f07388919cbad1b3f03528d Mon Sep 17 00:00:00 2001 From: Scott Munro Date: Thu, 30 Apr 2026 11:34:01 -0700 Subject: [PATCH 3/5] update Build to enable warning clean builds --- Build/libHttpClient.Linux/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Build/libHttpClient.Linux/CMakeLists.txt b/Build/libHttpClient.Linux/CMakeLists.txt index fd00de44..76d4402d 100644 --- a/Build/libHttpClient.Linux/CMakeLists.txt +++ b/Build/libHttpClient.Linux/CMakeLists.txt @@ -168,6 +168,14 @@ target_include_directories( "${ZLIB_INCLUDE_DIRS}" ) +# Turn on compiler warnings for all source files. +# For zlib, which is external, mask some of the unimportant warnings. This keeps our build output clean without +# adding friction to taking zlib updates. If new warning show up in updates they should be assessed for impact and +# disabled if not considered problematic. +target_compile_options("${PROJECT_NAME}" PRIVATE -Werror) +set_source_files_properties(${ZLIB_SOURCE_FILES} PROPERTIES COMPILE_OPTIONS "-Wno-implicit-function-declaration") + + include("../libHttpClient.CMake/GetLibHCFlags.cmake") get_libhc_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE) From 0d234f6959ec555a961ae763798cad8b2be1384a Mon Sep 17 00:00:00 2001 From: Scott Munro Date: Thu, 30 Apr 2026 11:37:37 -0700 Subject: [PATCH 4/5] add static_assert --- Build/libHttpClient.Linux/CMakeLists.txt | 2 ++ Source/HTTP/Curl/CurlMulti.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Build/libHttpClient.Linux/CMakeLists.txt b/Build/libHttpClient.Linux/CMakeLists.txt index 76d4402d..e271b1ed 100644 --- a/Build/libHttpClient.Linux/CMakeLists.txt +++ b/Build/libHttpClient.Linux/CMakeLists.txt @@ -175,6 +175,8 @@ target_include_directories( target_compile_options("${PROJECT_NAME}" PRIVATE -Werror) set_source_files_properties(${ZLIB_SOURCE_FILES} PROPERTIES COMPILE_OPTIONS "-Wno-implicit-function-declaration") +# allow tautological comparisons for static_assert statements verifying CURL_CALL availability +target_compile_options("${PROJECT_NAME}" PRIVATE -Wno-tautological-compare) include("../libHttpClient.CMake/GetLibHCFlags.cmake") get_libhc_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE) diff --git a/Source/HTTP/Curl/CurlMulti.cpp b/Source/HTTP/Curl/CurlMulti.cpp index 214f7261..92a49e08 100644 --- a/Source/HTTP/Curl/CurlMulti.cpp +++ b/Source/HTTP/Curl/CurlMulti.cpp @@ -269,9 +269,11 @@ HRESULT CurlMulti::Perform() noexcept } #elif defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7,69,0) // On supported non-GDK platforms with libcurl >= 7.69.0, we can call curl_multi_poll directly. + static_assert(CURL_CALL(curl_multi_poll) != nullptr, "curl_multi_poll must be unconditionally available"); result = CURL_CALL(curl_multi_poll)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); #else // On supported non-GDK platforms with libcurl < 7.69.0, we must fall back to curl_multi_wait. + static_assert(CURL_CALL(curl_multi_wait) != nullptr, "curl_multi_wait must be unconditionally available"); result = CURL_CALL(curl_multi_wait)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); #endif From d8d6b57abc5172472f827ad225f30fc2353d7e04 Mon Sep 17 00:00:00 2001 From: Scott Munro Date: Thu, 30 Apr 2026 11:51:44 -0700 Subject: [PATCH 5/5] copilot feedback --- Build/libHttpClient.Linux/CMakeLists.txt | 5 +---- Source/HTTP/Curl/CurlMulti.cpp | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Build/libHttpClient.Linux/CMakeLists.txt b/Build/libHttpClient.Linux/CMakeLists.txt index e271b1ed..8c1bb7b0 100644 --- a/Build/libHttpClient.Linux/CMakeLists.txt +++ b/Build/libHttpClient.Linux/CMakeLists.txt @@ -170,14 +170,11 @@ target_include_directories( # Turn on compiler warnings for all source files. # For zlib, which is external, mask some of the unimportant warnings. This keeps our build output clean without -# adding friction to taking zlib updates. If new warning show up in updates they should be assessed for impact and +# adding friction to taking zlib updates. If new warnings show up in updates, they should be assessed for impact and # disabled if not considered problematic. target_compile_options("${PROJECT_NAME}" PRIVATE -Werror) set_source_files_properties(${ZLIB_SOURCE_FILES} PROPERTIES COMPILE_OPTIONS "-Wno-implicit-function-declaration") -# allow tautological comparisons for static_assert statements verifying CURL_CALL availability -target_compile_options("${PROJECT_NAME}" PRIVATE -Wno-tautological-compare) - include("../libHttpClient.CMake/GetLibHCFlags.cmake") get_libhc_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE) diff --git a/Source/HTTP/Curl/CurlMulti.cpp b/Source/HTTP/Curl/CurlMulti.cpp index 92a49e08..4107a6b3 100644 --- a/Source/HTTP/Curl/CurlMulti.cpp +++ b/Source/HTTP/Curl/CurlMulti.cpp @@ -269,11 +269,11 @@ HRESULT CurlMulti::Perform() noexcept } #elif defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7,69,0) // On supported non-GDK platforms with libcurl >= 7.69.0, we can call curl_multi_poll directly. - static_assert(CURL_CALL(curl_multi_poll) != nullptr, "curl_multi_poll must be unconditionally available"); + static_assert(CURL_CALL(curl_multi_poll) == curl_multi_poll, "curl_multi_poll must be unconditionally available"); result = CURL_CALL(curl_multi_poll)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); #else // On supported non-GDK platforms with libcurl < 7.69.0, we must fall back to curl_multi_wait. - static_assert(CURL_CALL(curl_multi_wait) != nullptr, "curl_multi_wait must be unconditionally available"); + static_assert(CURL_CALL(curl_multi_wait) == curl_multi_wait, "curl_multi_wait must be unconditionally available"); result = CURL_CALL(curl_multi_wait)(m_curlMultiHandle, nullptr, 0, POLL_TIMEOUT_MS, &workAvailable); #endif