Commit bf66935e authored by Derek Mauro's avatar Derek Mauro Committed by Copybara-Service
Browse files

Remove the legacy internal GTEST_DISALLOW_* macros

PiperOrigin-RevId: 443715444
Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
parent b85864c6
...@@ -145,7 +145,8 @@ class GTEST_API_ TestPartResultArray { ...@@ -145,7 +145,8 @@ class GTEST_API_ TestPartResultArray {
private: private:
std::vector<TestPartResult> array_; 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. // This interface knows how to report a test part result.
...@@ -176,7 +177,8 @@ class GTEST_API_ HasNewFatalFailureHelper ...@@ -176,7 +177,8 @@ class GTEST_API_ HasNewFatalFailureHelper
bool has_new_fatal_failure_; bool has_new_fatal_failure_;
TestPartResultReporterInterface* original_reporter_; TestPartResultReporterInterface* original_reporter_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper); HasNewFatalFailureHelper(const HasNewFatalFailureHelper&) = delete;
HasNewFatalFailureHelper& operator=(const HasNewFatalFailureHelper&) = delete;
}; };
} // namespace internal } // namespace internal
......
...@@ -339,7 +339,8 @@ class GTEST_API_ Test { ...@@ -339,7 +339,8 @@ class GTEST_API_ Test {
virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; } virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
// We disallow copying Tests. // We disallow copying Tests.
GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); Test(const Test&) = delete;
Test& operator=(const Test&) = delete;
}; };
typedef internal::TimeInMillis TimeInMillis; typedef internal::TimeInMillis TimeInMillis;
...@@ -497,7 +498,8 @@ class GTEST_API_ TestResult { ...@@ -497,7 +498,8 @@ class GTEST_API_ TestResult {
TimeInMillis elapsed_time_; TimeInMillis elapsed_time_;
// We disallow copying TestResult. // We disallow copying TestResult.
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult); TestResult(const TestResult&) = delete;
TestResult& operator=(const TestResult&) = delete;
}; // class TestResult }; // class TestResult
// A TestInfo object stores the following information about a test: // A TestInfo object stores the following information about a test:
...@@ -643,7 +645,8 @@ class GTEST_API_ TestInfo { ...@@ -643,7 +645,8 @@ class GTEST_API_ TestInfo {
// test for the second time. // test for the second time.
TestResult result_; 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. // A test suite, which consists of a vector of TestInfos.
...@@ -852,7 +855,8 @@ class GTEST_API_ TestSuite { ...@@ -852,7 +855,8 @@ class GTEST_API_ TestSuite {
TestResult ad_hoc_test_result_; TestResult ad_hoc_test_result_;
// We disallow copying TestSuites. // 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 // An Environment object is capable of setting up and tearing down an
...@@ -1072,7 +1076,8 @@ class GTEST_API_ TestEventListeners { ...@@ -1072,7 +1076,8 @@ class GTEST_API_ TestEventListeners {
TestEventListener* default_xml_generator_; TestEventListener* default_xml_generator_;
// We disallow copying TestEventListeners. // 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. // A UnitTest consists of a vector of TestSuites.
...@@ -1279,7 +1284,8 @@ class GTEST_API_ UnitTest { ...@@ -1279,7 +1284,8 @@ class GTEST_API_ UnitTest {
internal::UnitTestImpl* impl_; internal::UnitTestImpl* impl_;
// We disallow copying UnitTest. // 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 // A convenient wrapper for adding an environment for the test
...@@ -1597,12 +1603,14 @@ class GTEST_API_ AssertHelper { ...@@ -1597,12 +1603,14 @@ class GTEST_API_ AssertHelper {
std::string const message; std::string const message;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); AssertHelperData(const AssertHelperData&) = delete;
AssertHelperData& operator=(const AssertHelperData&) = delete;
}; };
AssertHelperData* const data_; AssertHelperData* const data_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); AssertHelper(const AssertHelper&) = delete;
AssertHelper& operator=(const AssertHelper&) = delete;
}; };
} // namespace internal } // namespace internal
...@@ -2053,7 +2061,8 @@ class GTEST_API_ ScopedTrace { ...@@ -2053,7 +2061,8 @@ class GTEST_API_ ScopedTrace {
private: private:
void PushTrace(const char* file, int line, std::string message); 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 } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
// c'tor and d'tor. Therefore it doesn't // c'tor and d'tor. Therefore it doesn't
// need to be used otherwise. // need to be used otherwise.
......
...@@ -97,7 +97,8 @@ class GTEST_API_ DeathTest { ...@@ -97,7 +97,8 @@ class GTEST_API_ DeathTest {
private: private:
DeathTest* const test_; DeathTest* const test_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); ReturnSentinel(const ReturnSentinel&) = delete;
ReturnSentinel& operator=(const ReturnSentinel&) = delete;
} GTEST_ATTRIBUTE_UNUSED_; } GTEST_ATTRIBUTE_UNUSED_;
// An enumeration of possible roles that may be taken when a death // An enumeration of possible roles that may be taken when a death
...@@ -142,7 +143,8 @@ class GTEST_API_ DeathTest { ...@@ -142,7 +143,8 @@ class GTEST_API_ DeathTest {
// A string containing a description of the outcome of the last death test. // A string containing a description of the outcome of the last death test.
static std::string last_death_test_message_; 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 GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
...@@ -287,7 +289,8 @@ class InternalRunDeathTestFlag { ...@@ -287,7 +289,8 @@ class InternalRunDeathTestFlag {
int index_; int index_;
int write_fd_; 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 // Returns a newly created InternalRunDeathTestFlag object with fields
......
...@@ -465,7 +465,8 @@ class TestFactoryBase { ...@@ -465,7 +465,8 @@ class TestFactoryBase {
TestFactoryBase() {} TestFactoryBase() {}
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase); TestFactoryBase(const TestFactoryBase&) = delete;
TestFactoryBase& operator=(const TestFactoryBase&) = delete;
}; };
// This class provides implementation of TeastFactoryBase interface. // This class provides implementation of TeastFactoryBase interface.
...@@ -886,7 +887,8 @@ class GTEST_API_ Random { ...@@ -886,7 +887,8 @@ class GTEST_API_ Random {
private: private:
uint32_t state_; 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. // Turns const U&, U&, const U, and U all into U.
...@@ -1544,10 +1546,16 @@ class NeverThrown { ...@@ -1544,10 +1546,16 @@ class NeverThrown {
public: \ public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \ 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)() override = default; \
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
test_name)); \ (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
GTEST_DISALLOW_MOVE_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
test_name)); \ 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: \ private: \
void TestBody() override; \ void TestBody() override; \
......
...@@ -406,7 +406,8 @@ class ParameterizedTestFactory : public TestFactoryBase { ...@@ -406,7 +406,8 @@ class ParameterizedTestFactory : public TestFactoryBase {
private: private:
const ParamType parameter_; 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. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
...@@ -442,7 +443,8 @@ class TestMetaFactory ...@@ -442,7 +443,8 @@ class TestMetaFactory
} }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory); TestMetaFactory(const TestMetaFactory&) = delete;
TestMetaFactory& operator=(const TestMetaFactory&) = delete;
}; };
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
...@@ -473,7 +475,10 @@ class ParameterizedTestSuiteInfoBase { ...@@ -473,7 +475,10 @@ class ParameterizedTestSuiteInfoBase {
ParameterizedTestSuiteInfoBase() {} ParameterizedTestSuiteInfoBase() {}
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase); ParameterizedTestSuiteInfoBase(const ParameterizedTestSuiteInfoBase&) =
delete;
ParameterizedTestSuiteInfoBase& operator=(
const ParameterizedTestSuiteInfoBase&) = delete;
}; };
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
...@@ -664,7 +669,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { ...@@ -664,7 +669,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
TestInfoContainer tests_; TestInfoContainer tests_;
InstantiationContainer instantiations_; InstantiationContainer instantiations_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo); ParameterizedTestSuiteInfo(const ParameterizedTestSuiteInfo&) = delete;
ParameterizedTestSuiteInfo& operator=(const ParameterizedTestSuiteInfo&) =
delete;
}; // class ParameterizedTestSuiteInfo }; // class ParameterizedTestSuiteInfo
// Legacy API is deprecated but still available // Legacy API is deprecated but still available
...@@ -739,7 +746,10 @@ class ParameterizedTestSuiteRegistry { ...@@ -739,7 +746,10 @@ class ParameterizedTestSuiteRegistry {
TestSuiteInfoContainer test_suite_infos_; 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 // Keep track of what type-parameterized test suite are defined and
......
...@@ -192,8 +192,6 @@ ...@@ -192,8 +192,6 @@
// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
// variable don't have to be used. // 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_MUST_USE_RESULT_ - declares that a function's result must be used.
// GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
// suppressed (constant conditional). // suppressed (constant conditional).
...@@ -689,20 +687,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; ...@@ -689,20 +687,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) #define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
#endif #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 // Tell the compiler to warn about unused return values for functions declared
// with this macro. The macro should be used on function declarations // with this macro. The macro should be used on function declarations
// following the argument list: // following the argument list:
...@@ -971,7 +955,8 @@ class GTEST_API_ GTestLog { ...@@ -971,7 +955,8 @@ class GTEST_API_ GTestLog {
private: private:
const GTestLogSeverity severity_; const GTestLogSeverity severity_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog); GTestLog(const GTestLog&) = delete;
GTestLog& operator=(const GTestLog&) = delete;
}; };
#if !defined(GTEST_LOG_) #if !defined(GTEST_LOG_)
...@@ -1191,7 +1176,8 @@ class GTEST_API_ AutoHandle { ...@@ -1191,7 +1176,8 @@ class GTEST_API_ AutoHandle {
Handle handle_; Handle handle_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle); AutoHandle(const AutoHandle&) = delete;
AutoHandle& operator=(const AutoHandle&) = delete;
}; };
#endif #endif
...@@ -1314,7 +1300,8 @@ class ThreadWithParam : public ThreadWithParamBase { ...@@ -1314,7 +1300,8 @@ class ThreadWithParam : public ThreadWithParamBase {
// finished. // finished.
pthread_t thread_; // The native thread object. 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 || #endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
...@@ -1377,7 +1364,8 @@ class GTEST_API_ Mutex { ...@@ -1377,7 +1364,8 @@ class GTEST_API_ Mutex {
long critical_section_init_phase_; // NOLINT long critical_section_init_phase_; // NOLINT
GTEST_CRITICAL_SECTION* critical_section_; 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) \ #define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
...@@ -1400,7 +1388,8 @@ class GTestMutexLock { ...@@ -1400,7 +1388,8 @@ class GTestMutexLock {
private: private:
Mutex* const mutex_; Mutex* const mutex_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); GTestMutexLock(const GTestMutexLock&) = delete;
GTestMutexLock& operator=(const GTestMutexLock&) = delete;
}; };
typedef GTestMutexLock MutexLock; typedef GTestMutexLock MutexLock;
...@@ -1427,7 +1416,8 @@ class ThreadLocalBase { ...@@ -1427,7 +1416,8 @@ class ThreadLocalBase {
virtual ~ThreadLocalBase() {} virtual ~ThreadLocalBase() {}
private: 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 // Maps a thread to a set of ThreadLocals that have values instantiated on that
...@@ -1484,10 +1474,12 @@ class ThreadWithParam : public ThreadWithParamBase { ...@@ -1484,10 +1474,12 @@ class ThreadWithParam : public ThreadWithParamBase {
UserThreadFunc* const func_; UserThreadFunc* const func_;
const T param_; 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. // Implements thread-local storage on Windows systems.
...@@ -1543,7 +1535,8 @@ class ThreadLocal : public ThreadLocalBase { ...@@ -1543,7 +1535,8 @@ class ThreadLocal : public ThreadLocalBase {
private: private:
T value_; T value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); ValueHolder(const ValueHolder&) = delete;
ValueHolder& operator=(const ValueHolder&) = delete;
}; };
T* GetOrCreateValue() const { T* GetOrCreateValue() const {
...@@ -1563,7 +1556,8 @@ class ThreadLocal : public ThreadLocalBase { ...@@ -1563,7 +1556,8 @@ class ThreadLocal : public ThreadLocalBase {
virtual ValueHolder* MakeNewHolder() const = 0; virtual ValueHolder* MakeNewHolder() const = 0;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); ValueHolderFactory(const ValueHolderFactory&) = delete;
ValueHolderFactory& operator=(const ValueHolderFactory&) = delete;
}; };
class DefaultValueHolderFactory : public ValueHolderFactory { class DefaultValueHolderFactory : public ValueHolderFactory {
...@@ -1572,7 +1566,9 @@ class ThreadLocal : public ThreadLocalBase { ...@@ -1572,7 +1566,9 @@ class ThreadLocal : public ThreadLocalBase {
ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); DefaultValueHolderFactory(const DefaultValueHolderFactory&) = delete;
DefaultValueHolderFactory& operator=(const DefaultValueHolderFactory&) =
delete;
}; };
class InstanceValueHolderFactory : public ValueHolderFactory { class InstanceValueHolderFactory : public ValueHolderFactory {
...@@ -1585,12 +1581,15 @@ class ThreadLocal : public ThreadLocalBase { ...@@ -1585,12 +1581,15 @@ class ThreadLocal : public ThreadLocalBase {
private: private:
const T value_; // The value for each thread. 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_; 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 #elif GTEST_HAS_PTHREAD
...@@ -1663,7 +1662,8 @@ class Mutex : public MutexBase { ...@@ -1663,7 +1662,8 @@ class Mutex : public MutexBase {
~Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); } ~Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); }
private: 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 // We cannot name this class MutexLock because the ctor declaration would
...@@ -1680,7 +1680,8 @@ class GTestMutexLock { ...@@ -1680,7 +1680,8 @@ class GTestMutexLock {
private: private:
MutexBase* const mutex_; MutexBase* const mutex_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); GTestMutexLock(const GTestMutexLock&) = delete;
GTestMutexLock& operator=(const GTestMutexLock&) = delete;
}; };
typedef GTestMutexLock MutexLock; typedef GTestMutexLock MutexLock;
...@@ -1737,7 +1738,8 @@ class GTEST_API_ ThreadLocal { ...@@ -1737,7 +1738,8 @@ class GTEST_API_ ThreadLocal {
private: private:
T value_; T value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); ValueHolder(const ValueHolder&) = delete;
ValueHolder& operator=(const ValueHolder&) = delete;
}; };
static pthread_key_t CreateKey() { static pthread_key_t CreateKey() {
...@@ -1769,7 +1771,8 @@ class GTEST_API_ ThreadLocal { ...@@ -1769,7 +1771,8 @@ class GTEST_API_ ThreadLocal {
virtual ValueHolder* MakeNewHolder() const = 0; virtual ValueHolder* MakeNewHolder() const = 0;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); ValueHolderFactory(const ValueHolderFactory&) = delete;
ValueHolderFactory& operator=(const ValueHolderFactory&) = delete;
}; };
class DefaultValueHolderFactory : public ValueHolderFactory { class DefaultValueHolderFactory : public ValueHolderFactory {
...@@ -1778,7 +1781,9 @@ class GTEST_API_ ThreadLocal { ...@@ -1778,7 +1781,9 @@ class GTEST_API_ ThreadLocal {
ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); DefaultValueHolderFactory(const DefaultValueHolderFactory&) = delete;
DefaultValueHolderFactory& operator=(const DefaultValueHolderFactory&) =
delete;
}; };
class InstanceValueHolderFactory : public ValueHolderFactory { class InstanceValueHolderFactory : public ValueHolderFactory {
...@@ -1791,14 +1796,17 @@ class GTEST_API_ ThreadLocal { ...@@ -1791,14 +1796,17 @@ class GTEST_API_ ThreadLocal {
private: private:
const T value_; // The value for each thread. 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. // A key pthreads uses for looking up per-thread values.
const pthread_key_t key_; const pthread_key_t key_;
std::unique_ptr<ValueHolderFactory> default_factory_; 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_ #endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
......
...@@ -424,7 +424,9 @@ class OsStackTraceGetterInterface { ...@@ -424,7 +424,9 @@ class OsStackTraceGetterInterface {
static const char* const kElidedFramesMarker; static const char* const kElidedFramesMarker;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface); OsStackTraceGetterInterface(const OsStackTraceGetterInterface&) = delete;
OsStackTraceGetterInterface& operator=(const OsStackTraceGetterInterface&) =
delete;
}; };
// A working implementation of the OsStackTraceGetterInterface interface. // A working implementation of the OsStackTraceGetterInterface interface.
...@@ -446,7 +448,8 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface { ...@@ -446,7 +448,8 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
void* caller_frame_ = nullptr; void* caller_frame_ = nullptr;
#endif // GTEST_HAS_ABSL #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. // Information about a Google Test trace point.
...@@ -469,7 +472,10 @@ class DefaultGlobalTestPartResultReporter ...@@ -469,7 +472,10 @@ class DefaultGlobalTestPartResultReporter
private: private:
UnitTestImpl* const unit_test_; 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 // This is the default per thread test part result reporter used in
...@@ -485,7 +491,10 @@ class DefaultPerThreadTestPartResultReporter ...@@ -485,7 +491,10 @@ class DefaultPerThreadTestPartResultReporter
private: private:
UnitTestImpl* const unit_test_; 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 // The private implementation of the UnitTest class. We don't protect
...@@ -942,7 +951,8 @@ class GTEST_API_ UnitTestImpl { ...@@ -942,7 +951,8 @@ class GTEST_API_ UnitTestImpl {
// starts. // starts.
bool catch_exceptions_; bool catch_exceptions_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl); UnitTestImpl(const UnitTestImpl&) = delete;
UnitTestImpl& operator=(const UnitTestImpl&) = delete;
}; // class UnitTestImpl }; // class UnitTestImpl
// Convenience function for accessing the global UnitTest // Convenience function for accessing the global UnitTest
...@@ -1101,7 +1111,8 @@ class StreamingListener : public EmptyTestEventListener { ...@@ -1101,7 +1111,8 @@ class StreamingListener : public EmptyTestEventListener {
const std::string host_name_; const std::string host_name_;
const std::string port_num_; const std::string port_num_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); SocketWriter(const SocketWriter&) = delete;
SocketWriter& operator=(const SocketWriter&) = delete;
}; // class SocketWriter }; // class SocketWriter
// Escapes '=', '&', '%', and '\n' characters in str as "%xx". // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
...@@ -1187,7 +1198,8 @@ class StreamingListener : public EmptyTestEventListener { ...@@ -1187,7 +1198,8 @@ class StreamingListener : public EmptyTestEventListener {
const std::unique_ptr<AbstractSocketWriter> socket_writer_; const std::unique_ptr<AbstractSocketWriter> socket_writer_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener); StreamingListener(const StreamingListener&) = delete;
StreamingListener& operator=(const StreamingListener&) = delete;
}; // class StreamingListener }; // class StreamingListener
#endif // GTEST_CAN_STREAM_RESULTS_ #endif // GTEST_CAN_STREAM_RESULTS_
......
...@@ -374,7 +374,8 @@ class MemoryIsNotDeallocated { ...@@ -374,7 +374,8 @@ class MemoryIsNotDeallocated {
private: private:
int old_crtdbg_flag_; int old_crtdbg_flag_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); MemoryIsNotDeallocated(const MemoryIsNotDeallocated&) = delete;
MemoryIsNotDeallocated& operator=(const MemoryIsNotDeallocated&) = delete;
}; };
#endif // _MSC_VER #endif // _MSC_VER
...@@ -469,7 +470,8 @@ class ThreadWithParamSupport : public ThreadWithParamBase { ...@@ -469,7 +470,8 @@ class ThreadWithParamSupport : public ThreadWithParamBase {
// Prohibit instantiation. // Prohibit instantiation.
ThreadWithParamSupport(); ThreadWithParamSupport();
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport); ThreadWithParamSupport(const ThreadWithParamSupport&) = delete;
ThreadWithParamSupport& operator=(const ThreadWithParamSupport&) = delete;
}; };
} // namespace } // namespace
...@@ -1146,7 +1148,8 @@ class CapturedStream { ...@@ -1146,7 +1148,8 @@ class CapturedStream {
// Name of the temporary file holding the stderr output. // Name of the temporary file holding the stderr output.
::std::string filename_; ::std::string filename_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream); CapturedStream(const CapturedStream&) = delete;
CapturedStream& operator=(const CapturedStream&) = delete;
}; };
GTEST_DISABLE_MSC_DEPRECATED_POP_() GTEST_DISABLE_MSC_DEPRECATED_POP_()
......
...@@ -3800,7 +3800,8 @@ class TestEventRepeater : public TestEventListener { ...@@ -3800,7 +3800,8 @@ class TestEventRepeater : public TestEventListener {
// The list of listeners that receive events. // The list of listeners that receive events.
std::vector<TestEventListener*> listeners_; std::vector<TestEventListener*> listeners_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater); TestEventRepeater(const TestEventRepeater&) = delete;
TestEventRepeater& operator=(const TestEventRepeater&) = delete;
}; };
TestEventRepeater::~TestEventRepeater() { TestEventRepeater::~TestEventRepeater() {
...@@ -3978,7 +3979,8 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { ...@@ -3978,7 +3979,8 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
// The output file. // The output file.
const std::string 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. // Creates a new XmlUnitTestResultPrinter.
...@@ -4491,7 +4493,9 @@ class JsonUnitTestResultPrinter : public EmptyTestEventListener { ...@@ -4491,7 +4493,9 @@ class JsonUnitTestResultPrinter : public EmptyTestEventListener {
// The output file. // The output file.
const std::string 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. // Creates a new JsonUnitTestResultPrinter.
...@@ -5041,7 +5045,8 @@ class ScopedPrematureExitFile { ...@@ -5041,7 +5045,8 @@ class ScopedPrematureExitFile {
private: private:
const std::string premature_exit_filepath_; const std::string premature_exit_filepath_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile); ScopedPrematureExitFile(const ScopedPrematureExitFile&) = delete;
ScopedPrematureExitFile& operator=(const ScopedPrematureExitFile&) = delete;
}; };
} // namespace internal } // namespace internal
......
...@@ -598,7 +598,9 @@ class TestGenerationEnvironment : public ::testing::Environment { ...@@ -598,7 +598,9 @@ class TestGenerationEnvironment : public ::testing::Environment {
int tear_down_count_; int tear_down_count_;
int test_body_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}; const int test_generation_params[] = {36, 42, 72};
...@@ -663,7 +665,8 @@ class TestGenerationTest : public TestWithParam<int> { ...@@ -663,7 +665,8 @@ class TestGenerationTest : public TestWithParam<int> {
static vector<int> collected_parameters_; static vector<int> collected_parameters_;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationTest); TestGenerationTest(const TestGenerationTest&) = delete;
TestGenerationTest& operator=(const TestGenerationTest&) = delete;
}; };
vector<int> TestGenerationTest::collected_parameters_; vector<int> TestGenerationTest::collected_parameters_;
......
...@@ -1186,7 +1186,8 @@ class DestructorCall { ...@@ -1186,7 +1186,8 @@ class DestructorCall {
#endif #endif
static std::vector<DestructorCall*>* const list_; 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_ = std::vector<DestructorCall*>* const DestructorCall::list_ =
......
...@@ -6884,7 +6884,8 @@ class SequenceTestingListener : public EmptyTestEventListener { ...@@ -6884,7 +6884,8 @@ class SequenceTestingListener : public EmptyTestEventListener {
std::vector<std::string>* vector_; std::vector<std::string>* vector_;
const char* const id_; const char* const id_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SequenceTestingListener); SequenceTestingListener(const SequenceTestingListener&) = delete;
SequenceTestingListener& operator=(const SequenceTestingListener&) = delete;
}; };
TEST(EventListenerTest, AppendKeepsOrder) { TEST(EventListenerTest, AppendKeepsOrder) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment