diff options
32 files changed, 290 insertions, 159 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index e84670a..a2b25d9 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -393,7 +393,8 @@ class DefaultValue { private: const T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer); + FixedValueProducer(const FixedValueProducer&) = delete; + FixedValueProducer& operator=(const FixedValueProducer&) = delete; }; class FactoryValueProducer : public ValueProducer { @@ -404,7 +405,8 @@ class DefaultValue { private: const FactoryFunction factory_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer); + FactoryValueProducer(const FactoryValueProducer&) = delete; + FactoryValueProducer& operator=(const FactoryValueProducer&) = delete; }; static ValueProducer* producer_; @@ -478,7 +480,8 @@ class ActionInterface { virtual Result Perform(const ArgumentTuple& args) = 0; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface); + ActionInterface(const ActionInterface&) = delete; + ActionInterface& operator=(const ActionInterface&) = delete; }; // An Action<F> is a copyable and IMMUTABLE (except by assignment) @@ -951,7 +954,8 @@ class ReturnAction { R value_before_cast_; Result value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; }; // Partially specialize for ByMoveWrapper. This version of ReturnAction will diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index fb46715..c349c20 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -313,7 +313,9 @@ class StringMatchResultListener : public MatchResultListener { private: ::std::stringstream ss_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener); + StringMatchResultListener(const StringMatchResultListener&) = delete; + StringMatchResultListener& operator=(const StringMatchResultListener&) = + delete; }; // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION @@ -2555,7 +2557,8 @@ class WhenSortedByMatcher { const Comparator comparator_; const Matcher<const ::std::vector<LhsValue>&> matcher_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; }; private: diff --git a/googlemock/include/gmock/gmock-nice-strict.h b/googlemock/include/gmock/gmock-nice-strict.h index f421dea..28b3945 100644 --- a/googlemock/include/gmock/gmock-nice-strict.h +++ b/googlemock/include/gmock/gmock-nice-strict.h @@ -169,7 +169,8 @@ class GTEST_INTERNAL_EMPTY_BASE_CLASS NiceMock } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); + NiceMock(const NiceMock&) = delete; + NiceMock& operator=(const NiceMock&) = delete; }; template <class MockClass> @@ -210,7 +211,8 @@ class GTEST_INTERNAL_EMPTY_BASE_CLASS NaggyMock } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock); + NaggyMock(const NaggyMock&) = delete; + NaggyMock& operator=(const NaggyMock&) = delete; }; template <class MockClass> @@ -251,7 +253,8 @@ class GTEST_INTERNAL_EMPTY_BASE_CLASS StrictMock } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock); + StrictMock(const StrictMock&) = delete; + StrictMock& operator=(const StrictMock&) = delete; }; #undef GTEST_INTERNAL_EMPTY_BASE_CLASS diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index 917fa9a..a3e32a4 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -677,7 +677,8 @@ class GTEST_API_ InSequence { private: bool sequence_created_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT + InSequence(const InSequence&) = delete; + InSequence& operator=(const InSequence&) = delete; } GTEST_ATTRIBUTE_UNUSED_; namespace internal { @@ -1219,7 +1220,8 @@ class TypedExpectation : public ExpectationBase { Matcher<const ArgumentTuple&> extra_matcher_; Action<F> repeated_action_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation); + TypedExpectation(const TypedExpectation&) = delete; + TypedExpectation& operator=(const TypedExpectation&) = delete; }; // class TypedExpectation // A MockSpec object is used by ON_CALL() or EXPECT_CALL() for @@ -1392,7 +1394,8 @@ class ActionResultHolder : public UntypedActionResultHolderBase { Wrapper result_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder); + ActionResultHolder(const ActionResultHolder&) = delete; + ActionResultHolder& operator=(const ActionResultHolder&) = delete; }; // Specialization for T = void. @@ -1425,7 +1428,8 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase { private: ActionResultHolder() {} - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder); + ActionResultHolder(const ActionResultHolder&) = delete; + ActionResultHolder& operator=(const ActionResultHolder&) = delete; }; template <typename F> diff --git a/googlemock/src/gmock-cardinalities.cc b/googlemock/src/gmock-cardinalities.cc index 1e7b898..92cde34 100644 --- a/googlemock/src/gmock-cardinalities.cc +++ b/googlemock/src/gmock-cardinalities.cc @@ -86,7 +86,8 @@ class BetweenCardinalityImpl : public CardinalityInterface { const int min_; const int max_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(BetweenCardinalityImpl); + BetweenCardinalityImpl(const BetweenCardinalityImpl&) = delete; + BetweenCardinalityImpl& operator=(const BetweenCardinalityImpl&) = delete; }; // Formats "n times" in a human-friendly way. diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index 198510b..cce3f4b 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -869,7 +869,8 @@ class MockClass { int(const std::unique_ptr<int>&, std::unique_ptr<int>)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockClass); + MockClass(const MockClass&) = delete; + MockClass& operator=(const MockClass&) = delete; }; // Tests that DoDefault() returns the built-in default value for the diff --git a/googlemock/test/gmock-cardinalities_test.cc b/googlemock/test/gmock-cardinalities_test.cc index e7efd97..cdd9956 100644 --- a/googlemock/test/gmock-cardinalities_test.cc +++ b/googlemock/test/gmock-cardinalities_test.cc @@ -54,7 +54,8 @@ class MockFoo { MOCK_METHOD0(Bar, int()); // NOLINT private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); + MockFoo(const MockFoo&) = delete; + MockFoo& operator=(const MockFoo&) = delete; }; // Tests that Cardinality objects can be default constructed. diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc index dc750a3..d336a1e 100644 --- a/googlemock/test/gmock-function-mocker_test.cc +++ b/googlemock/test/gmock-function-mocker_test.cc @@ -202,7 +202,8 @@ class MockFoo : public FooInterface { MOCK_METHOD(int, RefQualifiedOverloaded, (), (ref(&&), override)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); + MockFoo(const MockFoo&) = delete; + MockFoo& operator=(const MockFoo&) = delete; }; class LegacyMockFoo : public FooInterface { @@ -274,7 +275,8 @@ class LegacyMockFoo : public FooInterface { int RefQualifiedOverloaded() && override { return 0; } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockFoo); + LegacyMockFoo(const LegacyMockFoo&) = delete; + LegacyMockFoo& operator=(const LegacyMockFoo&) = delete; }; #ifdef _MSC_VER @@ -492,7 +494,8 @@ class MockB { MOCK_METHOD(void, DoB, ()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB); + MockB(const MockB&) = delete; + MockB& operator=(const MockB&) = delete; }; class LegacyMockB { @@ -502,7 +505,8 @@ class LegacyMockB { MOCK_METHOD0(DoB, void()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockB); + LegacyMockB(const LegacyMockB&) = delete; + LegacyMockB& operator=(const LegacyMockB&) = delete; }; template <typename T> @@ -557,7 +561,8 @@ class MockStack : public StackInterface<T> { MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (int), (const)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack); + MockStack(const MockStack&) = delete; + MockStack& operator=(const MockStack&) = delete; }; template <typename T> @@ -575,7 +580,8 @@ class LegacyMockStack : public StackInterface<T> { MOCK_CONST_METHOD1_T(ReturnTypeWithComma, std::map<int, int>(int)); // NOLINT private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockStack); + LegacyMockStack(const LegacyMockStack&) = delete; + LegacyMockStack& operator=(const LegacyMockStack&) = delete; }; template <typename T> @@ -645,7 +651,8 @@ class MockStackWithCallType : public StackInterfaceWithCallType<T> { (Calltype(STDMETHODCALLTYPE), override, const)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType); + MockStackWithCallType(const MockStackWithCallType&) = delete; + MockStackWithCallType& operator=(const MockStackWithCallType&) = delete; }; template <typename T> @@ -659,7 +666,9 @@ class LegacyMockStackWithCallType : public StackInterfaceWithCallType<T> { MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTop, const T&()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockStackWithCallType); + LegacyMockStackWithCallType(const LegacyMockStackWithCallType&) = delete; + LegacyMockStackWithCallType& operator=(const LegacyMockStackWithCallType&) = + delete; }; template <typename T> @@ -709,7 +718,9 @@ class MockOverloadedOnArgNumber { MY_MOCK_METHODS1_; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber); + MockOverloadedOnArgNumber(const MockOverloadedOnArgNumber&) = delete; + MockOverloadedOnArgNumber& operator=(const MockOverloadedOnArgNumber&) = + delete; }; class LegacyMockOverloadedOnArgNumber { @@ -719,7 +730,10 @@ class LegacyMockOverloadedOnArgNumber { LEGACY_MY_MOCK_METHODS1_; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockOverloadedOnArgNumber); + LegacyMockOverloadedOnArgNumber(const LegacyMockOverloadedOnArgNumber&) = + delete; + LegacyMockOverloadedOnArgNumber& operator=( + const LegacyMockOverloadedOnArgNumber&) = delete; }; template <typename T> @@ -751,7 +765,9 @@ class MockOverloadedOnConstness { MY_MOCK_METHODS2_; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnConstness); + MockOverloadedOnConstness(const MockOverloadedOnConstness&) = delete; + MockOverloadedOnConstness& operator=(const MockOverloadedOnConstness&) = + delete; }; TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) { diff --git a/googlemock/test/gmock-matchers-arithmetic_test.cc b/googlemock/test/gmock-matchers-arithmetic_test.cc index 9c36dd2..ef53baa 100644 --- a/googlemock/test/gmock-matchers-arithmetic_test.cc +++ b/googlemock/test/gmock-matchers-arithmetic_test.cc @@ -955,7 +955,8 @@ class AllArgsHelper { MOCK_METHOD2(Helper, int(char x, int y)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(AllArgsHelper); + AllArgsHelper(const AllArgsHelper&) = delete; + AllArgsHelper& operator=(const AllArgsHelper&) = delete; }; TEST(AllArgsTest, WorksInWithClause) { @@ -982,7 +983,8 @@ class OptionalMatchersHelper { MOCK_METHOD2(Overloaded, int(char x, int y)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(OptionalMatchersHelper); + OptionalMatchersHelper(const OptionalMatchersHelper&) = delete; + OptionalMatchersHelper& operator=(const OptionalMatchersHelper&) = delete; }; TEST(AllArgsTest, WorksWithoutMatchers) { diff --git a/googlemock/test/gmock-matchers-comparisons_test.cc b/googlemock/test/gmock-matchers-comparisons_test.cc index 82c7ce6..63af04e 100644 --- a/googlemock/test/gmock-matchers-comparisons_test.cc +++ b/googlemock/test/gmock-matchers-comparisons_test.cc @@ -579,7 +579,8 @@ class Base { Base() {} private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(Base); + Base(const Base&) = delete; + Base& operator=(const Base&) = delete; }; class Derived : public Base { diff --git a/googlemock/test/gmock-matchers-containers_test.cc b/googlemock/test/gmock-matchers-containers_test.cc index 74a226d..be74dd7 100644 --- a/googlemock/test/gmock-matchers-containers_test.cc +++ b/googlemock/test/gmock-matchers-containers_test.cc @@ -342,7 +342,8 @@ class Uncopyable { private: int value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(Uncopyable); + Uncopyable(const Uncopyable&) = delete; + Uncopyable& operator=(const Uncopyable&) = delete; }; // Returns true if and only if x.value() is positive. @@ -2764,7 +2765,10 @@ class NativeArrayPassedAsPointerAndSize { MOCK_METHOD(void, Helper, (int* array, int size)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NativeArrayPassedAsPointerAndSize); + NativeArrayPassedAsPointerAndSize(const NativeArrayPassedAsPointerAndSize&) = + delete; + NativeArrayPassedAsPointerAndSize& operator=( + const NativeArrayPassedAsPointerAndSize&) = delete; }; TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) { diff --git a/googlemock/test/gmock-matchers-misc_test.cc b/googlemock/test/gmock-matchers-misc_test.cc index 8a4aef3..efb0059 100644 --- a/googlemock/test/gmock-matchers-misc_test.cc +++ b/googlemock/test/gmock-matchers-misc_test.cc @@ -106,7 +106,8 @@ class NotCopyable { private: int value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(NotCopyable); + NotCopyable(const NotCopyable&) = delete; + NotCopyable& operator=(const NotCopyable&) = delete; }; TEST(ByRefTest, AllowsNotCopyableConstValueInMatchers) { diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc index 21130d4..08254e1 100644 --- a/googlemock/test/gmock-nice-strict_test.cc +++ b/googlemock/test/gmock-nice-strict_test.cc @@ -45,7 +45,8 @@ class Mock { MOCK_METHOD0(DoThis, void()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock); + Mock(const Mock&) = delete; + Mock& operator=(const Mock&) = delete; }; namespace testing { @@ -93,7 +94,8 @@ class MockFoo : public Foo { MOCK_METHOD0(ReturnNonDefaultConstructible, NotDefaultConstructible()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); + MockFoo(const MockFoo&) = delete; + MockFoo& operator=(const MockFoo&) = delete; }; class MockBar { @@ -117,7 +119,8 @@ class MockBar { private: std::string str_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar); + MockBar(const MockBar&) = delete; + MockBar& operator=(const MockBar&) = delete; }; class MockBaz { diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index b59676f..d32fb42 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -150,7 +150,8 @@ class MockA { MOCK_METHOD2(ReturnInt, int(int x, int y)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockA); + MockA(const MockA&) = delete; + MockA& operator=(const MockA&) = delete; }; class MockB { @@ -161,7 +162,8 @@ class MockB { MOCK_METHOD1(DoB, int(int n)); // NOLINT private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB); + MockB(const MockB&) = delete; + MockB& operator=(const MockB&) = delete; }; class ReferenceHoldingMock { @@ -171,7 +173,8 @@ class ReferenceHoldingMock { MOCK_METHOD1(AcceptReference, void(std::shared_ptr<MockA>*)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ReferenceHoldingMock); + ReferenceHoldingMock(const ReferenceHoldingMock&) = delete; + ReferenceHoldingMock& operator=(const ReferenceHoldingMock&) = delete; }; // Tests that EXPECT_CALL and ON_CALL compile in a presence of macro @@ -193,7 +196,8 @@ class MockCC : public CC { MOCK_METHOD0(Method, int()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockCC); + MockCC(const MockCC&) = delete; + MockCC& operator=(const MockCC&) = delete; }; // Tests that a method with expanded name compiles. @@ -1894,7 +1898,8 @@ class MockC { MOCK_METHOD0(NonVoidMethod, int()); // NOLINT private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockC); + MockC(const MockC&) = delete; + MockC& operator=(const MockC&) = delete; }; class VerboseFlagPreservingFixture : public testing::Test { @@ -1909,7 +1914,9 @@ class VerboseFlagPreservingFixture : public testing::Test { private: const std::string saved_verbose_flag_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(VerboseFlagPreservingFixture); + VerboseFlagPreservingFixture(const VerboseFlagPreservingFixture&) = delete; + VerboseFlagPreservingFixture& operator=(const VerboseFlagPreservingFixture&) = + delete; }; #if GTEST_HAS_STREAM_REDIRECTION @@ -2129,7 +2136,8 @@ class LogTestHelper { MOCK_METHOD1(Foo, PrintMeNot(PrintMeNot)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(LogTestHelper); + LogTestHelper(const LogTestHelper&) = delete; + LogTestHelper& operator=(const LogTestHelper&) = delete; }; class GMockLogTest : public VerboseFlagPreservingFixture { diff --git a/googlemock/test/gmock_leak_test_.cc b/googlemock/test/gmock_leak_test_.cc index ad6f6d6..fa64591 100644 --- a/googlemock/test/gmock_leak_test_.cc +++ b/googlemock/test/gmock_leak_test_.cc @@ -51,7 +51,8 @@ class MockFoo : public FooInterface { MOCK_METHOD0(DoThis, void()); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); + MockFoo(const MockFoo&) = delete; + MockFoo& operator=(const MockFoo&) = delete; }; TEST(LeakTest, LeakedMockWithExpectCallCausesFailureWhenLeakCheckingIsEnabled) { diff --git a/googlemock/test/gmock_link_test.h b/googlemock/test/gmock_link_test.h index dc9bd85..eaf18e9 100644 --- a/googlemock/test/gmock_link_test.h +++ b/googlemock/test/gmock_link_test.h @@ -221,7 +221,8 @@ class Mock : public Interface { MOCK_METHOD1(VoidFromVector, void(const std::vector<int>& v)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock); + Mock(const Mock&) = delete; + Mock& operator=(const Mock&) = delete; }; class InvokeHelper { diff --git a/googlemock/test/gmock_output_test_.cc b/googlemock/test/gmock_output_test_.cc index b4abbc9..a178691 100644 --- a/googlemock/test/gmock_output_test_.cc +++ b/googlemock/test/gmock_output_test_.cc @@ -62,7 +62,8 @@ class MockFoo { MOCK_METHOD2(Bar3, void(int x, int y)); private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); + MockFoo(const MockFoo&) = delete; + MockFoo& operator=(const MockFoo&) = delete; }; class GMockOutputTest : public testing::Test { diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 7583660..a11d016 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -102,7 +102,8 @@ class MatchResultListener { private: ::std::ostream* const stream_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); + MatchResultListener(const MatchResultListener&) = delete; + MatchResultListener& operator=(const MatchResultListener&) = delete; }; inline MatchResultListener::~MatchResultListener() {} @@ -220,7 +221,8 @@ class DummyMatchResultListener : public MatchResultListener { DummyMatchResultListener() : MatchResultListener(nullptr) {} private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener); + DummyMatchResultListener(const DummyMatchResultListener&) = delete; + DummyMatchResultListener& operator=(const DummyMatchResultListener&) = delete; }; // A match result listener that forwards the explanation to a given @@ -232,7 +234,9 @@ class StreamMatchResultListener : public MatchResultListener { : MatchResultListener(os) {} private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener); + StreamMatchResultListener(const StreamMatchResultListener&) = delete; + StreamMatchResultListener& operator=(const StreamMatchResultListener&) = + delete; }; struct SharedPayloadBase { diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index e9a6260..b55119a 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -429,8 +429,11 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) { return 0; \ } \ static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)); \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ + (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \ + const GTEST_TEST_CLASS_NAME_(test_suite_name, \ + test_name) &) = delete; /* NOLINT */ \ }; \ int GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::gtest_registering_dummy_ = \ diff --git a/googletest/include/gtest/gtest-spi.h b/googletest/include/gtest/gtest-spi.h index 2554621..9fdfbe7 100644 --- a/googletest/include/gtest/gtest-spi.h +++ b/googletest/include/gtest/gtest-spi.h @@ -85,7 +85,10 @@ class GTEST_API_ ScopedFakeTestPartResultReporter TestPartResultReporterInterface* old_reporter_; TestPartResultArray* const result_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); + ScopedFakeTestPartResultReporter(const ScopedFakeTestPartResultReporter&) = + delete; + ScopedFakeTestPartResultReporter& operator=( + const ScopedFakeTestPartResultReporter&) = delete; }; namespace internal { @@ -107,7 +110,8 @@ class GTEST_API_ SingleFailureChecker { const TestPartResult::Type type_; const std::string substr_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); + SingleFailureChecker(const SingleFailureChecker&) = delete; + SingleFailureChecker& operator=(const SingleFailureChecker&) = delete; }; } // namespace internal diff --git a/googletest/include/gtest/gtest-test-part.h b/googletest/include/gtest/gtest-test-part.h index 8e9fba2..09cc8c3 100644 --- a/googletest/include/gtest/gtest-test-part.h +++ b/googletest/include/gtest/gtest-test-part.h @@ -145,7 +145,8 @@ class GTEST_API_ TestPartResultArray { private: std::vector<TestPartResult> array_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); + TestPartResultArray(const TestPartResultArray&) = delete; + TestPartResultArray& operator=(const TestPartResultArray&) = delete; }; // This interface knows how to report a test part result. @@ -176,7 +177,8 @@ class GTEST_API_ HasNewFatalFailureHelper bool has_new_fatal_failure_; TestPartResultReporterInterface* original_reporter_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper); + HasNewFatalFailureHelper(const HasNewFatalFailureHelper&) = delete; + HasNewFatalFailureHelper& operator=(const HasNewFatalFailureHelper&) = delete; }; } // namespace internal diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 0c6e75c..d19a587 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -339,7 +339,8 @@ class GTEST_API_ Test { virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; } // We disallow copying Tests. - GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); + Test(const Test&) = delete; + Test& operator=(const Test&) = delete; }; typedef internal::TimeInMillis TimeInMillis; @@ -497,7 +498,8 @@ class GTEST_API_ TestResult { TimeInMillis elapsed_time_; // We disallow copying TestResult. - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult); + TestResult(const TestResult&) = delete; + TestResult& operator=(const TestResult&) = delete; }; // class TestResult // A TestInfo object stores the following information about a test: @@ -643,7 +645,8 @@ class GTEST_API_ TestInfo { // test for the second time. TestResult result_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo); + TestInfo(const TestInfo&) = delete; + TestInfo& operator=(const TestInfo&) = delete; }; // A test suite, which consists of a vector of TestInfos. @@ -852,7 +855,8 @@ class GTEST_API_ TestSuite { TestResult ad_hoc_test_result_; // We disallow copying TestSuites. - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestSuite); + TestSuite(const TestSuite&) = delete; + TestSuite& operator=(const TestSuite&) = delete; }; // An Environment object is capable of setting up and tearing down an @@ -1072,7 +1076,8 @@ class GTEST_API_ TestEventListeners { TestEventListener* default_xml_generator_; // We disallow copying TestEventListeners. - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners); + TestEventListeners(const TestEventListeners&) = delete; + TestEventListeners& operator=(const TestEventListeners&) = delete; }; // A UnitTest consists of a vector of TestSuites. @@ -1279,7 +1284,8 @@ class GTEST_API_ UnitTest { internal::UnitTestImpl* impl_; // We disallow copying UnitTest. - GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest); + UnitTest(const UnitTest&) = delete; + UnitTest& operator=(const UnitTest&) = delete; }; // A convenient wrapper for adding an environment for the test @@ -1597,12 +1603,14 @@ class GTEST_API_ AssertHelper { std::string const message; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); + AssertHelperData(const AssertHelperData&) = delete; + AssertHelperData& operator=(const AssertHelperData&) = delete; }; AssertHelperData* const data_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); + AssertHelper(const AssertHelper&) = delete; + AssertHelper& operator=(const AssertHelper&) = delete; }; } // namespace internal @@ -2053,7 +2061,8 @@ class GTEST_API_ ScopedTrace { private: void PushTrace(const char* file, int line, std::string message); - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); + ScopedTrace(const ScopedTrace&) = delete; + ScopedTrace& operator=(const ScopedTrace&) = delete; } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its // c'tor and d'tor. Therefore it doesn't // need to be used otherwise. diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h index b9315c8..45580ae 100644 --- a/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -97,7 +97,8 @@ class GTEST_API_ DeathTest { private: DeathTest* const test_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); + ReturnSentinel(const ReturnSentinel&) = delete; + ReturnSentinel& operator=(const ReturnSentinel&) = delete; } GTEST_ATTRIBUTE_UNUSED_; // An enumeration of possible roles that may be taken when a death @@ -142,7 +143,8 @@ class GTEST_API_ DeathTest { // A string containing a description of the outcome of the last death test. static std::string last_death_test_message_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); + DeathTest(const DeathTest&) = delete; + DeathTest& operator=(const DeathTest&) = delete; }; GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 @@ -287,7 +289,8 @@ class InternalRunDeathTestFlag { int index_; int write_fd_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag); + InternalRunDeathTestFlag(const InternalRunDeathTestFlag&) = delete; + InternalRunDeathTestFlag& operator=(const InternalRunDeathTestFlag&) = delete; }; // Returns a newly created InternalRunDeathTestFlag object with fields diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 3ac39cd..6d05f96 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -465,7 +465,8 @@ class TestFactoryBase { TestFactoryBase() {} private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase); + TestFactoryBase(const TestFactoryBase&) = delete; + TestFactoryBase& operator=(const TestFactoryBase&) = delete; }; // This class provides implementation of TeastFactoryBase interface. @@ -886,7 +887,8 @@ class GTEST_API_ Random { private: uint32_t state_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(Random); + Random(const Random&) = delete; + Random& operator=(const Random&) = delete; }; // Turns const U&, U&, const U, and U all into U. @@ -1534,37 +1536,43 @@ class NeverThrown { test_suite_name##_##test_name##_Test // Helper macro for defining tests. -#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \ - static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \ - "test_suite_name must not be empty"); \ - static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \ - "test_name must not be empty"); \ - class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - : public parent_class { \ - public: \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \ - ~GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() override = default; \ - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)); \ - GTEST_DISALLOW_MOVE_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)); \ - \ - private: \ - void TestBody() override; \ - static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ - }; \ - \ - ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)::test_info_ = \ - ::testing::internal::MakeAndRegisterTestInfo( \ - #test_suite_name, #test_name, nullptr, nullptr, \ - ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ - ::testing::internal::SuiteApiResolver< \ - parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \ - ::testing::internal::SuiteApiResolver< \ - parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \ - new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \ - test_suite_name, test_name)>); \ +#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \ + static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \ + "test_suite_name must not be empty"); \ + static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \ + "test_name must not be empty"); \ + class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ + : public parent_class { \ + public: \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \ + ~GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() override = default; \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ + (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \ + const GTEST_TEST_CLASS_NAME_(test_suite_name, \ + test_name) &) = delete; /* NOLINT */ \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ + (GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &&) noexcept = delete; \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \ + GTEST_TEST_CLASS_NAME_(test_suite_name, \ + test_name) &&) noexcept = delete; /* NOLINT */ \ + \ + private: \ + void TestBody() override; \ + static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ + }; \ + \ + ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \ + test_name)::test_info_ = \ + ::testing::internal::MakeAndRegisterTestInfo( \ + #test_suite_name, #test_name, nullptr, nullptr, \ + ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ + ::testing::internal::SuiteApiResolver< \ + parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \ + ::testing::internal::SuiteApiResolver< \ + parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \ + new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \ + test_suite_name, test_name)>); \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index d70cd85..e7af2f9 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -406,7 +406,8 @@ class ParameterizedTestFactory : public TestFactoryBase { private: const ParamType parameter_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory); + ParameterizedTestFactory(const ParameterizedTestFactory&) = delete; + ParameterizedTestFactory& operator=(const ParameterizedTestFactory&) = delete; }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. @@ -442,7 +443,8 @@ class TestMetaFactory } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory); + TestMetaFactory(const TestMetaFactory&) = delete; + TestMetaFactory& operator=(const TestMetaFactory&) = delete; }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. @@ -473,7 +475,10 @@ class ParameterizedTestSuiteInfoBase { ParameterizedTestSuiteInfoBase() {} private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase); + ParameterizedTestSuiteInfoBase(const ParameterizedTestSuiteInfoBase&) = + delete; + ParameterizedTestSuiteInfoBase& operator=( + const ParameterizedTestSuiteInfoBase&) = delete; }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. @@ -664,7 +669,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { TestInfoContainer tests_; InstantiationContainer instantiations_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo); + ParameterizedTestSuiteInfo(const ParameterizedTestSuiteInfo&) = delete; + ParameterizedTestSuiteInfo& operator=(const ParameterizedTestSuiteInfo&) = + delete; }; // class ParameterizedTestSuiteInfo // Legacy API is deprecated but still available @@ -739,7 +746,10 @@ class ParameterizedTestSuiteRegistry { TestSuiteInfoContainer test_suite_infos_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteRegistry); + ParameterizedTestSuiteRegistry(const ParameterizedTestSuiteRegistry&) = + delete; + ParameterizedTestSuiteRegistry& operator=( + const ParameterizedTestSuiteRegistry&) = delete; }; // Keep track of what type-parameterized test suite are defined and diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 922de92..5d9220b 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -192,8 +192,6 @@ // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a // variable don't have to be used. -// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. -// GTEST_DISALLOW_MOVE_AND_ASSIGN_ - disables move ctor and operator=. // GTEST_MUST_USE_RESULT_ - declares that a function's result must be used. // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is // suppressed (constant conditional). @@ -689,20 +687,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) #endif -// A macro to disallow copy constructor and operator= -// This should be used in the private: declarations for a class. -// NOLINT is for modernize-use-trailing-return-type in macro uses. -#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \ - type(type const&) = delete; \ - type& operator=(type const&) = delete /* NOLINT */ - -// A macro to disallow move constructor and operator= -// This should be used in the private: declarations for a class. -// NOLINT is for modernize-use-trailing-return-type in macro uses. -#define GTEST_DISALLOW_MOVE_AND_ASSIGN_(type) \ - type(type&&) noexcept = delete; \ - type& operator=(type&&) noexcept = delete /* NOLINT */ - // Tell the compiler to warn about unused return values for functions declared // with this macro. The macro should be used on function declarations // following the argument list: @@ -971,7 +955,8 @@ class GTEST_API_ GTestLog { private: const GTestLogSeverity severity_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog); + GTestLog(const GTestLog&) = delete; + GTestLog& operator=(const GTestLog&) = delete; }; #if !defined(GTEST_LOG_) @@ -1191,7 +1176,8 @@ class GTEST_API_ AutoHandle { Handle handle_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle); + AutoHandle(const AutoHandle&) = delete; + AutoHandle& operator=(const AutoHandle&) = delete; }; #endif @@ -1314,7 +1300,8 @@ class ThreadWithParam : public ThreadWithParamBase { // finished. pthread_t thread_; // The native thread object. - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); + ThreadWithParam(const ThreadWithParam&) = delete; + ThreadWithParam& operator=(const ThreadWithParam&) = delete; }; #endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD || // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ @@ -1377,7 +1364,8 @@ class GTEST_API_ Mutex { long critical_section_init_phase_; // NOLINT GTEST_CRITICAL_SECTION* critical_section_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); + Mutex(const Mutex&) = delete; + Mutex& operator=(const Mutex&) = delete; }; #define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ @@ -1400,7 +1388,8 @@ class GTestMutexLock { private: Mutex* const mutex_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); + GTestMutexLock(const GTestMutexLock&) = delete; + GTestMutexLock& operator=(const GTestMutexLock&) = delete; }; typedef GTestMutexLock MutexLock; @@ -1427,7 +1416,8 @@ class ThreadLocalBase { virtual ~ThreadLocalBase() {} private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase); + ThreadLocalBase(const ThreadLocalBase&) = delete; + ThreadLocalBase& operator=(const ThreadLocalBase&) = delete; }; // Maps a thread to a set of ThreadLocals that have values instantiated on that @@ -1484,10 +1474,12 @@ class ThreadWithParam : public ThreadWithParamBase { UserThreadFunc* const func_; const T param_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl); + RunnableImpl(const RunnableImpl&) = delete; + RunnableImpl& operator=(const RunnableImpl&) = delete; }; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); + ThreadWithParam(const ThreadWithParam&) = delete; + ThreadWithParam& operator=(const ThreadWithParam&) = delete; }; // Implements thread-local storage on Windows systems. @@ -1543,7 +1535,8 @@ class ThreadLocal : public ThreadLocalBase { private: T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); + ValueHolder(const ValueHolder&) = delete; + ValueHolder& operator=(const ValueHolder&) = delete; }; T* GetOrCreateValue() const { @@ -1563,7 +1556,8 @@ class ThreadLocal : public ThreadLocalBase { virtual ValueHolder* MakeNewHolder() const = 0; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); + ValueHolderFactory(const ValueHolderFactory&) = delete; + ValueHolderFactory& operator=(const ValueHolderFactory&) = delete; }; class DefaultValueHolderFactory : public ValueHolderFactory { @@ -1572,7 +1566,9 @@ class ThreadLocal : public ThreadLocalBase { ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); + DefaultValueHolderFactory(const DefaultValueHolderFactory&) = delete; + DefaultValueHolderFactory& operator=(const DefaultValueHolderFactory&) = + delete; }; class InstanceValueHolderFactory : public ValueHolderFactory { @@ -1585,12 +1581,15 @@ class ThreadLocal : public ThreadLocalBase { private: const T value_; // The value for each thread. - GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); + InstanceValueHolderFactory(const InstanceValueHolderFactory&) = delete; + InstanceValueHolderFactory& operator=(const InstanceValueHolderFactory&) = + delete; }; std::unique_ptr<ValueHolderFactory> default_factory_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); + ThreadLocal(const ThreadLocal&) = delete; + ThreadLocal& operator=(const ThreadLocal&) = delete; }; #elif GTEST_HAS_PTHREAD @@ -1663,7 +1662,8 @@ class Mutex : public MutexBase { ~Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); + Mutex(const Mutex&) = delete; + Mutex& operator=(const Mutex&) = delete; }; // We cannot name this class MutexLock because the ctor declaration would @@ -1680,7 +1680,8 @@ class GTestMutexLock { private: MutexBase* const mutex_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); + GTestMutexLock(const GTestMutexLock&) = delete; + GTestMutexLock& operator=(const GTestMutexLock&) = delete; }; typedef GTestMutexLock MutexLock; @@ -1737,7 +1738,8 @@ class GTEST_API_ ThreadLocal { private: T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); + ValueHolder(const ValueHolder&) = delete; + ValueHolder& operator=(const ValueHolder&) = delete; }; static pthread_key_t CreateKey() { @@ -1769,7 +1771,8 @@ class GTEST_API_ ThreadLocal { virtual ValueHolder* MakeNewHolder() const = 0; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); + ValueHolderFactory(const ValueHolderFactory&) = delete; + ValueHolderFactory& operator=(const ValueHolderFactory&) = delete; }; class DefaultValueHolderFactory : public ValueHolderFactory { @@ -1778,7 +1781,9 @@ class GTEST_API_ ThreadLocal { ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); + DefaultValueHolderFactory(const DefaultValueHolderFactory&) = delete; + DefaultValueHolderFactory& operator=(const DefaultValueHolderFactory&) = + delete; }; class InstanceValueHolderFactory : public ValueHolderFactory { @@ -1791,14 +1796,17 @@ class GTEST_API_ ThreadLocal { private: const T value_; // The value for each thread. - GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); + InstanceValueHolderFactory(const InstanceValueHolderFactory&) = delete; + InstanceValueHolderFactory& operator=(const InstanceValueHolderFactory&) = + delete; }; // A key pthreads uses for looking up per-thread values. const pthread_key_t key_; std::unique_ptr<ValueHolderFactory> default_factory_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); + ThreadLocal(const ThreadLocal&) = delete; + ThreadLocal& operator=(const ThreadLocal&) = delete; }; #endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 542a8ec..0b9e929 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -424,7 +424,9 @@ class OsStackTraceGetterInterface { static const char* const kElidedFramesMarker; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface); + OsStackTraceGetterInterface(const OsStackTraceGetterInterface&) = delete; + OsStackTraceGetterInterface& operator=(const OsStackTraceGetterInterface&) = + delete; }; // A working implementation of the OsStackTraceGetterInterface interface. @@ -446,7 +448,8 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface { void* caller_frame_ = nullptr; #endif // GTEST_HAS_ABSL - GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter); + OsStackTraceGetter(const OsStackTraceGetter&) = delete; + OsStackTraceGetter& operator=(const OsStackTraceGetter&) = delete; }; // Information about a Google Test trace point. @@ -469,7 +472,10 @@ class DefaultGlobalTestPartResultReporter private: UnitTestImpl* const unit_test_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter); + DefaultGlobalTestPartResultReporter( + const DefaultGlobalTestPartResultReporter&) = delete; + DefaultGlobalTestPartResultReporter& operator=( + const DefaultGlobalTestPartResultReporter&) = delete; }; // This is the default per thread test part result reporter used in @@ -485,7 +491,10 @@ class DefaultPerThreadTestPartResultReporter private: UnitTestImpl* const unit_test_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter); + DefaultPerThreadTestPartResultReporter( + const DefaultPerThreadTestPartResultReporter&) = delete; + DefaultPerThreadTestPartResultReporter& operator=( + const DefaultPerThreadTestPartResultReporter&) = delete; }; // The private implementation of the UnitTest class. We don't protect @@ -942,7 +951,8 @@ class GTEST_API_ UnitTestImpl { // starts. bool catch_exceptions_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl); + UnitTestImpl(const UnitTestImpl&) = delete; + UnitTestImpl& operator=(const UnitTestImpl&) = delete; }; // class UnitTestImpl // Convenience function for accessing the global UnitTest @@ -1101,7 +1111,8 @@ class StreamingListener : public EmptyTestEventListener { const std::string host_name_; const std::string port_num_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); + SocketWriter(const SocketWriter&) = delete; + SocketWriter& operator=(const SocketWriter&) = delete; }; // class SocketWriter // Escapes '=', '&', '%', and '\n' characters in str as "%xx". @@ -1187,7 +1198,8 @@ class StreamingListener : public EmptyTestEventListener { const std::unique_ptr<AbstractSocketWriter> socket_writer_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener); + StreamingListener(const StreamingListener&) = delete; + StreamingListener& operator=(const StreamingListener&) = delete; }; // class StreamingListener #endif // GTEST_CAN_STREAM_RESULTS_ diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 32c27c2..73a1115 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -374,7 +374,8 @@ class MemoryIsNotDeallocated { private: int old_crtdbg_flag_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); + MemoryIsNotDeallocated(const MemoryIsNotDeallocated&) = delete; + MemoryIsNotDeallocated& operator=(const MemoryIsNotDeallocated&) = delete; }; #endif // _MSC_VER @@ -469,7 +470,8 @@ class ThreadWithParamSupport : public ThreadWithParamBase { // Prohibit instantiation. ThreadWithParamSupport(); - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport); + ThreadWithParamSupport(const ThreadWithParamSupport&) = delete; + ThreadWithParamSupport& operator=(const ThreadWithParamSupport&) = delete; }; } // namespace @@ -1146,7 +1148,8 @@ class CapturedStream { // Name of the temporary file holding the stderr output. ::std::string filename_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream); + CapturedStream(const CapturedStream&) = delete; + CapturedStream& operator=(const CapturedStream&) = delete; }; GTEST_DISABLE_MSC_DEPRECATED_POP_() diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index acfb941..1740e93 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3800,7 +3800,8 @@ class TestEventRepeater : public TestEventListener { // The list of listeners that receive events. std::vector<TestEventListener*> listeners_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater); + TestEventRepeater(const TestEventRepeater&) = delete; + TestEventRepeater& operator=(const TestEventRepeater&) = delete; }; TestEventRepeater::~TestEventRepeater() { @@ -3978,7 +3979,8 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { // The output file. const std::string output_file_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter); + XmlUnitTestResultPrinter(const XmlUnitTestResultPrinter&) = delete; + XmlUnitTestResultPrinter& operator=(const XmlUnitTestResultPrinter&) = delete; }; // Creates a new XmlUnitTestResultPrinter. @@ -4491,7 +4493,9 @@ class JsonUnitTestResultPrinter : public EmptyTestEventListener { // The output file. const std::string output_file_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(JsonUnitTestResultPrinter); + JsonUnitTestResultPrinter(const JsonUnitTestResultPrinter&) = delete; + JsonUnitTestResultPrinter& operator=(const JsonUnitTestResultPrinter&) = + delete; }; // Creates a new JsonUnitTestResultPrinter. @@ -5041,7 +5045,8 @@ class ScopedPrematureExitFile { private: const std::string premature_exit_filepath_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile); + ScopedPrematureExitFile(const ScopedPrematureExitFile&) = delete; + ScopedPrematureExitFile& operator=(const ScopedPrematureExitFile&) = delete; }; } // namespace internal diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc index 4e9323f..848ef97 100644 --- a/googletest/test/googletest-param-test-test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -598,7 +598,9 @@ class TestGenerationEnvironment : public ::testing::Environment { int tear_down_count_; int test_body_count_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationEnvironment); + TestGenerationEnvironment(const TestGenerationEnvironment&) = delete; + TestGenerationEnvironment& operator=(const TestGenerationEnvironment&) = + delete; }; const int test_generation_params[] = {36, 42, 72}; @@ -663,7 +665,8 @@ class TestGenerationTest : public TestWithParam<int> { static vector<int> collected_parameters_; private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationTest); + TestGenerationTest(const TestGenerationTest&) = delete; + TestGenerationTest& operator=(const TestGenerationTest&) = delete; }; vector<int> TestGenerationTest::collected_parameters_; diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc index 29926c2..fb139c3 100644 --- a/googletest/test/googletest-port-test.cc +++ b/googletest/test/googletest-port-test.cc @@ -1186,7 +1186,8 @@ class DestructorCall { #endif static std::vector<DestructorCall*>* const list_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(DestructorCall); + DestructorCall(const DestructorCall&) = delete; + DestructorCall& operator=(const DestructorCall&) = delete; }; std::vector<DestructorCall*>* const DestructorCall::list_ = diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 8cff92d..cdfdc6c 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -6884,7 +6884,8 @@ class SequenceTestingListener : public EmptyTestEventListener { std::vector<std::string>* vector_; const char* const id_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(SequenceTestingListener); + SequenceTestingListener(const SequenceTestingListener&) = delete; + SequenceTestingListener& operator=(const SequenceTestingListener&) = delete; }; TEST(EventListenerTest, AppendKeepsOrder) { |