|
| 1 | +googletest adds the -Werror compiler flag, which breaks compilation with newer |
| 2 | +compiler versions. Remove the flag to work around the following diagnostic from |
| 3 | +GCC 11.1.1 on Fedora 34: |
| 4 | + |
| 5 | + ../vendor/googletest/googletest/src/gtest-death-test.cc: In function 'bool testing::internal::StackGrowsDown()': |
| 6 | + ../vendor/googletest/googletest/src/gtest-death-test.cc:1301:24: error: 'dummy' may be used uninitialized [-Werror=maybe-uninitialized] |
| 7 | + 1301 | StackLowerThanAddress(&dummy, &result); |
| 8 | + | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ |
| 9 | + ../vendor/googletest/googletest/src/gtest-death-test.cc:1290:13: note: by argument 1 of type 'const void*' to 'void testing::internal::StackLowerThanAddress(const void*, bool*)' declared here |
| 10 | + 1290 | static void StackLowerThanAddress(const void* ptr, bool* result) { |
| 11 | + | ^~~~~~~~~~~~~~~~~~~~~ |
| 12 | + ../vendor/googletest/googletest/src/gtest-death-test.cc:1299:7: note: 'dummy' declared here |
| 13 | + 1299 | int dummy; |
| 14 | + | ^~~~~ |
| 15 | + |
| 16 | +diff --git a/vendor/googletest/googletest/cmake/internal_utils.cmake b/vendor/googletest/googletest/cmake/internal_utils.cmake |
| 17 | +index 2f70f0b0..36cbecb1 100644 |
| 18 | +--- a/googletest/cmake/internal_utils.cmake |
| 19 | ++++ b/googletest/cmake/internal_utils.cmake |
| 20 | +@@ -82,13 +82,13 @@ macro(config_compiler_and_linker) |
| 21 | + # http://stackoverflow.com/questions/3232669 explains the issue. |
| 22 | + set(cxx_base_flags "${cxx_base_flags} -wd4702") |
| 23 | + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
| 24 | +- set(cxx_base_flags "-Wall -Wshadow -Werror -Wconversion") |
| 25 | ++ set(cxx_base_flags "-Wall -Wshadow -Wconversion") |
| 26 | + set(cxx_exception_flags "-fexceptions") |
| 27 | + set(cxx_no_exception_flags "-fno-exceptions") |
| 28 | + set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls") |
| 29 | + set(cxx_no_rtti_flags "-fno-rtti") |
| 30 | + elseif (CMAKE_COMPILER_IS_GNUCXX) |
| 31 | +- set(cxx_base_flags "-Wall -Wshadow -Werror") |
| 32 | ++ set(cxx_base_flags "-Wall -Wshadow") |
| 33 | + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) |
| 34 | + set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else") |
| 35 | + endif() |
0 commit comments