45#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
46#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
271#if defined(_MSVC_LANG)
272#define GTEST_INTERNAL_CPLUSPLUS_LANG _MSVC_LANG
273#elif defined(__cplusplus)
274#define GTEST_INTERNAL_CPLUSPLUS_LANG __cplusplus
277#if !defined(GTEST_INTERNAL_CPLUSPLUS_LANG) || \
278 GTEST_INTERNAL_CPLUSPLUS_LANG < 201402L
279#error C++ versions less than C++14 are not supported.
299#include <type_traits>
304#include <sys/types.h>
308#include <AvailabilityMacros.h>
309#include <TargetConditionals.h>
315#ifndef GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
316#define GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ 0
319#ifndef GTEST_HAS_NOTIFICATION_
320#define GTEST_HAS_NOTIFICATION_ 0
324#include "absl/flags/declare.h"
325#include "absl/flags/flag.h"
326#include "absl/flags/reflection.h"
329#if !defined(GTEST_DEV_EMAIL_)
330#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
331#define GTEST_FLAG_PREFIX_ "gtest_"
332#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
333#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
334#define GTEST_NAME_ "Google Test"
335#define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
338#if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
339#define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
345#define GTEST_GCC_VER_ \
346 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
355#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
356 __pragma(warning(push)) __pragma(warning(disable : warnings))
357#define GTEST_DISABLE_MSC_WARNINGS_POP_() __pragma(warning(pop))
360#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
361#define GTEST_DISABLE_MSC_WARNINGS_POP_()
367#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
368 _Pragma("clang diagnostic push") \
369 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
370 _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
371#define GTEST_DISABLE_MSC_DEPRECATED_POP_() _Pragma("clang diagnostic pop")
373#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
374 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
375#define GTEST_DISABLE_MSC_DEPRECATED_POP_() GTEST_DISABLE_MSC_WARNINGS_POP_()
381#ifdef GTEST_OS_WINDOWS
382#ifndef GTEST_OS_WINDOWS_MOBILE
387#if defined(GTEST_OS_WINDOWS_MINGW) && !defined(__MINGW64_VERSION_MAJOR)
390typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
395typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
397#elif defined(GTEST_OS_XTENSA)
409#ifdef GTEST_OS_LINUX_ANDROID
411#include <android/api-level.h>
416#ifndef GTEST_HAS_POSIX_RE
417#ifdef GTEST_OS_LINUX_ANDROID
419#define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
421#if !(defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_XTENSA) || \
422 defined(GTEST_OS_QURT))
423#define GTEST_HAS_POSIX_RE 1
425#define GTEST_HAS_POSIX_RE 0
433#include "absl/strings/string_view.h"
435#define GTEST_USES_RE2 1
436#elif GTEST_HAS_POSIX_RE
438#define GTEST_USES_POSIX_RE 1
441#define GTEST_USES_SIMPLE_RE 1
444#ifndef GTEST_HAS_EXCEPTIONS
447#if defined(_MSC_VER) && defined(_CPPUNWIND)
449#define GTEST_HAS_EXCEPTIONS 1
450#elif defined(__BORLANDC__)
454#ifndef _HAS_EXCEPTIONS
455#define _HAS_EXCEPTIONS 1
457#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
458#elif defined(__clang__)
467#if defined(__EXCEPTIONS) && __EXCEPTIONS && __has_feature(cxx_exceptions)
468#define GTEST_HAS_EXCEPTIONS 1
470#define GTEST_HAS_EXCEPTIONS 0
472#elif defined(__GNUC__) && defined(__EXCEPTIONS) && __EXCEPTIONS
474#define GTEST_HAS_EXCEPTIONS 1
475#elif defined(__SUNPRO_CC)
479#define GTEST_HAS_EXCEPTIONS 1
480#elif defined(__IBMCPP__) && defined(__EXCEPTIONS) && __EXCEPTIONS
482#define GTEST_HAS_EXCEPTIONS 1
483#elif defined(__HP_aCC)
486#define GTEST_HAS_EXCEPTIONS 1
490#define GTEST_HAS_EXCEPTIONS 0
494#ifndef GTEST_HAS_STD_WSTRING
500#if (!(defined(GTEST_OS_LINUX_ANDROID) || defined(GTEST_OS_CYGWIN) || \
501 defined(GTEST_OS_SOLARIS) || defined(GTEST_OS_HAIKU) || \
502 defined(GTEST_OS_ESP32) || defined(GTEST_OS_ESP8266) || \
503 defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
504 defined(GTEST_OS_NXP_QN9090) || defined(GTEST_OS_NRF52)))
505#define GTEST_HAS_STD_WSTRING 1
507#define GTEST_HAS_STD_WSTRING 0
511#ifndef GTEST_HAS_FILE_SYSTEM
513#define GTEST_HAS_FILE_SYSTEM 1
517#ifndef GTEST_HAS_RTTI
524#define GTEST_HAS_RTTI 1
526#define GTEST_HAS_RTTI 0
531#elif defined(__GNUC__)
538#if defined(GTEST_OS_LINUX_ANDROID) && defined(_STLPORT_MAJOR) && \
539 !defined(__EXCEPTIONS)
540#define GTEST_HAS_RTTI 0
542#define GTEST_HAS_RTTI 1
545#define GTEST_HAS_RTTI 0
551#elif defined(__clang__)
553#define GTEST_HAS_RTTI __has_feature(cxx_rtti)
557#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
560#define GTEST_HAS_RTTI 1
562#define GTEST_HAS_RTTI 0
568#define GTEST_HAS_RTTI 1
581#ifndef GTEST_HAS_PTHREAD
587#if (defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC) || \
588 defined(GTEST_OS_HPUX) || defined(GTEST_OS_QNX) || \
589 defined(GTEST_OS_FREEBSD) || defined(GTEST_OS_NACL) || \
590 defined(GTEST_OS_NETBSD) || defined(GTEST_OS_FUCHSIA) || \
591 defined(GTEST_OS_DRAGONFLY) || defined(GTEST_OS_GNU_KFREEBSD) || \
592 defined(GTEST_OS_OPENBSD) || defined(GTEST_OS_HAIKU) || \
593 defined(GTEST_OS_GNU_HURD))
594#define GTEST_HAS_PTHREAD 1
596#define GTEST_HAS_PTHREAD 0
613#ifndef GTEST_HAS_CLONE
616#if defined(GTEST_OS_LINUX) && !defined(__ia64__)
617#if defined(GTEST_OS_LINUX_ANDROID)
620#if defined(__LP64__) || (defined(__arm__) && __ANDROID_API__ >= 9) || \
621 (defined(__mips__) && __ANDROID_API__ >= 12) || \
622 (defined(__i386__) && __ANDROID_API__ >= 17)
623#define GTEST_HAS_CLONE 1
625#define GTEST_HAS_CLONE 0
628#define GTEST_HAS_CLONE 1
631#define GTEST_HAS_CLONE 0
638#ifndef GTEST_HAS_STREAM_REDIRECTION
642#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
643 defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
644 defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
645 !GTEST_HAS_FILE_SYSTEM
646#define GTEST_HAS_STREAM_REDIRECTION 0
648#define GTEST_HAS_STREAM_REDIRECTION 1
654#if (defined(GTEST_OS_LINUX) || defined(GTEST_OS_CYGWIN) || \
655 defined(GTEST_OS_SOLARIS) || \
656 (defined(GTEST_OS_MAC) && !defined(GTEST_OS_IOS)) || \
657 (defined(GTEST_OS_WINDOWS_DESKTOP) && _MSC_VER) || \
658 defined(GTEST_OS_WINDOWS_MINGW) || defined(GTEST_OS_AIX) || \
659 defined(GTEST_OS_HPUX) || defined(GTEST_OS_OPENBSD) || \
660 defined(GTEST_OS_QNX) || defined(GTEST_OS_FREEBSD) || \
661 defined(GTEST_OS_NETBSD) || defined(GTEST_OS_FUCHSIA) || \
662 defined(GTEST_OS_DRAGONFLY) || defined(GTEST_OS_GNU_KFREEBSD) || \
663 defined(GTEST_OS_HAIKU) || defined(GTEST_OS_GNU_HURD))
665#if GTEST_HAS_FILE_SYSTEM
666#define GTEST_HAS_DEATH_TEST 1
674#if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \
675 defined(__IBMCPP__) || defined(__HP_aCC)
676#define GTEST_HAS_TYPED_TEST 1
677#define GTEST_HAS_TYPED_TEST_P 1
681#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
682 defined(GTEST_OS_AIX) || defined(GTEST_OS_OS2)
683#define GTEST_WIDE_STRING_USES_UTF16_ 1
685#define GTEST_WIDE_STRING_USES_UTF16_ 0
689#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_GNU_KFREEBSD) || \
690 defined(GTEST_OS_DRAGONFLY) || defined(GTEST_OS_FREEBSD) || \
691 defined(GTEST_OS_NETBSD) || defined(GTEST_OS_OPENBSD) || \
692 defined(GTEST_OS_GNU_HURD) || defined(GTEST_OS_MAC)
693#define GTEST_CAN_STREAM_RESULTS_ 1
695#define GTEST_CAN_STREAM_RESULTS_ 0
708#ifdef __INTEL_COMPILER
709#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
711#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
727#ifdef __has_attribute
728#define GTEST_HAVE_ATTRIBUTE_(x) __has_attribute(x)
730#define GTEST_HAVE_ATTRIBUTE_(x) 0
738#define GTEST_HAVE_FEATURE_(x) __has_feature(x)
740#define GTEST_HAVE_FEATURE_(x) 0
748#if GTEST_HAVE_ATTRIBUTE_(unused)
749#define GTEST_ATTRIBUTE_UNUSED_ __attribute__((unused))
751#define GTEST_ATTRIBUTE_UNUSED_
755#if GTEST_HAVE_ATTRIBUTE_(format) && defined(__MINGW_PRINTF_FORMAT)
759#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
760 __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, first_to_check)))
761#elif GTEST_HAVE_ATTRIBUTE_(format)
762#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
763 __attribute__((format(printf, string_index, first_to_check)))
765#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
773#if GTEST_HAVE_ATTRIBUTE_(warn_unused_result)
774#define GTEST_MUST_USE_RESULT_ __attribute__((warn_unused_result))
776#define GTEST_MUST_USE_RESULT_
787#define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
788 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
789#define GTEST_INTENTIONAL_CONST_COND_POP_() GTEST_DISABLE_MSC_WARNINGS_POP_()
797#if defined(_MSC_VER) || defined(__BORLANDC__)
799#define GTEST_HAS_SEH 1
802#define GTEST_HAS_SEH 0
807#ifndef GTEST_IS_THREADSAFE
809#if (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ || \
810 (defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_PHONE) && \
811 !defined(GTEST_OS_WINDOWS_RT)) || \
813#define GTEST_IS_THREADSAFE 1
818#ifdef GTEST_IS_THREADSAFE
820#include <condition_variable>
830#if GTEST_LINKED_AS_SHARED_LIBRARY
831#define GTEST_API_ __declspec(dllimport)
832#elif GTEST_CREATE_SHARED_LIBRARY
833#define GTEST_API_ __declspec(dllexport)
835#elif GTEST_HAVE_ATTRIBUTE_(visibility)
836#define GTEST_API_ __attribute__((visibility("default")))
845#ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
846#define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
849#if GTEST_HAVE_ATTRIBUTE_(noinline)
851#define GTEST_NO_INLINE_ __attribute__((noinline))
853#define GTEST_NO_INLINE_
856#if GTEST_HAVE_ATTRIBUTE_(disable_tail_calls)
859#define GTEST_NO_TAIL_CALL_ __attribute__((disable_tail_calls))
860#elif defined(__GNUC__) && !defined(__NVCOMPILER)
861#define GTEST_NO_TAIL_CALL_ \
862 __attribute__((optimize("no-optimize-sibling-calls")))
864#define GTEST_NO_TAIL_CALL_
868#if !defined(GTEST_HAS_CXXABI_H_)
869#if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
870#define GTEST_HAS_CXXABI_H_ 1
872#define GTEST_HAS_CXXABI_H_ 0
878#if GTEST_HAVE_ATTRIBUTE_(no_sanitize_memory)
879#define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ __attribute__((no_sanitize_memory))
881#define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
885#if GTEST_HAVE_ATTRIBUTE_(no_sanitize_address)
886#define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
887 __attribute__((no_sanitize_address))
889#define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
893#if GTEST_HAVE_FEATURE_(hwaddress_sanitizer) && \
894 GTEST_HAVE_ATTRIBUTE_(no_sanitize)
895#define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ \
896 __attribute__((no_sanitize("hwaddress")))
898#define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
902#if GTEST_HAVE_ATTRIBUTE_(no_sanitize_thread)
903#define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ __attribute((no_sanitize_thread))
905#define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
915using std::make_tuple;
917using std::tuple_element;
918using std::tuple_size;
942 RE(absl::string_view regex) : regex_(regex) {}
943 RE(
const char* regex) : RE(absl::string_view(regex)) {}
944 RE(
const std::string& regex) : RE(absl::string_view(regex)) {}
945 RE(
const RE& other) : RE(other.pattern()) {}
947 const std::string& pattern()
const {
return regex_.pattern(); }
949 static bool FullMatch(absl::string_view str,
const RE& re) {
950 return RE2::FullMatch(str, re.regex_);
952 static bool PartialMatch(absl::string_view str,
const RE& re) {
953 return RE2::PartialMatch(str, re.regex_);
960#elif defined(GTEST_USES_POSIX_RE) || defined(GTEST_USES_SIMPLE_RE)
970 RE(
const RE& other) { Init(other.pattern()); }
973 RE(const ::std::string& regex) { Init(regex.c_str()); }
975 RE(
const char* regex) { Init(regex); }
979 const char* pattern()
const {
return pattern_.c_str(); }
985 static bool FullMatch(const ::std::string& str,
const RE& re) {
986 return FullMatch(str.c_str(), re);
988 static bool PartialMatch(const ::std::string& str,
const RE& re) {
989 return PartialMatch(str.c_str(), re);
992 static bool FullMatch(
const char* str,
const RE& re);
993 static bool PartialMatch(
const char* str,
const RE& re);
996 void Init(
const char* regex);
997 std::string pattern_;
1000#ifdef GTEST_USES_POSIX_RE
1002 regex_t full_regex_;
1003 regex_t partial_regex_;
1007 std::string full_pattern_;
1051#if !defined(GTEST_LOG_)
1053#define GTEST_LOG_(severity) \
1054 ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
1055 __FILE__, __LINE__) \
1063#if !defined(GTEST_CHECK_)
1078#define GTEST_CHECK_(condition) \
1079 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1080 if (::testing::internal::IsTrue(condition)) \
1083 GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
1091#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
1092 if (const int gtest_error = (posix_call)) \
1093 GTEST_LOG_(FATAL) << #posix_call << "failed with error " << gtest_error
1106template <
typename T>
1110template <
typename T>
1116#define GTEST_REFERENCE_TO_CONST_(T) \
1117 typename ::testing::internal::ConstRef<T>::type
1139template <
typename To>
1149template <
class Derived,
class Base>
1151 static_assert(std::is_base_of<Base, Derived>::value,
1152 "target type not derived from source type");
1154 GTEST_CHECK_(base ==
nullptr ||
dynamic_cast<Derived*
>(base) !=
nullptr);
1156 return static_cast<Derived*
>(base);
1159#if GTEST_HAS_STREAM_REDIRECTION
1182#ifdef GTEST_HAS_DEATH_TEST
1184std::vector<std::string> GetInjectableArgvs();
1186void SetInjectableArgvs(
const std::vector<std::string>* new_argvs);
1187void SetInjectableArgvs(
const std::vector<std::string>& new_argvs);
1188void ClearInjectableArgvs();
1193#ifdef GTEST_IS_THREADSAFE
1195#ifdef GTEST_OS_WINDOWS
1205 typedef void* Handle;
1207 explicit AutoHandle(Handle handle);
1213 void Reset(Handle handle);
1218 bool IsCloseable()
const;
1222 AutoHandle(
const AutoHandle&) =
delete;
1223 AutoHandle& operator=(
const AutoHandle&) =
delete;
1227#if GTEST_HAS_NOTIFICATION_
1244 Notification() : notified_(false) {}
1245 Notification(
const Notification&) =
delete;
1246 Notification& operator=(
const Notification&) =
delete;
1251 std::lock_guard<std::mutex> lock(mu_);
1258 void WaitForNotification() {
1259 std::unique_lock<std::mutex> lock(mu_);
1260 cv_.wait(lock, [
this]() {
return notified_; });
1265 std::condition_variable cv_;
1274#if GTEST_HAS_PTHREAD && !defined(GTEST_OS_WINDOWS_MINGW)
1281class ThreadWithParamBase {
1283 virtual ~ThreadWithParamBase() =
default;
1284 virtual void Run() = 0;
1293extern "C" inline void* ThreadFuncWithCLinkage(
void* thread) {
1294 static_cast<ThreadWithParamBase*
>(thread)->
Run();
1310template <
typename T>
1311class ThreadWithParam :
public ThreadWithParamBase {
1313 typedef void UserThreadFunc(
T);
1315 ThreadWithParam(UserThreadFunc* func,
T param, Notification* thread_can_start)
1318 thread_can_start_(thread_can_start),
1320 ThreadWithParamBase*
const base =
this;
1324 pthread_create(&thread_,
nullptr, &ThreadFuncWithCLinkage, base));
1326 ~ThreadWithParam()
override { Join(); }
1335 void Run()
override {
1336 if (thread_can_start_ !=
nullptr) thread_can_start_->WaitForNotification();
1341 UserThreadFunc*
const func_;
1345 Notification*
const thread_can_start_;
1350 ThreadWithParam(
const ThreadWithParam&) =
delete;
1351 ThreadWithParam& operator=(
const ThreadWithParam&) =
delete;
1356#if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1360#elif defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_PHONE) && \
1361 !defined(GTEST_OS_WINDOWS_RT)
1379 enum MutexType { kStatic = 0, kDynamic = 1 };
1383 enum StaticConstructorSelector { kStaticMutex = 0 };
1388 explicit Mutex(StaticConstructorSelector ) {}
1403 void ThreadSafeLazyInit();
1407 unsigned int owner_thread_id_;
1412 long critical_section_init_phase_;
1413 GTEST_CRITICAL_SECTION* critical_section_;
1415 Mutex(
const Mutex&) =
delete;
1416 Mutex& operator=(
const Mutex&) =
delete;
1419#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1420 extern ::testing::internal::Mutex mutex
1422#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1423 ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
1430class GTestMutexLock {
1432 explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); }
1434 ~GTestMutexLock() { mutex_->Unlock(); }
1437 Mutex*
const mutex_;
1447class ThreadLocalValueHolderBase {
1449 virtual ~ThreadLocalValueHolderBase() {}
1454class ThreadLocalBase {
1460 virtual ThreadLocalValueHolderBase* NewValueForCurrentThread()
const = 0;
1463 ThreadLocalBase() {}
1464 virtual ~ThreadLocalBase() {}
1467 ThreadLocalBase(
const ThreadLocalBase&) =
delete;
1468 ThreadLocalBase& operator=(
const ThreadLocalBase&) =
delete;
1478 static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
1479 const ThreadLocalBase* thread_local_instance);
1482 static void OnThreadLocalDestroyed(
1483 const ThreadLocalBase* thread_local_instance);
1493 virtual ~Runnable() {}
1494 virtual void Run() = 0;
1497 ThreadWithParamBase(Runnable* runnable, Notification* thread_can_start);
1498 virtual ~ThreadWithParamBase();
1505template <
typename T>
1506class ThreadWithParam :
public ThreadWithParamBase {
1508 typedef void UserThreadFunc(
T);
1510 ThreadWithParam(UserThreadFunc* func,
T param, Notification* thread_can_start)
1511 : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {}
1512 virtual ~ThreadWithParam() {}
1515 class RunnableImpl :
public Runnable {
1517 RunnableImpl(UserThreadFunc* func,
T param) : func_(func), param_(param) {}
1518 virtual ~RunnableImpl() {}
1519 virtual void Run() { func_(param_); }
1522 UserThreadFunc*
const func_;
1525 RunnableImpl(
const RunnableImpl&) =
delete;
1526 RunnableImpl& operator=(
const RunnableImpl&) =
delete;
1529 ThreadWithParam(
const ThreadWithParam&) =
delete;
1530 ThreadWithParam& operator=(
const ThreadWithParam&) =
delete;
1560template <
typename T>
1561class ThreadLocal :
public ThreadLocalBase {
1563 ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
1565 : default_factory_(new InstanceValueHolderFactory(
value)) {}
1567 ~ThreadLocal()
override { ThreadLocalRegistry::OnThreadLocalDestroyed(
this); }
1569 T*
pointer() {
return GetOrCreateValue(); }
1570 const T*
pointer()
const {
return GetOrCreateValue(); }
1577 class ValueHolder :
public ThreadLocalValueHolderBase {
1579 ValueHolder() : value_() {}
1580 explicit ValueHolder(
const T&
value) : value_(
value) {}
1582 T* pointer() {
return &value_; }
1586 ValueHolder(
const ValueHolder&) =
delete;
1587 ValueHolder& operator=(
const ValueHolder&) =
delete;
1590 T* GetOrCreateValue()
const {
1591 return static_cast<ValueHolder*
>(
1592 ThreadLocalRegistry::GetValueOnCurrentThread(
this))
1596 ThreadLocalValueHolderBase* NewValueForCurrentThread()
const override {
1597 return default_factory_->MakeNewHolder();
1600 class ValueHolderFactory {
1602 ValueHolderFactory() {}
1603 virtual ~ValueHolderFactory() {}
1604 virtual ValueHolder* MakeNewHolder()
const = 0;
1607 ValueHolderFactory(
const ValueHolderFactory&) =
delete;
1608 ValueHolderFactory& operator=(
const ValueHolderFactory&) =
delete;
1611 class DefaultValueHolderFactory :
public ValueHolderFactory {
1613 DefaultValueHolderFactory() {}
1614 ValueHolder* MakeNewHolder()
const override {
return new ValueHolder(); }
1617 DefaultValueHolderFactory(
const DefaultValueHolderFactory&) =
delete;
1618 DefaultValueHolderFactory& operator=(
const DefaultValueHolderFactory&) =
1622 class InstanceValueHolderFactory :
public ValueHolderFactory {
1624 explicit InstanceValueHolderFactory(
const T&
value) : value_(
value) {}
1625 ValueHolder* MakeNewHolder()
const override {
1626 return new ValueHolder(value_);
1632 InstanceValueHolderFactory(
const InstanceValueHolderFactory&) =
delete;
1633 InstanceValueHolderFactory& operator=(
const InstanceValueHolderFactory&) =
1637 std::unique_ptr<ValueHolderFactory> default_factory_;
1643#elif GTEST_HAS_PTHREAD
1651 owner_ = pthread_self();
1667 void AssertHeld()
const {
1668 GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
1669 <<
"The current thread is not holding the mutex @" <<
this;
1678 pthread_mutex_t mutex_;
1690#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1691 extern ::testing::internal::MutexBase mutex
1699#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1700 ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
1704class Mutex :
public MutexBase {
1722class GTestMutexLock {
1724 explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->Lock(); }
1726 ~GTestMutexLock() { mutex_->Unlock(); }
1729 MutexBase*
const mutex_;
1745 virtual ~ThreadLocalValueHolderBase() =
default;
1750extern "C" inline void DeleteThreadLocalValue(
void* value_holder) {
1751 delete static_cast<ThreadLocalValueHolderBase*
>(value_holder);
1755template <
typename T>
1759 : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
1760 explicit ThreadLocal(
const T&
value)
1761 : key_(CreateKey()),
1762 default_factory_(new InstanceValueHolderFactory(
value)) {}
1766 DeleteThreadLocalValue(pthread_getspecific(key_));
1773 T* pointer() {
return GetOrCreateValue(); }
1774 const T* pointer()
const {
return GetOrCreateValue(); }
1775 const T& get()
const {
return *pointer(); }
1780 class ValueHolder :
public ThreadLocalValueHolderBase {
1782 ValueHolder() : value_() {}
1783 explicit ValueHolder(
const T&
value) : value_(
value) {}
1785 T* pointer() {
return &value_; }
1789 ValueHolder(
const ValueHolder&) =
delete;
1790 ValueHolder& operator=(
const ValueHolder&) =
delete;
1793 static pthread_key_t CreateKey() {
1798 pthread_key_create(&key, &DeleteThreadLocalValue));
1802 T* GetOrCreateValue()
const {
1803 ThreadLocalValueHolderBase*
const holder =
1804 static_cast<ThreadLocalValueHolderBase*
>(pthread_getspecific(key_));
1805 if (holder !=
nullptr) {
1806 return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
1809 ValueHolder*
const new_holder = default_factory_->MakeNewHolder();
1810 ThreadLocalValueHolderBase*
const holder_base = new_holder;
1812 return new_holder->pointer();
1815 class ValueHolderFactory {
1817 ValueHolderFactory() =
default;
1818 virtual ~ValueHolderFactory() =
default;
1819 virtual ValueHolder* MakeNewHolder()
const = 0;
1822 ValueHolderFactory(
const ValueHolderFactory&) =
delete;
1823 ValueHolderFactory& operator=(
const ValueHolderFactory&) =
delete;
1826 class DefaultValueHolderFactory :
public ValueHolderFactory {
1828 DefaultValueHolderFactory() =
default;
1829 ValueHolder* MakeNewHolder()
const override {
return new ValueHolder(); }
1832 DefaultValueHolderFactory(
const DefaultValueHolderFactory&) =
delete;
1833 DefaultValueHolderFactory& operator=(
const DefaultValueHolderFactory&) =
1837 class InstanceValueHolderFactory :
public ValueHolderFactory {
1839 explicit InstanceValueHolderFactory(
const T&
value) : value_(
value) {}
1840 ValueHolder* MakeNewHolder()
const override {
1841 return new ValueHolder(value_);
1847 InstanceValueHolderFactory(
const InstanceValueHolderFactory&) =
delete;
1848 InstanceValueHolderFactory& operator=(
const InstanceValueHolderFactory&) =
1853 const pthread_key_t key_;
1854 std::unique_ptr<ValueHolderFactory> default_factory_;
1856 ThreadLocal(
const ThreadLocal&) =
delete;
1857 ThreadLocal& operator=(
const ThreadLocal&) =
delete;
1877#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1878 extern ::testing::internal::Mutex mutex
1880#define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
1894template <
typename T>
1901 const T&
get()
const {
return value_; }
1914#ifdef GTEST_OS_WINDOWS
1915#define GTEST_PATH_SEP_ "\\"
1916#define GTEST_HAS_ALT_PATH_SEP_ 1
1918#define GTEST_PATH_SEP_ "/"
1919#define GTEST_HAS_ALT_PATH_SEP_ 0
1930 return isalpha(
static_cast<unsigned char>(
ch)) != 0;
1933 return isalnum(
static_cast<unsigned char>(
ch)) != 0;
1936 return isdigit(
static_cast<unsigned char>(
ch)) != 0;
1939 return islower(
static_cast<unsigned char>(
ch)) != 0;
1942 return isspace(
static_cast<unsigned char>(
ch)) != 0;
1945 return isupper(
static_cast<unsigned char>(
ch)) != 0;
1948 return isxdigit(
static_cast<unsigned char>(
ch)) != 0;
1950#ifdef __cpp_lib_char8_t
1952 return isxdigit(
static_cast<unsigned char>(
ch)) != 0;
1956 const unsigned char low_byte =
static_cast<unsigned char>(
ch);
1957 return ch == low_byte && isxdigit(low_byte) != 0;
1960 const unsigned char low_byte =
static_cast<unsigned char>(
ch);
1961 return ch == low_byte && isxdigit(low_byte) != 0;
1964 const unsigned char low_byte =
static_cast<unsigned char>(
ch);
1965 return ch == low_byte && isxdigit(low_byte) != 0;
1969 return static_cast<char>(tolower(
static_cast<unsigned char>(
ch)));
1972 return static_cast<char>(toupper(
static_cast<unsigned char>(
ch)));
1976 std::string::iterator it = str.end();
1977 while (it != str.begin() &&
IsSpace(*--it)) it = str.erase(it);
1990#if GTEST_HAS_FILE_SYSTEM
1991#ifdef GTEST_OS_WINDOWS
1995#ifdef GTEST_OS_WINDOWS_MOBILE
1996inline int FileNo(FILE* file) {
return reinterpret_cast<int>(_fileno(file)); }
2000inline int FileNo(FILE* file) {
return _fileno(file); }
2001inline int Stat(
const char* path,
StatStruct* buf) {
return _stat(path, buf); }
2002inline int RmDir(
const char* dir) {
return _rmdir(dir); }
2003inline bool IsDir(
const StatStruct& st) {
return (_S_IFDIR & st.st_mode) != 0; }
2006#elif defined(GTEST_OS_ESP8266)
2009inline int FileNo(FILE* file) {
return fileno(file); }
2014inline int RmDir(
const char* dir) {
return rmdir(dir); }
2015inline bool IsDir(
const StatStruct& st) {
return S_ISDIR(st.st_mode); }
2021inline int FileNo(FILE* file) {
return fileno(file); }
2025inline int RmDir(
const char*) {
return 0; }
2027inline int RmDir(
const char* dir) {
return rmdir(dir); }
2036#ifdef GTEST_OS_WINDOWS
2039inline int DoIsATTY(
int fd) {
return isatty(fd); }
2040inline int StrCaseCmp(
const char* s1,
const char* s2) {
2041 return stricmp(s1, s2);
2044#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_ZOS) || \
2045 defined(GTEST_OS_IOS) || defined(GTEST_OS_WINDOWS_PHONE) || \
2046 defined(GTEST_OS_WINDOWS_RT) || defined(ESP_PLATFORM)
2047inline int DoIsATTY(
int ) {
return 0; }
2049inline int DoIsATTY(
int fd) {
return _isatty(fd); }
2051inline int StrCaseCmp(
const char* s1,
const char* s2) {
2052 return _stricmp(s1, s2);
2060 return strcasecmp(s1, s2);
2069 int savedErrno = errno;
2083#if GTEST_HAS_FILE_SYSTEM
2084#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
2085 !defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_ESP8266) && \
2086 !defined(GTEST_OS_XTENSA) && !defined(GTEST_OS_QURT)
2087inline int ChDir(
const char* dir) {
return chdir(dir); }
2089inline FILE*
FOpen(
const char* path,
const char* mode) {
2090#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MINGW)
2091 struct wchar_codecvt :
public std::codecvt<wchar_t, char, std::mbstate_t> {};
2092 std::wstring_convert<wchar_codecvt> converter;
2093 std::wstring wide_path = converter.from_bytes(path);
2094 std::wstring wide_mode = converter.from_bytes(mode);
2095 return _wfopen(wide_path.c_str(), wide_mode.c_str());
2097 return fopen(path, mode);
2100#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_QURT)
2101inline FILE*
FReopen(
const char* path,
const char* mode, FILE* stream) {
2102 return freopen(path, mode, stream);
2104inline FILE*
FDOpen(
int fd,
const char* mode) {
return fdopen(fd, mode); }
2106inline int FClose(FILE* fp) {
return fclose(fp); }
2107#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_QURT)
2109 return static_cast<int>(read(fd, buf,
count));
2112 return static_cast<int>(write(fd, buf,
count));
2114inline int Close(
int fd) {
return close(fd); }
2118#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_QURT)
2119inline const char*
StrError(
int errnum) {
return strerror(errnum); }
2123#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
2124 defined(GTEST_OS_ESP8266) || defined(GTEST_OS_XTENSA) || \
2125 defined(GTEST_OS_QURT)
2127 static_cast<void>(name);
2129#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
2132 const char*
const env = getenv(name);
2133 return (env !=
nullptr && env[0] !=
'\0') ? env :
nullptr;
2135 return getenv(name);
2141#ifdef GTEST_OS_WINDOWS_MOBILE
2145[[noreturn]]
void Abort();
2147[[noreturn]]
inline void Abort() { abort(); }
2157#if defined(_MSC_VER) && !defined(GTEST_OS_WINDOWS_MOBILE)
2159#define GTEST_SNPRINTF_(buffer, size, format, ...) \
2160 _snprintf_s(buffer, size, size, format, __VA_ARGS__)
2161#elif defined(_MSC_VER)
2163#define GTEST_SNPRINTF_ _snprintf
2165#define GTEST_SNPRINTF_ snprintf
2194template <
size_t size>
2224#if !defined(GTEST_FLAG)
2225#define GTEST_FLAG_NAME_(name) gtest_##name
2226#define GTEST_FLAG(name) FLAGS_gtest_##name
2230#ifdef GTEST_HAS_ABSL
2233#define GTEST_DEFINE_bool_(name, default_val, doc) \
2234 ABSL_FLAG(bool, GTEST_FLAG_NAME_(name), default_val, doc)
2235#define GTEST_DEFINE_int32_(name, default_val, doc) \
2236 ABSL_FLAG(int32_t, GTEST_FLAG_NAME_(name), default_val, doc)
2237#define GTEST_DEFINE_string_(name, default_val, doc) \
2238 ABSL_FLAG(std::string, GTEST_FLAG_NAME_(name), default_val, doc)
2241#define GTEST_DECLARE_bool_(name) \
2242 ABSL_DECLARE_FLAG(bool, GTEST_FLAG_NAME_(name))
2243#define GTEST_DECLARE_int32_(name) \
2244 ABSL_DECLARE_FLAG(int32_t, GTEST_FLAG_NAME_(name))
2245#define GTEST_DECLARE_string_(name) \
2246 ABSL_DECLARE_FLAG(std::string, GTEST_FLAG_NAME_(name))
2248#define GTEST_FLAG_SAVER_ ::absl::FlagSaver
2250#define GTEST_FLAG_GET(name) ::absl::GetFlag(GTEST_FLAG(name))
2251#define GTEST_FLAG_SET(name, value) \
2252 (void)(::absl::SetFlag(>EST_FLAG(name), value))
2253#define GTEST_USE_OWN_FLAGFILE_FLAG_ 0
2258#define GTEST_DEFINE_bool_(name, default_val, doc) \
2259 namespace testing { \
2260 GTEST_API_ bool GTEST_FLAG(name) = (default_val); \
2262 static_assert(true, "no-op to require trailing semicolon")
2263#define GTEST_DEFINE_int32_(name, default_val, doc) \
2264 namespace testing { \
2265 GTEST_API_ std::int32_t GTEST_FLAG(name) = (default_val); \
2267 static_assert(true, "no-op to require trailing semicolon")
2268#define GTEST_DEFINE_string_(name, default_val, doc) \
2269 namespace testing { \
2270 GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val); \
2272 static_assert(true, "no-op to require trailing semicolon")
2275#define GTEST_DECLARE_bool_(name) \
2276 namespace testing { \
2277 GTEST_API_ extern bool GTEST_FLAG(name); \
2279 static_assert(true, "no-op to require trailing semicolon")
2280#define GTEST_DECLARE_int32_(name) \
2281 namespace testing { \
2282 GTEST_API_ extern std::int32_t GTEST_FLAG(name); \
2284 static_assert(true, "no-op to require trailing semicolon")
2285#define GTEST_DECLARE_string_(name) \
2286 namespace testing { \
2287 GTEST_API_ extern ::std::string GTEST_FLAG(name); \
2289 static_assert(true, "no-op to require trailing semicolon")
2291#define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
2293#define GTEST_FLAG_GET(name) ::testing::GTEST_FLAG(name)
2294#define GTEST_FLAG_SET(name, value) (void)(::testing::GTEST_FLAG(name) = value)
2295#define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
2300#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2301#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
2302#define GTEST_LOCK_EXCLUDED_(locks)
2321#if !defined(GTEST_INTERNAL_DEPRECATED)
2331#if defined(_MSC_VER)
2332#define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message))
2333#elif defined(__GNUC__)
2334#define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message)))
2336#define GTEST_INTERNAL_DEPRECATED(message)
2341#ifdef GTEST_HAS_ABSL
2344#define GTEST_INTERNAL_HAS_ANY 1
2345#include "absl/types/any.h"
2348using Any = ::absl::any;
2353#if __has_include(<any>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
2354 (!defined(_MSC_VER) || GTEST_HAS_RTTI)
2357#define GTEST_INTERNAL_HAS_ANY 1
2361using Any = ::std::any;
2370#ifndef GTEST_INTERNAL_HAS_ANY
2371#define GTEST_INTERNAL_HAS_ANY 0
2374#ifdef GTEST_HAS_ABSL
2377#define GTEST_INTERNAL_HAS_OPTIONAL 1
2378#include "absl/types/optional.h"
2381template <
typename T>
2382using Optional = ::absl::optional<T>;
2383inline ::absl::nullopt_t Nullopt() { return ::absl::nullopt; }
2388#if __has_include(<optional>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L
2391#define GTEST_INTERNAL_HAS_OPTIONAL 1
2395template <
typename T>
2396using Optional = ::std::optional<T>;
2397inline ::std::nullopt_t Nullopt() { return ::std::nullopt; }
2406#ifndef GTEST_INTERNAL_HAS_OPTIONAL
2407#define GTEST_INTERNAL_HAS_OPTIONAL 0
2410#ifdef GTEST_HAS_ABSL
2413#define GTEST_INTERNAL_HAS_STRING_VIEW 1
2414#include "absl/strings/string_view.h"
2417using StringView = ::absl::string_view;
2422#if __has_include(<string_view>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L
2425#define GTEST_INTERNAL_HAS_STRING_VIEW 1
2426#include <string_view>
2429using StringView = ::std::string_view;
2439#ifndef GTEST_INTERNAL_HAS_STRING_VIEW
2440#define GTEST_INTERNAL_HAS_STRING_VIEW 0
2443#ifdef GTEST_HAS_ABSL
2446#define GTEST_INTERNAL_HAS_VARIANT 1
2447#include "absl/types/variant.h"
2450template <
typename...
T>
2451using Variant = ::absl::variant<
T...>;
2456#if __has_include(<variant>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L
2459#define GTEST_INTERNAL_HAS_VARIANT 1
2463template <
typename...
T>
2464using Variant = ::std::variant<
T...>;
2472#ifndef GTEST_INTERNAL_HAS_VARIANT
2473#define GTEST_INTERNAL_HAS_VARIANT 0
2476#if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \
2477 GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L
2478#define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1
Definition gtest-port.h:1035
::std::ostream & GetStream()
Definition gtest-port.h:1042
Definition gtest-port.h:1887
GTestMutexLock(Mutex *)
Definition gtest-port.h:1889
Definition gtest-port.h:1869
void Unlock()
Definition gtest-port.h:1873
Mutex()
Definition gtest-port.h:1871
void Lock()
Definition gtest-port.h:1872
void AssertHeld() const
Definition gtest-port.h:1874
Definition gtest-port.h:925
Definition gtest-port.h:1895
ThreadLocal()
Definition gtest-port.h:1897
T * pointer()
Definition gtest-port.h:1899
ThreadLocal(const T &value)
Definition gtest-port.h:1898
void set(const T &value)
Definition gtest-port.h:1902
const T * pointer() const
Definition gtest-port.h:1900
const T & get() const
Definition gtest-port.h:1901
Definition googletest-port-test.cc:195
std::uint32_t UInt
Definition gtest-port.h:2207
std::int32_t Int
Definition gtest-port.h:2206
std::int64_t Int
Definition gtest-port.h:2214
std::uint64_t UInt
Definition gtest-port.h:2215
Definition gtest-port.h:2195
void UInt
Definition gtest-port.h:2199
int value
Definition gmock-actions_test.cc:1714
int x
Definition gmock-matchers-containers_test.cc:376
char ch
Definition gmock-matchers-containers_test.cc:384
int * count
Definition gmock_stress_test.cc:90
#define GTEST_CHECK_POSIX_SUCCESS_(posix_call)
Definition gtest-port.h:1091
#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
Definition gtest-port.h:373
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
Definition gtest-port.h:360
#define GTEST_DISABLE_MSC_DEPRECATED_POP_()
Definition gtest-port.h:375
#define GTEST_API_
Definition gtest-port.h:842
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
Definition gtest-port.h:361
#define GTEST_CHECK_(condition)
Definition gtest-port.h:1078
Run(command)
Definition googletest-break-on-failure-unittest.py:77
std::mutex Mutex
Definition lock.hpp:10
Definition gtest-port.h:1987
int DoIsATTY(int fd)
Definition gtest-port.h:2058
int Close(int fd)
Definition gtest-port.h:2114
int IsATTY(int fd)
Definition gtest-port.h:2065
int ChDir(const char *dir)
Definition gtest-port.h:2087
int StrCaseCmp(const char *s1, const char *s2)
Definition gtest-port.h:2059
int Stat(const char *path, StatStruct *buf)
Definition gtest-port.h:2022
int FileNo(FILE *file)
Definition gtest-port.h:2021
int Read(int fd, void *buf, unsigned int count)
Definition gtest-port.h:2108
void Abort()
Definition gtest-port.h:2147
const char * StrError(int errnum)
Definition gtest-port.h:2119
FILE * FReopen(const char *path, const char *mode, FILE *stream)
Definition gtest-port.h:2101
FILE * FDOpen(int fd, const char *mode)
Definition gtest-port.h:2104
struct stat StatStruct
Definition gtest-port.h:2019
const char * GetEnv(const char *name)
Definition gtest-port.h:2122
int RmDir(const char *dir)
Definition gtest-port.h:2027
bool IsDir(const StatStruct &st)
Definition gtest-port.h:2029
int Write(int fd, const void *buf, unsigned int count)
Definition gtest-port.h:2111
int FClose(FILE *fp)
Definition gtest-port.h:2106
FILE * FOpen(const char *path, const char *mode)
Definition gtest-port.h:2089
void LogToStderr()
Definition gtest-port.h:1058
GTEST_API_ size_t GetFileSize(FILE *file)
Definition gtest-port.cc:1200
GTestMutexLock MutexLock
Definition gtest-port.h:1892
std::string OutputFlagAlsoCheckEnvVar()
Definition gtest-port.cc:1370
long long BiggestInt
Definition gtest-port.h:2171
GTEST_API_::std::string FormatCompilerIndependentFileLocation(const char *file, int line)
Definition gtest-port.cc:995
void FlushInfoLog()
Definition gtest-port.h:1059
GTEST_API_ std::string ReadEntireFile(FILE *file)
Definition gtest-port.cc:1205
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
Definition gtest-port.cc:977
GTEST_API_ std::string GetCapturedStderr()
GTEST_API_ size_t GetThreadCount()
Definition gtest-port.cc:265
bool IsDigit(char ch)
Definition gtest-port.h:1935
GTEST_API_ bool ParseInt32(const Message &src_text, const char *str, int32_t *value)
Definition gtest-port.cc:1282
GTEST_API_ bool IsTrue(bool condition)
Definition gtest.cc:6310
bool BoolFromGTestEnv(const char *flag, bool default_val)
Definition gtest-port.cc:1324
constexpr BiggestInt kMaxBiggestInt
Definition gtest-port.h:2174
int64_t TimeInMillis
Definition gtest-port.h:2219
const char * StringFromGTestEnv(const char *flag, const char *default_val)
Definition gtest-port.cc:1381
bool IsAlNum(char ch)
Definition gtest-port.h:1932
bool IsUpper(char ch)
Definition gtest-port.h:1944
GTEST_API_ void CaptureStderr()
GTEST_API_ std::vector< std::string > GetArgvs()
Definition gtest.cc:624
To ImplicitCast_(To x)
Definition gtest-port.h:1140
bool IsXDigit(char ch)
Definition gtest-port.h:1947
GTestLogSeverity
Definition gtest-port.h:1030
@ GTEST_ERROR
Definition gtest-port.h:1030
@ GTEST_FATAL
Definition gtest-port.h:1030
@ GTEST_WARNING
Definition gtest-port.h:1030
@ GTEST_INFO
Definition gtest-port.h:1030
std::string StripTrailingSpaces(std::string str)
Definition gtest-port.h:1975
GTEST_API_ int32_t Int32FromGTestEnv(const char *flag, int32_t default_val)
Definition gtest-port.cc:1338
char ToUpper(char ch)
Definition gtest-port.h:1971
bool IsLower(char ch)
Definition gtest-port.h:1938
GTEST_API_ void CaptureStdout()
char ToLower(char ch)
Definition gtest-port.h:1968
bool IsAlpha(char ch)
Definition gtest-port.h:1929
GTEST_API_ std::string GetCapturedStdout()
bool IsSpace(char ch)
Definition gtest-port.h:1941
Derived * CheckedDowncastToActualType(Base *base)
Definition gtest-port.h:1150
Definition gmock-actions.h:151
T & type
Definition gtest-port.h:1112
Definition gtest-port.h:1107
const T & type
Definition gtest-port.h:1108