From: Kefu Chai Date: Fri, 6 Aug 2021 09:26:16 +0000 (+0800) Subject: cmake: fail on unknown attribute X-Git-Tag: v16.2.11~358^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=55953eeeea0126d5230e6ac2d3e899e7dd4d8173;p=ceph.git cmake: fail on unknown attribute on Clang, the option for detecting unknown attribute is -Wunknown-attributes, so "-Wattributes -Werror" does not fail the test when the C compiler is Clang. in this change, we just turn all warnings into errors. this should fail the test if the compiler does not understand `__attribute__((__symver__ ...))` Fixes: https://tracker.ceph.com/issues/40060 Signed-off-by: Kefu Chai (cherry picked from commit 08179fd9f399b024acbe135e4eb6655126927f30) --- diff --git a/cmake/modules/CephChecks.cmake b/cmake/modules/CephChecks.cmake index 419edc2dc667..701ecb47c4c9 100644 --- a/cmake/modules/CephChecks.cmake +++ b/cmake/modules/CephChecks.cmake @@ -147,7 +147,7 @@ endif(NOT CMAKE_CROSSCOMPILING) set(version_script_source "v1 { }; v2 { } v1;") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version_script.txt "${version_script_source}") cmake_push_check_state(RESET) -set(CMAKE_REQUIRED_FLAGS "-Werror=attribute -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/version_script.txt") +set(CMAKE_REQUIRED_FLAGS "-Werror -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/version_script.txt") check_c_source_compiles(" __attribute__((__symver__ (\"func@v1\"))) void func_v1() {}; __attribute__((__symver__ (\"func@v2\"))) void func_v2() {};