Skip to content

Commit

Permalink
Disable -Wdeprecated-declarations for Boost on clang > 17 (#1723)
Browse files Browse the repository at this point in the history
It's not clear why, but clang 18 and 19 do not correctly detect that
/usr/include/boost is a system directory, and it emits warnings for
use of deprecated std::unary_function.
  • Loading branch information
hainest committed Apr 10, 2024
1 parent e885d38 commit 3f0bffb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/DyninstWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ if(HAS_CPP_FLAG_Wframe_larger_than AND NOT DYNINST_DISABLE_DIAGNOSTIC_SUPPRESSIO
endif()
endif()

# clang >17.0 doesn't detect /usr/include/boost as a system directory
# and warns about use of deprecated STL functions in Boost
if(NOT DYNINST_DISABLE_DIAGNOSTIC_SUPPRESSIONS)
set(_id CMAKE_CXX_COMPILER_ID)
set(_ver CMAKE_CXX_COMPILER_VERSION)
if(${_id} STREQUAL "Clang" AND ${_ver} VERSION_GREATER 17)
set(clangBoostDeprecatedWarning -Wno-deprecated-declarations)
endif()
endif()

unset(CMAKE_REQUIRED_FLAGS)

if(MSVC)
Expand Down
6 changes: 6 additions & 0 deletions cmake/tpls/DyninstBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ if(NOT TARGET Dyninst::Boost)
INTERFACE ${Boost_INCLUDE_DIRS})
target_compile_definitions(Dyninst::Boost_headers
INTERFACE BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)

if(NOT DYNINST_DISABLE_DIAGNOSTIC_SUPPRESSIONS)
target_compile_options(Dyninst::Boost_headers
INTERFACE ${clangBoostDeprecatedWarning})
endif()
endif()

message(STATUS "Found Boost ${Boost_VERSION}")
message(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost libraries: ${Boost_LIBRARIES}")

0 comments on commit 3f0bffb

Please sign in to comment.