From df7ac2e96058561e1816262ff6a2fc0443a3f12c Mon Sep 17 00:00:00 2001 From: Kasper Laudrup Date: Mon, 26 Feb 2024 13:55:58 +0100 Subject: [PATCH] Silence GCC warning on null dereference Boost.Beast includes directly on indirectly uses some boost algorithm function that makes GCC warns on some potential null dereference. Since this function gets inlined it will generate an warning even if the header is a system include so we need to silence that. For some reason this cannot be silenced with the usual -Wno- option but telling the optimizer not to delete null pointer checks works. This can hopefully be removed in a later version of GCC. --- examples/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 3bc3f439..4be94206 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -40,5 +40,7 @@ if(NOT ENABLE_WINTLS_STANDALONE_ASIO) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Work around string table overflow by enabling optimizations target_compile_options(async_https_client PRIVATE -Os) + # Work around null pointer deref warning in boost code from GCC 12 + target_compile_options(async_https_client PRIVATE -fno-delete-null-pointer-checks) endif() endif()