diff options
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/docs/pkgconfig.md | 2 | ||||
-rw-r--r-- | googletest/include/gtest/gtest-matchers.h | 4 | ||||
-rw-r--r-- | googletest/include/gtest/gtest.h | 2 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 9 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 24 | ||||
-rw-r--r-- | googletest/test/gtest_unittest.cc | 25 |
6 files changed, 7 insertions, 59 deletions
diff --git a/googletest/docs/pkgconfig.md b/googletest/docs/pkgconfig.md index b775873..6dc0673 100644 --- a/googletest/docs/pkgconfig.md +++ b/googletest/docs/pkgconfig.md @@ -98,7 +98,7 @@ test('first_and_only_test', testapp) Since `pkg-config` is a small Unix command-line utility, it can be used in handwritten `Makefile`s too: -```Makefile +```makefile GTEST_CFLAGS = `pkg-config --cflags gtest_main` GTEST_LIBS = `pkg-config --libs gtest_main` diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 0548806..c10d650 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -300,7 +300,7 @@ class MatcherBase { template <typename U> explicit MatcherBase( const MatcherInterface<U>* impl, - typename internal::EnableIf<!std::is_same<U, const U&>::value>::type* = + typename std::enable_if<!std::is_same<U, const U&>::value>::type* = nullptr) : impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {} @@ -336,7 +336,7 @@ class Matcher : public internal::MatcherBase<T> { template <typename U> explicit Matcher( const MatcherInterface<U>* impl, - typename internal::EnableIf<!std::is_same<U, const U&>::value>::type* = + typename std::enable_if<!std::is_same<U, const U&>::value>::type* = nullptr) : internal::MatcherBase<T>(impl) {} diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index db81359..dfe7c78 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -292,7 +292,7 @@ class GTEST_API_ AssertionResult { template <typename T> explicit AssertionResult( const T& success, - typename internal::EnableIf< + typename std::enable_if< !std::is_convertible<T, AssertionResult>::value>::type* /*enabler*/ = nullptr) diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index c3cb744..37daf21 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -946,7 +946,7 @@ template <typename C, struct IsRecursiveContainerImpl; template <typename C> -struct IsRecursiveContainerImpl<C, false> : public false_type {}; +struct IsRecursiveContainerImpl<C, false> : public std::false_type {}; // Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to // obey the same inconsistencies as the IsContainerTest, namely check if @@ -970,13 +970,6 @@ struct IsRecursiveContainerImpl<C, true> { template <typename C> struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {}; -// EnableIf<condition>::type is void when 'Cond' is true, and -// undefined when 'Cond' is false. To use SFINAE to make a function -// overload only apply when a particular expression is true, add -// "typename EnableIf<expression>::type* = 0" as the last parameter. -template<bool> struct EnableIf; -template<> struct EnableIf<true> { typedef void type; }; // NOLINT - // Utilities for native arrays. // ArrayEq() compares two k-dimensional native arrays using the diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 7f00fe7..a637602 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -1019,19 +1019,6 @@ inline void FlushInfoLog() { fflush(nullptr); } GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ << gtest_error -// Adds reference to a type if it is not a reference type, -// otherwise leaves it unchanged. This is the same as -// tr1::add_reference, which is not widely available yet. -template <typename T> -struct AddReference { typedef T& type; }; // NOLINT -template <typename T> -struct AddReference<T&> { typedef T& type; }; // NOLINT - -// A handy wrapper around AddReference that works when the argument T -// depends on template parameters. -#define GTEST_ADD_REFERENCE_(T) \ - typename ::testing::internal::AddReference<T>::type - // Transforms "T" into "const T&" according to standard reference collapsing // rules (this is only needed as a backport for C++98 compilers that do not // support reference collapsing). Specifically, it transforms: @@ -1911,15 +1898,8 @@ class GTEST_API_ ThreadLocal { // we cannot detect it. GTEST_API_ size_t GetThreadCount(); -template <bool bool_value> -struct bool_constant { - typedef bool_constant<bool_value> type; - static const bool value = bool_value; -}; -template <bool bool_value> const bool bool_constant<bool_value>::value; - -typedef bool_constant<false> false_type; -typedef bool_constant<true> true_type; +template <bool B> +using bool_constant = std::integral_constant<bool, B>; template <typename Iterator> struct IteratorTraits { diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 0047f53..5020d73 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -227,7 +227,6 @@ using testing::TestProperty; using testing::TestResult; using testing::TimeInMillis; using testing::UnitTest; -using testing::internal::AddReference; using testing::internal::AlwaysFalse; using testing::internal::AlwaysTrue; using testing::internal::AppendUserMessage; @@ -7150,30 +7149,6 @@ TEST(RemoveReferenceToConstTest, Works) { TestGTestRemoveReferenceAndConst<const char*, const char*>(); } -// Tests that AddReference does not affect reference types. -TEST(AddReferenceTest, DoesNotAffectReferenceType) { - CompileAssertTypesEqual<int&, AddReference<int&>::type>(); - CompileAssertTypesEqual<const char&, AddReference<const char&>::type>(); -} - -// Tests that AddReference adds reference to non-reference types. -TEST(AddReferenceTest, AddsReference) { - CompileAssertTypesEqual<int&, AddReference<int>::type>(); - CompileAssertTypesEqual<const char&, AddReference<const char>::type>(); -} - -// Tests GTEST_ADD_REFERENCE_. - -template <typename T1, typename T2> -void TestGTestAddReference() { - CompileAssertTypesEqual<T1, GTEST_ADD_REFERENCE_(T2)>(); -} - -TEST(AddReferenceTest, MacroVersion) { - TestGTestAddReference<int&, int>(); - TestGTestAddReference<const char&, const char&>(); -} - // Tests GTEST_REFERENCE_TO_CONST_. template <typename T1, typename T2> |