]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: disable -Wimplicit-const-int-float-conversion conditionally
authorKefu Chai <kchai@redhat.com>
Tue, 17 Aug 2021 00:04:28 +0000 (08:04 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 17 Aug 2021 00:05:39 +0000 (08:05 +0800)
to silence warning like:

 unknown warning group '-Wimplicit-const-int-float-conversion', ignored [-Werror,-Wunknown-warning-option]
 #pragma clang diagnostic ignored "-Wimplicit-const-int-float-conversion"

clang-10 does not support this option yet.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/CMakeLists.txt
src/rgw/rgw_rest_s3.cc

index 9d5741149c3926451d02adb06909273ee8224bfd..38f0811b13608d5f9c643eff815ac1a41ffdc4aa 100644 (file)
@@ -170,6 +170,15 @@ if(WITH_RADOSGW_DBSTORE)
 endif()
 
 add_library(rgw_common STATIC ${librgw_common_srcs})
+
+include(CheckCXXCompilerFlag)
+check_cxx_compiler_flag("-Wimplicit-const-int-float-conversion"
+  COMPILER_SUPPORTS_WARN_IMPLICIT_CONST_INT_FLOAT_CONVERSION)
+if(COMPILER_SUPPORTS_WARN_IMPLICIT_CONST_INT_FLOAT_CONVERSION)
+  target_compile_definitions(common-objs PRIVATE
+    HAVE_WARN_IMPLICIT_CONST_INT_FLOAT_CONVERSION)
+endif()
+
 target_link_libraries(rgw_common
   PRIVATE
     ceph-common
index 4ca77ee6ddf5f19c8b0861300742e0d316ff33b2..9f6bd8f02f08b4e760333bc5d355c9f505706d0f 100644 (file)
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/tokenizer.hpp>
 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
+#ifdef HAVE_WARN_IMPLICIT_CONST_INT_FLOAT_CONVERSION
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wimplicit-const-int-float-conversion"
+#endif
 #include <s3select/include/s3select.h>
+#ifdef HAVE_WARN_IMPLICIT_CONST_INT_FLOAT_CONVERSION
 #pragma clang diagnostic pop
+#endif
 #undef BOOST_BIND_GLOBAL_PLACEHOLDERS
 
 #include <liboath/oath.h>