From 658ecaec8ebade868799f2535bd195853f07f7f9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 17 Aug 2021 08:04:28 +0800 Subject: [PATCH] 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 --- src/rgw/CMakeLists.txt | 9 +++++++++ src/rgw/rgw_rest_s3.cc | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/rgw/CMakeLists.txt b/src/rgw/CMakeLists.txt index 9d5741149c392..38f0811b13608 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 4ca77ee6ddf5f..9f6bd8f02f08b 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 -- 2.39.5