Use "#ifdef" with public macros
This allows compilation with "-Wundef" (#3267). PiperOrigin-RevId: 513944726 Change-Id: I1a3854bb2333d5dec6c0ff91ee1eddd9a766ab91
This commit is contained in:
		
				
					committed by
					
						
						Copybara-Service
					
				
			
			
				
	
			
			
			
						parent
						
							7b1ced0682
						
					
				
				
					commit
					dc10c3b5e5
				
			@@ -200,7 +200,7 @@ TEST(IsTrueTest, IsTrueIsFalse) {
 | 
				
			|||||||
  EXPECT_THAT(nonnull_unique, Not(IsFalse()));
 | 
					  EXPECT_THAT(nonnull_unique, Not(IsFalse()));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_TYPED_TEST
 | 
					#ifdef GTEST_HAS_TYPED_TEST
 | 
				
			||||||
// Tests ContainerEq with different container types, and
 | 
					// Tests ContainerEq with different container types, and
 | 
				
			||||||
// different element types.
 | 
					// different element types.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1088,7 +1088,7 @@ TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Verifies that the failure message contains the two unsatisfied
 | 
					  // Verifies that the failure message contains the two unsatisfied
 | 
				
			||||||
  // pre-requisites but not the satisfied one.
 | 
					  // pre-requisites but not the satisfied one.
 | 
				
			||||||
#if GTEST_USES_POSIX_RE
 | 
					#ifdef GTEST_USES_POSIX_RE
 | 
				
			||||||
  EXPECT_THAT(r.message(),
 | 
					  EXPECT_THAT(r.message(),
 | 
				
			||||||
              ContainsRegex(
 | 
					              ContainsRegex(
 | 
				
			||||||
                  // POSIX RE doesn't understand the (?s) prefix, but has no
 | 
					                  // POSIX RE doesn't understand the (?s) prefix, but has no
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ GTEST_DECLARE_string_(death_test_style);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace testing {
 | 
					namespace testing {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace internal {
 | 
					namespace internal {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -328,7 +328,7 @@ class GTEST_API_ KilledBySignal {
 | 
				
			|||||||
// death tests are supported; otherwise they just issue a warning.  This is
 | 
					// death tests are supported; otherwise they just issue a warning.  This is
 | 
				
			||||||
// useful when you are combining death test assertions with normal test
 | 
					// useful when you are combining death test assertions with normal test
 | 
				
			||||||
// assertions in one test.
 | 
					// assertions in one test.
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
 | 
					#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
 | 
				
			||||||
  EXPECT_DEATH(statement, regex)
 | 
					  EXPECT_DEATH(statement, regex)
 | 
				
			||||||
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
 | 
					#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -600,7 +600,7 @@ class GTEST_API_ TestInfo {
 | 
				
			|||||||
  const TestResult* result() const { return &result_; }
 | 
					  const TestResult* result() const { return &result_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 private:
 | 
					 private:
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  friend class internal::DefaultDeathTestFactory;
 | 
					  friend class internal::DefaultDeathTestFactory;
 | 
				
			||||||
#endif  // GTEST_HAS_DEATH_TEST
 | 
					#endif  // GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  friend class Test;
 | 
					  friend class Test;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,7 +57,7 @@ const char kDeathTestStyleFlag[] = "death_test_style";
 | 
				
			|||||||
const char kDeathTestUseFork[] = "death_test_use_fork";
 | 
					const char kDeathTestUseFork[] = "death_test_use_fork";
 | 
				
			||||||
const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
 | 
					const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
 | 
					GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
 | 
				
			||||||
/* class A needs to have dll-interface to be used by clients of class B */)
 | 
					/* class A needs to have dll-interface to be used by clients of class B */)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -161,10 +161,10 @@
 | 
				
			|||||||
// NOT define them.
 | 
					// NOT define them.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// These macros are public so that portable tests can be written.
 | 
					// These macros are public so that portable tests can be written.
 | 
				
			||||||
// Such tests typically surround code using a feature with an #if
 | 
					// Such tests typically surround code using a feature with an #ifdef
 | 
				
			||||||
// which controls that code.  For example:
 | 
					// which controls that code.  For example:
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// #if GTEST_HAS_DEATH_TEST
 | 
					// #ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
//   EXPECT_DEATH(DoSomethingDeadly());
 | 
					//   EXPECT_DEATH(DoSomethingDeadly());
 | 
				
			||||||
// #endif
 | 
					// #endif
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -794,7 +794,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif  // GTEST_IS_THREADSAFE
 | 
					#endif  // GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
// Some platforms don't support including these threading related headers.
 | 
					// Some platforms don't support including these threading related headers.
 | 
				
			||||||
#include <condition_variable>  // NOLINT
 | 
					#include <condition_variable>  // NOLINT
 | 
				
			||||||
#include <mutex>               // NOLINT
 | 
					#include <mutex>               // NOLINT
 | 
				
			||||||
@@ -909,7 +909,7 @@ GTEST_API_ bool IsTrue(bool condition);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Defines RE.
 | 
					// Defines RE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_USES_RE2
 | 
					#ifdef GTEST_USES_RE2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This is almost `using RE = ::RE2`, except it is copy-constructible, and it
 | 
					// This is almost `using RE = ::RE2`, except it is copy-constructible, and it
 | 
				
			||||||
// needs to disambiguate the `std::string`, `absl::string_view`, and `const
 | 
					// needs to disambiguate the `std::string`, `absl::string_view`, and `const
 | 
				
			||||||
@@ -934,7 +934,7 @@ class GTEST_API_ RE {
 | 
				
			|||||||
  RE2 regex_;
 | 
					  RE2 regex_;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
 | 
					#elif defined(GTEST_USES_POSIX_RE) || defined(GTEST_USES_SIMPLE_RE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
 | 
					// A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
 | 
				
			||||||
// Regular Expression syntax.
 | 
					// Regular Expression syntax.
 | 
				
			||||||
@@ -972,7 +972,7 @@ class GTEST_API_ RE {
 | 
				
			|||||||
  std::string pattern_;
 | 
					  std::string pattern_;
 | 
				
			||||||
  bool is_valid_;
 | 
					  bool is_valid_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_USES_POSIX_RE
 | 
					#ifdef GTEST_USES_POSIX_RE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  regex_t full_regex_;     // For FullMatch().
 | 
					  regex_t full_regex_;     // For FullMatch().
 | 
				
			||||||
  regex_t partial_regex_;  // For PartialMatch().
 | 
					  regex_t partial_regex_;  // For PartialMatch().
 | 
				
			||||||
@@ -1200,7 +1200,7 @@ GTEST_API_ std::string ReadEntireFile(FILE* file);
 | 
				
			|||||||
// All command line arguments.
 | 
					// All command line arguments.
 | 
				
			||||||
GTEST_API_ std::vector<std::string> GetArgvs();
 | 
					GTEST_API_ std::vector<std::string> GetArgvs();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::vector<std::string> GetInjectableArgvs();
 | 
					std::vector<std::string> GetInjectableArgvs();
 | 
				
			||||||
// Deprecated: pass the args vector by value instead.
 | 
					// Deprecated: pass the args vector by value instead.
 | 
				
			||||||
@@ -1211,7 +1211,7 @@ void ClearInjectableArgvs();
 | 
				
			|||||||
#endif  // GTEST_HAS_DEATH_TEST
 | 
					#endif  // GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Defines synchronization primitives.
 | 
					// Defines synchronization primitives.
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef GTEST_OS_WINDOWS
 | 
					#ifdef GTEST_OS_WINDOWS
 | 
				
			||||||
// Provides leak-safe Windows kernel handle ownership.
 | 
					// Provides leak-safe Windows kernel handle ownership.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@
 | 
				
			|||||||
#include "gtest/internal/custom/gtest.h"
 | 
					#include "gtest/internal/custom/gtest.h"
 | 
				
			||||||
#include "gtest/internal/gtest-port.h"
 | 
					#include "gtest/internal/gtest-port.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef GTEST_OS_MAC
 | 
					#ifdef GTEST_OS_MAC
 | 
				
			||||||
#include <crt_externs.h>
 | 
					#include <crt_externs.h>
 | 
				
			||||||
@@ -133,7 +133,7 @@ GTEST_DEFINE_string_(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace testing {
 | 
					namespace testing {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace internal {
 | 
					namespace internal {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -672,7 +672,7 @@ class GTEST_API_ UnitTestImpl {
 | 
				
			|||||||
  void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
 | 
					  void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
 | 
				
			||||||
                   internal::TearDownTestSuiteFunc tear_down_tc,
 | 
					                   internal::TearDownTestSuiteFunc tear_down_tc,
 | 
				
			||||||
                   TestInfo* test_info) {
 | 
					                   TestInfo* test_info) {
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
    // In order to support thread-safe death tests, we need to
 | 
					    // In order to support thread-safe death tests, we need to
 | 
				
			||||||
    // remember the original working directory when the test program
 | 
					    // remember the original working directory when the test program
 | 
				
			||||||
    // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as
 | 
					    // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as
 | 
				
			||||||
@@ -778,7 +778,7 @@ class GTEST_API_ UnitTestImpl {
 | 
				
			|||||||
    return gtest_trace_stack_.get();
 | 
					    return gtest_trace_stack_.get();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  void InitDeathTestSubprocessControlInfo() {
 | 
					  void InitDeathTestSubprocessControlInfo() {
 | 
				
			||||||
    internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
 | 
					    internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -943,7 +943,7 @@ class GTEST_API_ UnitTestImpl {
 | 
				
			|||||||
  // How long the test took to run, in milliseconds.
 | 
					  // How long the test took to run, in milliseconds.
 | 
				
			||||||
  TimeInMillis elapsed_time_;
 | 
					  TimeInMillis elapsed_time_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  // The decomposed components of the gtest_internal_run_death_test flag,
 | 
					  // The decomposed components of the gtest_internal_run_death_test flag,
 | 
				
			||||||
  // parsed when RUN_ALL_TESTS is called.
 | 
					  // parsed when RUN_ALL_TESTS is called.
 | 
				
			||||||
  std::unique_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
 | 
					  std::unique_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
 | 
				
			||||||
@@ -967,7 +967,7 @@ inline UnitTestImpl* GetUnitTestImpl() {
 | 
				
			|||||||
  return UnitTest::GetInstance()->impl();
 | 
					  return UnitTest::GetInstance()->impl();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_USES_SIMPLE_RE
 | 
					#ifdef GTEST_USES_SIMPLE_RE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Internal helper functions for implementing the simple regular
 | 
					// Internal helper functions for implementing the simple regular
 | 
				
			||||||
// expression matcher.
 | 
					// expression matcher.
 | 
				
			||||||
@@ -993,7 +993,7 @@ GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
 | 
				
			|||||||
GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
 | 
					GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
 | 
				
			||||||
GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
 | 
					GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns the message describing the last system error, regardless of the
 | 
					// Returns the message describing the last system error, regardless of the
 | 
				
			||||||
// platform.
 | 
					// platform.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -657,7 +657,7 @@ void ThreadLocalRegistry::OnThreadLocalDestroyed(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif  // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
 | 
					#endif  // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_USES_POSIX_RE
 | 
					#ifdef GTEST_USES_POSIX_RE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Implements RE.  Currently only needed for death tests.
 | 
					// Implements RE.  Currently only needed for death tests.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -719,7 +719,7 @@ void RE::Init(const char* regex) {
 | 
				
			|||||||
  delete[] full_pattern;
 | 
					  delete[] full_pattern;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif GTEST_USES_SIMPLE_RE
 | 
					#elif defined(GTEST_USES_SIMPLE_RE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns true if and only if ch appears anywhere in str (excluding the
 | 
					// Returns true if and only if ch appears anywhere in str (excluding the
 | 
				
			||||||
// terminating '\0' character).
 | 
					// terminating '\0' character).
 | 
				
			||||||
@@ -1221,7 +1221,7 @@ std::string ReadEntireFile(FILE* file) {
 | 
				
			|||||||
  return content;
 | 
					  return content;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
static const std::vector<std::string>* g_injected_test_argvs =
 | 
					static const std::vector<std::string>* g_injected_test_argvs =
 | 
				
			||||||
    nullptr;  // Owned.
 | 
					    nullptr;  // Owned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5018,7 +5018,7 @@ void OsStackTraceGetter::UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_) {
 | 
				
			|||||||
#endif  // GTEST_HAS_ABSL
 | 
					#endif  // GTEST_HAS_ABSL
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
// A helper class that creates the premature-exit file in its
 | 
					// A helper class that creates the premature-exit file in its
 | 
				
			||||||
// constructor and deletes the file in its destructor.
 | 
					// constructor and deletes the file in its destructor.
 | 
				
			||||||
class ScopedPrematureExitFile {
 | 
					class ScopedPrematureExitFile {
 | 
				
			||||||
@@ -5383,7 +5383,7 @@ void UnitTest::RecordProperty(const std::string& key,
 | 
				
			|||||||
// We don't protect this under mutex_, as we only support calling it
 | 
					// We don't protect this under mutex_, as we only support calling it
 | 
				
			||||||
// from the main thread.
 | 
					// from the main thread.
 | 
				
			||||||
int UnitTest::Run() {
 | 
					int UnitTest::Run() {
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  const bool in_death_test_child_process =
 | 
					  const bool in_death_test_child_process =
 | 
				
			||||||
      GTEST_FLAG_GET(internal_run_death_test).length() > 0;
 | 
					      GTEST_FLAG_GET(internal_run_death_test).length() > 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -5560,7 +5560,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
 | 
				
			|||||||
      random_(0),       // Will be reseeded before first use.
 | 
					      random_(0),       // Will be reseeded before first use.
 | 
				
			||||||
      start_timestamp_(0),
 | 
					      start_timestamp_(0),
 | 
				
			||||||
      elapsed_time_(0),
 | 
					      elapsed_time_(0),
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
      death_test_factory_(new DefaultDeathTestFactory),
 | 
					      death_test_factory_(new DefaultDeathTestFactory),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
      // Will be overridden by the flag before first use.
 | 
					      // Will be overridden by the flag before first use.
 | 
				
			||||||
@@ -5600,7 +5600,7 @@ void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
 | 
				
			|||||||
  test_result->RecordProperty(xml_element, test_property);
 | 
					  test_result->RecordProperty(xml_element, test_property);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
// Disables event forwarding if the control is currently in a death test
 | 
					// Disables event forwarding if the control is currently in a death test
 | 
				
			||||||
// subprocess. Must not be called before InitGoogleTest.
 | 
					// subprocess. Must not be called before InitGoogleTest.
 | 
				
			||||||
void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
 | 
					void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
 | 
				
			||||||
@@ -5663,7 +5663,7 @@ void UnitTestImpl::PostFlagParsingInit() {
 | 
				
			|||||||
    listeners()->Append(new GTEST_CUSTOM_TEST_EVENT_LISTENER_());
 | 
					    listeners()->Append(new GTEST_CUSTOM_TEST_EVENT_LISTENER_());
 | 
				
			||||||
#endif  // defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_)
 | 
					#endif  // defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
    InitDeathTestSubprocessControlInfo();
 | 
					    InitDeathTestSubprocessControlInfo();
 | 
				
			||||||
    SuppressTestEventsIfInSubprocess();
 | 
					    SuppressTestEventsIfInSubprocess();
 | 
				
			||||||
#endif  // GTEST_HAS_DEATH_TEST
 | 
					#endif  // GTEST_HAS_DEATH_TEST
 | 
				
			||||||
@@ -5801,7 +5801,7 @@ bool UnitTestImpl::RunAllTests() {
 | 
				
			|||||||
  // death test.
 | 
					  // death test.
 | 
				
			||||||
  bool in_subprocess_for_death_test = false;
 | 
					  bool in_subprocess_for_death_test = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  in_subprocess_for_death_test =
 | 
					  in_subprocess_for_death_test =
 | 
				
			||||||
      (internal_run_death_test_flag_.get() != nullptr);
 | 
					      (internal_run_death_test_flag_.get() != nullptr);
 | 
				
			||||||
#if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
 | 
					#if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@
 | 
				
			|||||||
using testing::internal::AlwaysFalse;
 | 
					using testing::internal::AlwaysFalse;
 | 
				
			||||||
using testing::internal::AlwaysTrue;
 | 
					using testing::internal::AlwaysTrue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef GTEST_OS_WINDOWS
 | 
					#ifdef GTEST_OS_WINDOWS
 | 
				
			||||||
#include <direct.h>  // For chdir().
 | 
					#include <direct.h>  // For chdir().
 | 
				
			||||||
@@ -1353,7 +1353,7 @@ void DieWithMessage(const char* message) {
 | 
				
			|||||||
TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) {
 | 
					TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) {
 | 
				
			||||||
  // googletest tests this, of course; here we ensure that including googlemock
 | 
					  // googletest tests this, of course; here we ensure that including googlemock
 | 
				
			||||||
  // has not broken it.
 | 
					  // has not broken it.
 | 
				
			||||||
#if GTEST_USES_POSIX_RE
 | 
					#ifdef GTEST_USES_POSIX_RE
 | 
				
			||||||
  EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I d[aeiou]e");
 | 
					  EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I d[aeiou]e");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I di?e");
 | 
					  EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I di?e");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@
 | 
				
			|||||||
#include "gtest/gtest-death-test.h"
 | 
					#include "gtest/gtest-death-test.h"
 | 
				
			||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_SEH
 | 
					#if GTEST_HAS_SEH
 | 
				
			||||||
#include <windows.h>  // For RaiseException().
 | 
					#include <windows.h>  // For RaiseException().
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127 /* conditional expression is constant */)
 | 
					GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127 /* conditional expression is constant */)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
using testing::ScopedFakeTestPartResultReporter;
 | 
					using testing::ScopedFakeTestPartResultReporter;
 | 
				
			||||||
using testing::TestPartResultArray;
 | 
					using testing::TestPartResultArray;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -247,7 +247,7 @@ TEST(SCOPED_TRACETest, CanBeRepeated) {
 | 
				
			|||||||
                << "contain trace point A, B, and D.";
 | 
					                << "contain trace point A, B, and D.";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
// Tests that SCOPED_TRACE()s can be used concurrently from multiple
 | 
					// Tests that SCOPED_TRACE()s can be used concurrently from multiple
 | 
				
			||||||
// threads.  Namely, an assertion should be affected by
 | 
					// threads.  Namely, an assertion should be affected by
 | 
				
			||||||
// SCOPED_TRACE()s in its own thread only.
 | 
					// SCOPED_TRACE()s in its own thread only.
 | 
				
			||||||
@@ -773,7 +773,7 @@ REGISTER_TYPED_TEST_SUITE_P(DetectNotInstantiatedTypesTest, Used);
 | 
				
			|||||||
// typedef ::testing::Types<char, int, unsigned int> MyTypes;
 | 
					// typedef ::testing::Types<char, int, unsigned int> MyTypes;
 | 
				
			||||||
// INSTANTIATE_TYPED_TEST_SUITE_P(All, DetectNotInstantiatedTypesTest, MyTypes);
 | 
					// INSTANTIATE_TYPED_TEST_SUITE_P(All, DetectNotInstantiatedTypesTest, MyTypes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// We rely on the golden file to verify that tests whose test case
 | 
					// We rely on the golden file to verify that tests whose test case
 | 
				
			||||||
// name ends with DeathTest are run first.
 | 
					// name ends with DeathTest are run first.
 | 
				
			||||||
@@ -851,7 +851,7 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
 | 
				
			|||||||
                          "failure.");
 | 
					                          "failure.");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ExpectFailureWithThreadsTest : public ExpectFailureTest {
 | 
					class ExpectFailureWithThreadsTest : public ExpectFailureTest {
 | 
				
			||||||
 protected:
 | 
					 protected:
 | 
				
			||||||
@@ -1024,7 +1024,7 @@ int main(int argc, char** argv) {
 | 
				
			|||||||
      std::count(argv, argv + argc,
 | 
					      std::count(argv, argv + argc,
 | 
				
			||||||
                 std::string("internal_skip_environment_and_ad_hoc_tests")) > 0;
 | 
					                 std::string("internal_skip_environment_and_ad_hoc_tests")) > 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
  if (GTEST_FLAG_GET(internal_run_death_test) != "") {
 | 
					  if (GTEST_FLAG_GET(internal_run_death_test) != "") {
 | 
				
			||||||
    // Skip the usual output capturing if we're running as the child
 | 
					    // Skip the usual output capturing if we're running as the child
 | 
				
			||||||
    // process of an threadsafe-style death test.
 | 
					    // process of an threadsafe-style death test.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -361,7 +361,7 @@ TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
 | 
				
			|||||||
  const char regex[] =
 | 
					  const char regex[] =
 | 
				
			||||||
#ifdef _MSC_VER
 | 
					#ifdef _MSC_VER
 | 
				
			||||||
      "googletest-port-test\\.cc\\(\\d+\\):"
 | 
					      "googletest-port-test\\.cc\\(\\d+\\):"
 | 
				
			||||||
#elif GTEST_USES_POSIX_RE
 | 
					#elif defined(GTEST_USES_POSIX_RE)
 | 
				
			||||||
      "googletest-port-test\\.cc:[0-9]+"
 | 
					      "googletest-port-test\\.cc:[0-9]+"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
      "googletest-port-test\\.cc:\\d+"
 | 
					      "googletest-port-test\\.cc:\\d+"
 | 
				
			||||||
@@ -372,7 +372,7 @@ TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
 | 
				
			|||||||
                            regex);
 | 
					                            regex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
 | 
					TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
 | 
				
			||||||
  EXPECT_EXIT(
 | 
					  EXPECT_EXIT(
 | 
				
			||||||
@@ -399,7 +399,7 @@ TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_USES_POSIX_RE
 | 
					#ifdef GTEST_USES_POSIX_RE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename Str>
 | 
					template <typename Str>
 | 
				
			||||||
class RETest : public ::testing::Test {};
 | 
					class RETest : public ::testing::Test {};
 | 
				
			||||||
@@ -456,7 +456,7 @@ TYPED_TEST(RETest, PartialMatchWorks) {
 | 
				
			|||||||
  EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
 | 
					  EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif GTEST_USES_SIMPLE_RE
 | 
					#elif defined(GTEST_USES_SIMPLE_RE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(IsInSetTest, NulCharIsNotInAnySet) {
 | 
					TEST(IsInSetTest, NulCharIsNotInAnySet) {
 | 
				
			||||||
  EXPECT_FALSE(IsInSet('\0', ""));
 | 
					  EXPECT_FALSE(IsInSet('\0', ""));
 | 
				
			||||||
@@ -1011,7 +1011,7 @@ TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) {
 | 
				
			|||||||
  EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
 | 
					  EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AddTwo(int* param) { *param += 2; }
 | 
					void AddTwo(int* param) { *param += 2; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,6 @@ TEST(HelpFlagTest, ShouldNotBeRun) {
 | 
				
			|||||||
  ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified.";
 | 
					  ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified.";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_DEATH_TEST
 | 
					#ifdef GTEST_HAS_DEATH_TEST
 | 
				
			||||||
TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {}
 | 
					TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@
 | 
				
			|||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
#include "src/gtest-internal-inl.h"
 | 
					#include "src/gtest-internal-inl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace testing {
 | 
					namespace testing {
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -270,7 +270,7 @@ using testing::internal::CaptureStdout;
 | 
				
			|||||||
using testing::internal::GetCapturedStdout;
 | 
					using testing::internal::GetCapturedStdout;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
using testing::internal::ThreadWithParam;
 | 
					using testing::internal::ThreadWithParam;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1189,7 +1189,7 @@ TEST_F(ScopedFakeTestPartResultReporterTest, DeprecatedConstructor) {
 | 
				
			|||||||
  EXPECT_EQ(1, results.size());
 | 
					  EXPECT_EQ(1, results.size());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ScopedFakeTestPartResultReporterWithThreadsTest
 | 
					class ScopedFakeTestPartResultReporterWithThreadsTest
 | 
				
			||||||
    : public ScopedFakeTestPartResultReporterTest {
 | 
					    : public ScopedFakeTestPartResultReporterTest {
 | 
				
			||||||
@@ -1347,7 +1347,7 @@ TEST_F(ExpectNonfatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
 | 
				
			|||||||
      "");
 | 
					      "");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_IS_THREADSAFE
 | 
					#ifdef GTEST_IS_THREADSAFE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef ScopedFakeTestPartResultReporterWithThreadsTest
 | 
					typedef ScopedFakeTestPartResultReporterWithThreadsTest
 | 
				
			||||||
    ExpectFailureWithThreadsTest;
 | 
					    ExpectFailureWithThreadsTest;
 | 
				
			||||||
@@ -6178,7 +6178,7 @@ TEST_F(ParseFlagsTest, FilterBad) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const char* argv2[] = {"foo.exe", "--gtest_filter", nullptr};
 | 
					  const char* argv2[] = {"foo.exe", "--gtest_filter", nullptr};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_ABSL && GTEST_HAS_DEATH_TEST
 | 
					#if GTEST_HAS_ABSL && defined(GTEST_HAS_DEATH_TEST)
 | 
				
			||||||
  // Invalid flag arguments are a fatal error when using the Abseil Flags.
 | 
					  // Invalid flag arguments are a fatal error when using the Abseil Flags.
 | 
				
			||||||
  EXPECT_EXIT(GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true),
 | 
					  EXPECT_EXIT(GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true),
 | 
				
			||||||
              testing::ExitedWithCode(1),
 | 
					              testing::ExitedWithCode(1),
 | 
				
			||||||
@@ -6197,7 +6197,7 @@ TEST_F(ParseFlagsTest, OutputEmpty) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const char* argv2[] = {"foo.exe", "--gtest_output", nullptr};
 | 
					  const char* argv2[] = {"foo.exe", "--gtest_output", nullptr};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if GTEST_HAS_ABSL && GTEST_HAS_DEATH_TEST
 | 
					#if GTEST_HAS_ABSL && defined(GTEST_HAS_DEATH_TEST)
 | 
				
			||||||
  // Invalid flag arguments are a fatal error when using the Abseil Flags.
 | 
					  // Invalid flag arguments are a fatal error when using the Abseil Flags.
 | 
				
			||||||
  EXPECT_EXIT(GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true),
 | 
					  EXPECT_EXIT(GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true),
 | 
				
			||||||
              testing::ExitedWithCode(1),
 | 
					              testing::ExitedWithCode(1),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user