Enable compiler warnings for move semantics

This commit is contained in:
Ian McInerney 2023-12-19 14:14:14 +00:00
parent ffbb7fde74
commit de441d1e23
1 changed files with 15 additions and 0 deletions

View File

@ -161,6 +161,21 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
message( STATUS "Enabling warning -Wmismatched-tags" )
endif()
# Warn about improper move statements
CHECK_CXX_COMPILER_FLAG( "-Wpessimizing-move" COMPILER_SUPPORTS_WPESSIMIZING_MOVE )
if( COMPILER_SUPPORTS_WPESSIMIZING_MOVE )
set( WARN_FLAGS_CXX "${WARN_FLAGS_CXX} -Wpessimizing-move" )
message( STATUS "Enabling warning -Wpessimizing-move" )
endif()
CHECK_CXX_COMPILER_FLAG( "-Wredundant-move" COMPILER_SUPPORTS_WREDUNDANT_MOVE )
if( COMPILER_SUPPORTS_WREDUNDANT_MOVE )
set( WARN_FLAGS_CXX "${WARN_FLAGS_CXX} -Wredundant-move" )
message( STATUS "Enabling warning -Wredundant-move" )
endif()
# See if the compiler will throw warnings on these conversions
CHECK_CXX_COMPILER_FLAG( "-Wimplicit-int-float-conversion" COMPILER_SUPPORTS_WIMPLICIT_FLOAT_CONVERSION )