[compiler-rt] 3d21b56 - [GTest][c++17] Silence warnings when building GTest with gcc-toolset-12
Kamau Bridgeman via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 10:51:25 PST 2023
Author: Kamau Bridgeman
Date: 2023-12-05T13:50:52-05:00
New Revision: 3d21b5603835fcd1de8d0565c3324e36fed21ff1
URL: https://github.com/llvm/llvm-project/commit/3d21b5603835fcd1de8d0565c3324e36fed21ff1
DIFF: https://github.com/llvm/llvm-project/commit/3d21b5603835fcd1de8d0565c3324e36fed21ff1.diff
LOG: [GTest][c++17] Silence warnings when building GTest with gcc-toolset-12
This change fixes a build break introduced by aafad2d(#70353) on
the clang-ppc64le-rhel build bot. If the third-party Google Test suite
is built using gcc-toolset-12, the implementation of std::stable_sort in
the toolchain will use a get_temporary_buffer declaration that is marked
_GLIBCXX17_DEPRECATED. This change adds -Wno-deprecated-declarations to
the GTest flags if the toolchain is detected in the build compiler on linux.
Added:
Modified:
compiler-rt/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 1a46f5b334806..bbb4e8d7c333e 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -678,9 +678,24 @@ endif()
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override COMPILER_RT_UNITTEST_CFLAGS)
-
-if(MSVC)
- # gtest use a lot of stuff marked as deprecated on Windows.
+# Detect if the compiler toolchain includes gcc-toolset-12.
+if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR
+ "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
+ RESULT_VARIABLE compiler_info_rc
+ OUTPUT_VARIABLE compiler_info
+ ERROR_VARIABLE compiler_info)
+ if(compiler_info MATCHES ".*gcc-toolset-12.*")
+ set(USING_GCC_TOOLSET_12 TRUE)
+ endif()
+endif()
+if(MSVC OR (LINUX AND DEFINED USING_GCC_TOOLSET_12 AND
+ CMAKE_CXX_STANDARD EQUAL 17))
+ # gtest use a lot of stuff marked as deprecated on Windows or if using
+ # gcc-toolset-12 in the compiler toolchain on Linux; all of the
+ # deprecated declarations in gcc-toolset-12 used in Google Tests have been
+ # observed to be _GLIBCXX17_DEPRECATED and should go away once
+ # CMAKE_CXX_STANDARD is greater than 17.
list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations)
endif()
More information about the llvm-commits
mailing list