Skip to content

Commit

Permalink
Silence GCC warning on null dereference
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
laudrup committed Feb 29, 2024
1 parent fe4d895 commit df7ac2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit df7ac2e

Please sign in to comment.