summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/gtest-ci.yml3
-rw-r--r--CMakeLists.txt10
-rw-r--r--README.md9
-rw-r--r--ci/linux-presubmit.sh5
-rw-r--r--ci/macos-presubmit.sh5
-rw-r--r--docs/quickstart-bazel.md2
-rw-r--r--docs/quickstart-cmake.md11
-rw-r--r--googlemock/include/gmock/gmock-matchers.h5
-rw-r--r--googlemock/src/gmock-internal-utils.cc2
-rw-r--r--googletest/cmake/internal_utils.cmake6
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h6
-rw-r--r--googletest/src/gtest.cc4
-rw-r--r--googletest/test/googletest-param-test-test.cc4
-rw-r--r--googletest/test/gtest-unittest-api_test.cc4
-rw-r--r--googletest/test/gtest_unittest.cc2
15 files changed, 48 insertions, 30 deletions
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index 61fd47e..036c392 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -4,6 +4,9 @@ on:
push:
pull_request:
+env:
+ BAZEL_CXXOPTS: -std=c++14
+
jobs:
Linux:
runs-on: ubuntu-latest
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3cf5c27..725d670 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,16 +7,16 @@ if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
-if (POLICY CMP0077)
- cmake_policy(SET CMP0077 NEW)
-endif (POLICY CMP0077)
-
if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif (POLICY CMP0069)
+if (POLICY CMP0077)
+ cmake_policy(SET CMP0077 NEW)
+endif (POLICY CMP0077)
+
project(googletest-distribution)
-set(GOOGLETEST_VERSION 1.11.0)
+set(GOOGLETEST_VERSION 1.12.1)
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
diff --git a/README.md b/README.md
index 4c0f0c4..745f5c2 100644
--- a/README.md
+++ b/README.md
@@ -15,11 +15,14 @@ Our documentation is now live on GitHub Pages at
https://google.github.io/googletest/. We recommend browsing the documentation on
GitHub Pages rather than directly in the repository.
-#### Release 1.12.0
+#### Release 1.12.1
-[Release 1.12.0](https://github.com/google/googletest/releases/tag/release-1.12.0)
+[Release 1.12.1](https://github.com/google/googletest/releases/tag/release-1.12.1)
is now available.
+The 1.12.x branch will be the last to support C++11. Future releases will
+require at least C++14.
+
#### Coming Soon
* We are planning to take a dependency on
@@ -56,7 +59,7 @@ More information about building GoogleTest can be found at
## Supported Platforms
-GoogleTest requires a codebase and compiler compliant with the C++11 standard or
+GoogleTest requires a codebase and compiler compliant with the C++14 standard or
newer.
The GoogleTest code is officially supported on the following platforms.
diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh
index 0ee5670..f7e0f46 100644
--- a/ci/linux-presubmit.sh
+++ b/ci/linux-presubmit.sh
@@ -39,7 +39,7 @@ if [[ -z ${GTEST_ROOT:-} ]]; then
fi
if [[ -z ${STD:-} ]]; then
- STD="c++11 c++14 c++17 c++20"
+ STD="c++14 c++17 c++20"
fi
# Test the CMake build
@@ -55,7 +55,7 @@ for cc in /usr/local/bin/gcc /opt/llvm/clang/bin/clang; do
${LINUX_LATEST_CONTAINER} \
/bin/bash -c "
cmake /src \
- -DCMAKE_CXX_STANDARD=11 \
+ -DCMAKE_CXX_STANDARD=14 \
-Dgtest_build_samples=ON \
-Dgtest_build_tests=ON \
-Dgmock_build_tests=ON \
@@ -72,6 +72,7 @@ time docker run \
--workdir="/src" \
--rm \
--env="CC=/usr/local/bin/gcc" \
+ --env="BAZEL_CXXOPTS=-std=c++14" \
${LINUX_GCC_FLOOR_CONTAINER} \
/usr/local/bin/bazel test ... \
--copt="-Wall" \
diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh
index d6423fa..3b711da 100644
--- a/ci/macos-presubmit.sh
+++ b/ci/macos-presubmit.sh
@@ -40,7 +40,7 @@ for cmake_off_on in OFF ON; do
BUILD_DIR=$(mktemp -d build_dir.XXXXXXXX)
cd ${BUILD_DIR}
time cmake ${GTEST_ROOT} \
- -DCMAKE_CXX_STANDARD=11 \
+ -DCMAKE_CXX_STANDARD=14 \
-Dgtest_build_samples=ON \
-Dgtest_build_tests=ON \
-Dgmock_build_tests=ON \
@@ -53,7 +53,7 @@ done
# Test the Bazel build
# If we are running on Kokoro, check for a versioned Bazel binary.
-KOKORO_GFILE_BAZEL_BIN="bazel-3.7.0-darwin-x86_64"
+KOKORO_GFILE_BAZEL_BIN="bazel-5.1.1-darwin-x86_64"
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then
BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}"
chmod +x ${BAZEL_BIN}
@@ -66,6 +66,7 @@ for absl in 0 1; do
${BAZEL_BIN} test ... \
--copt="-Wall" \
--copt="-Werror" \
+ --cxxopt="-std=c++14" \
--define="absl=${absl}" \
--keep_going \
--show_timestamps \
diff --git a/docs/quickstart-bazel.md b/docs/quickstart-bazel.md
index 5d6e9c6..c187e72 100644
--- a/docs/quickstart-bazel.md
+++ b/docs/quickstart-bazel.md
@@ -9,7 +9,7 @@ we recommend this tutorial as a starting point.
To complete this tutorial, you'll need:
* A compatible operating system (e.g. Linux, macOS, Windows).
-* A compatible C++ compiler that supports at least C++11.
+* A compatible C++ compiler that supports at least C++14.
* [Bazel](https://bazel.build/), the preferred build system used by the
GoogleTest team.
diff --git a/docs/quickstart-cmake.md b/docs/quickstart-cmake.md
index 420f1d3..2988761 100644
--- a/docs/quickstart-cmake.md
+++ b/docs/quickstart-cmake.md
@@ -10,7 +10,7 @@ this tutorial as a starting point. If your project uses Bazel, see the
To complete this tutorial, you'll need:
* A compatible operating system (e.g. Linux, macOS, Windows).
-* A compatible C++ compiler that supports at least C++11.
+* A compatible C++ compiler that supports at least C++14.
* [CMake](https://cmake.org/) and a compatible build tool for building the
project.
* Compatible build tools include
@@ -52,13 +52,14 @@ To do this, in your project directory (`my_project`), create a file named
cmake_minimum_required(VERSION 3.14)
project(my_project)
-# GoogleTest requires at least C++11
-set(CMAKE_CXX_STANDARD 11)
+# GoogleTest requires at least C++14
+set(CMAKE_CXX_STANDARD 14)
include(FetchContent)
FetchContent_Declare(
googletest
- URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG release-1.12.1
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
@@ -108,7 +109,7 @@ add_executable(
)
target_link_libraries(
hello_test
- gtest_main
+ GTest::gtest_main
)
include(GoogleTest)
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 6282901..3c8cc32 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -3235,6 +3235,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<16>, char) {
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] = t;
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p);
}
+template <typename T>
+auto UnpackStructImpl(const T& t, MakeIndexSequence<17>, char) {
+ const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q] = t;
+ return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
+}
#endif // defined(__cpp_structured_bindings)
template <size_t I, typename T>
diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc
index 0a74841..f7d740c 100644
--- a/googlemock/src/gmock-internal-utils.cc
+++ b/googlemock/src/gmock-internal-utils.cc
@@ -181,7 +181,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
}
std::cout << "Stack trace:\n"
<< ::testing::internal::GetCurrentOsStackTraceExceptTop(
- ::testing::UnitTest::GetInstance(), actual_to_skip);
+ actual_to_skip);
}
std::cout << ::std::flush;
}
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 5a34c07..107147f 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -82,7 +82,9 @@ macro(config_compiler_and_linker)
# http://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702")
# Ensure MSVC treats source files as UTF-8 encoded.
- set(cxx_base_flags "${cxx_base_flags} -utf-8")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ set(cxx_base_flags "${cxx_base_flags} -utf-8")
+ endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(cxx_base_flags "-Wall -Wshadow -Wconversion")
set(cxx_exception_flags "-fexceptions")
@@ -189,7 +191,7 @@ function(cxx_library_with_type name type cxx_flags)
endif()
if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
- target_compile_features(${name} PUBLIC cxx_std_11)
+ target_compile_features(${name} PUBLIC cxx_std_14)
endif()
endfunction()
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 9b04e4c..74521db 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -57,6 +57,7 @@
#include <string.h>
#include <cstdint>
+#include <functional>
#include <iomanip>
#include <limits>
#include <map>
@@ -631,7 +632,7 @@ class GTEST_API_ TypedTestSuitePState {
const char* registered_tests);
private:
- typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
+ typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
bool registered_;
RegisteredTestsMap registered_tests_;
@@ -829,8 +830,7 @@ class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
// For example, if Foo() calls Bar(), which in turn calls
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
- int skip_count);
+GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count);
// Helpers for suppressing warnings on unreachable code or constant
// condition.
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 6f31dd2..a1b2b5d 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -372,6 +372,8 @@ GTEST_DEFINE_string_(
namespace testing {
namespace internal {
+const uint32_t Random::kMaxRange;
+
// Generates a random number from [0, range), using a Linear
// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
// than kMaxRange.
@@ -6245,7 +6247,7 @@ void UnitTestImpl::UnshuffleTests() {
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_ std::string
-GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, int skip_count) {
+GetCurrentOsStackTraceExceptTop(int skip_count) {
// We pass skip_count + 1 to skip this wrapper function in addition
// to what the user really wants to skip.
return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc
index 848ef97..e3090ae 100644
--- a/googletest/test/googletest-param-test-test.cc
+++ b/googletest/test/googletest-param-test-test.cc
@@ -821,7 +821,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
TEST(MacroNameing, LookupNames) {
std::set<std::string> know_suite_names, know_test_names;
- auto ins = testing::UnitTest::GetInstance();
+ const auto& ins = testing::UnitTest::GetInstance();
int ts = 0;
while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) {
know_suite_names.insert(suite->name());
@@ -897,7 +897,7 @@ INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest,
});
TEST(CustomNamingTest, CheckNameRegistry) {
- ::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance();
+ const auto& unit_test = ::testing::UnitTest::GetInstance();
std::set<std::string> test_names;
for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
++suite_num) {
diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc
index 2a13fa3..2ea6927 100644
--- a/googletest/test/gtest-unittest-api_test.cc
+++ b/googletest/test/gtest-unittest-api_test.cc
@@ -106,7 +106,7 @@ const int kTypedTests = 1;
// Since tests can be run in any order, the values the accessors that track
// test execution (such as failed_test_count) can not be predicted.
TEST(ApiTest, UnitTestImmutableAccessorsWork) {
- UnitTest* unit_test = UnitTest::GetInstance();
+ const auto& unit_test = UnitTest::GetInstance();
ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count());
EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count());
@@ -224,7 +224,7 @@ TEST(DISABLED_Test, Dummy2) {}
class FinalSuccessChecker : public Environment {
protected:
void TearDown() override {
- UnitTest* unit_test = UnitTest::GetInstance();
+ const auto& unit_test = UnitTest::GetInstance();
EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count());
EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index cdfdc6c..b579e81 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -7703,7 +7703,7 @@ auto* dynamic_test = testing::RegisterTest(
__LINE__, []() -> DynamicUnitTestFixture* { return new DynamicTest; });
TEST(RegisterTest, WasRegistered) {
- auto* unittest = testing::UnitTest::GetInstance();
+ const auto& unittest = testing::UnitTest::GetInstance();
for (int i = 0; i < unittest->total_test_suite_count(); ++i) {
auto* tests = unittest->GetTestSuite(i);
if (tests->name() != std::string("DynamicUnitTestFixture")) continue;