]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: disable -Wnon-virtual-dtor when compiling seastar 33250/head
authorKefu Chai <kchai@redhat.com>
Thu, 13 Feb 2020 04:32:00 +0000 (12:32 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 13 Feb 2020 06:53:55 +0000 (14:53 +0800)
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 <kchai@redhat.com>
src/CMakeLists.txt
src/crimson/CMakeLists.txt

index 3029a1fa827ac2fa605d8b2be22979554fc2e001..e3c70e3f27afb5c24bfaec394bf336c56026e7a7 100644 (file)
@@ -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
index 9ead32b9c74837fafb745f1d7ba5a6442e206815..7f792b64778df25724f5d98fd35c76b740e7e0c2 100644 (file)
@@ -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