From: Kefu Chai Date: Tue, 17 Aug 2021 00:04:28 +0000 (+0800) Subject: rgw: disable -Wimplicit-const-int-float-conversion conditionally X-Git-Tag: v17.1.0~1100^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=658ecaec8ebade868799f2535bd195853f07f7f9;p=ceph.git rgw: disable -Wimplicit-const-int-float-conversion conditionally 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 --- diff --git a/src/rgw/CMakeLists.txt b/src/rgw/CMakeLists.txt index 9d5741149c39..38f0811b1360 100644 --- a/src/rgw/CMakeLists.txt +++ b/src/rgw/CMakeLists.txt @@ -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 diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 4ca77ee6ddf5..9f6bd8f02f08 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -18,10 +18,14 @@ #include #include #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 +#ifdef HAVE_WARN_IMPLICIT_CONST_INT_FLOAT_CONVERSION #pragma clang diagnostic pop +#endif #undef BOOST_BIND_GLOBAL_PLACEHOLDERS #include