From: Kefu Chai Date: Thu, 13 Feb 2020 04:32:00 +0000 (+0800) Subject: cmake: disable -Wnon-virtual-dtor when compiling seastar X-Git-Tag: v15.1.1~444^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=36963dd7ccd50eff2f8b91d97ffb66295a7a6292;p=ceph.git cmake: disable -Wnon-virtual-dtor when compiling seastar quite a few base classes with virtual functions mark their destructor non-virtual and `protected` for better performance, as seastar destruct them via the concrete type of the instance. so let's disable this warning. but, please note, this newly added CXX_FLAG in `Seastar_CXX_FLAGS` won't be populated to crimson, as it is only added to the CXX_FLAGS used for compiling seastar itself. so we still have `-Wnon-virtual-dtor` warnings when compiling crimson as long as seastar headers are included. so to silence these warnings, we need to add it also to `crimson::cflags`, probably it's worth trading the noise caused by seastar's optimizations with the potentially useful warning messages caused by our oversights. in my case, there are over 300 lines of warnings split by GCC-10, so i still think it'd be better to add it also to crimson to increase the signal-to-noise ratio. we can aways remove it every once in a while to check if we forget to mark the destructor of a base class `virtual`. Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3029a1fa827a..e3c70e3f27af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -294,7 +294,7 @@ if(WITH_SEASTAR) build_dpdk(${CMAKE_BINARY_DIR}/src/dpdk) endif() endif() - set(Seastar_CXX_FLAGS "-Wno-error;-Wno-sign-compare;-Wno-attributes;-Wno-pessimizing-move;-Wno-address-of-packed-member" CACHE STRING "" FORCE) + set(Seastar_CXX_FLAGS "-Wno-error;-Wno-sign-compare;-Wno-attributes;-Wno-pessimizing-move;-Wno-address-of-packed-member;-Wno-non-virtual-dtor" CACHE STRING "" FORCE) add_subdirectory(seastar) # create the directory so cmake won't complain when looking at the imported # target: Seastar exports this directory created at build-time diff --git a/src/crimson/CMakeLists.txt b/src/crimson/CMakeLists.txt index 9ead32b9c748..7f792b64778d 100644 --- a/src/crimson/CMakeLists.txt +++ b/src/crimson/CMakeLists.txt @@ -8,6 +8,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GR endif() set_target_properties(crimson::cflags PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${crimson_cflag_definitions}" + INTERFACE_COMPILE_OPTIONS "-Wno-non-virtual-dtor" INTERFACE_LINK_LIBRARIES Seastar::seastar) set(crimson_common_srcs