aboutsummaryrefslogtreecommitdiff
path: root/googletest
diff options
context:
space:
mode:
authorCopybara-Service <copybara-worker@google.com>2024-04-03 13:59:49 -0700
committerCopybara-Service <copybara-worker@google.com>2024-04-03 13:59:49 -0700
commit61db1e1740a828d9df94fd167a9eb4137cd6def2 (patch)
treeab6a3fbacac9a2f0d06835544dc9c55179661698 /googletest
parentd3a29ff624e0984a40a60dbc1f03ac74b8d03658 (diff)
parenta7678dd0db369dcb0110d83cfa5c9f9ba02f2423 (diff)
downloadgoogletest-61db1e1740a828d9df94fd167a9eb4137cd6def2.zip
googletest-61db1e1740a828d9df94fd167a9eb4137cd6def2.tar.gz
googletest-61db1e1740a828d9df94fd167a9eb4137cd6def2.tar.bz2
Merge pull request #4505 from to01z:add-winapi-partition-games-support
PiperOrigin-RevId: 621631167 Change-Id: I0790f7082ce3c20fef92958c820d40ec854fe91d
Diffstat (limited to 'googletest')
-rw-r--r--googletest/include/gtest/internal/gtest-port-arch.h2
-rw-r--r--googletest/include/gtest/internal/gtest-port.h13
-rw-r--r--googletest/src/gtest-port.cc20
-rw-r--r--googletest/src/gtest.cc14
4 files changed, 26 insertions, 23 deletions
diff --git a/googletest/include/gtest/internal/gtest-port-arch.h b/googletest/include/gtest/internal/gtest-port-arch.h
index 3162f2b..7ec968f 100644
--- a/googletest/include/gtest/internal/gtest-port-arch.h
+++ b/googletest/include/gtest/internal/gtest-port-arch.h
@@ -56,6 +56,8 @@
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
#define GTEST_OS_WINDOWS_PHONE 1
#define GTEST_OS_WINDOWS_TV_TITLE 1
+#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES)
+#define GTEST_OS_WINDOWS_GAMES 1
#else
// WINAPI_FAMILY defined but no known partition matched.
// Default to desktop.
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index fa457b7..6c469e9 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -340,8 +340,8 @@
#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS)
#define GTEST_INTERNAL_HAS_ABSL_FLAGS // Used only in this file.
-#include "absl/flags/flag.h"
#include "absl/flags/declare.h"
+#include "absl/flags/flag.h"
#include "absl/flags/reflection.h"
#endif
@@ -659,9 +659,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// platforms except known mobile / embedded ones. Also, if the port doesn't have
// a file system, stream redirection is not supported.
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
- defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
- defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
- !GTEST_HAS_FILE_SYSTEM
+ defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_WINDOWS_GAMES) || \
+ defined(GTEST_OS_ESP8266) || defined(GTEST_OS_XTENSA) || \
+ defined(GTEST_OS_QURT) || !GTEST_HAS_FILE_SYSTEM
#define GTEST_HAS_STREAM_REDIRECTION 0
#else
#define GTEST_HAS_STREAM_REDIRECTION 1
@@ -2108,8 +2108,9 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
// defined there.
#if GTEST_HAS_FILE_SYSTEM
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
- !defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_ESP8266) && \
- !defined(GTEST_OS_XTENSA) && !defined(GTEST_OS_QURT)
+ !defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_GAMES) && \
+ !defined(GTEST_OS_ESP8266) && !defined(GTEST_OS_XTENSA) && \
+ !defined(GTEST_OS_QURT)
inline int ChDir(const char* dir) { return chdir(dir); }
#endif
inline FILE* FOpen(const char* path, const char* mode) {
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc
index aa33725..1038ad7 100644
--- a/googletest/src/gtest-port.cc
+++ b/googletest/src/gtest-port.cc
@@ -607,12 +607,12 @@ class ThreadLocalRegistryImpl {
// We need to pass a valid thread ID pointer into CreateThread for it
// to work correctly under Win98.
DWORD watcher_thread_id;
- HANDLE watcher_thread = ::CreateThread(
- nullptr, // Default security.
- 0, // Default stack size
- &ThreadLocalRegistryImpl::WatcherThreadFunc,
- reinterpret_cast<LPVOID>(watcher_thread_params),
- CREATE_SUSPENDED, &watcher_thread_id);
+ HANDLE watcher_thread =
+ ::CreateThread(nullptr, // Default security.
+ 0, // Default stack size
+ &ThreadLocalRegistryImpl::WatcherThreadFunc,
+ reinterpret_cast<LPVOID>(watcher_thread_params),
+ CREATE_SUSPENDED, &watcher_thread_id);
GTEST_CHECK_(watcher_thread != nullptr)
<< "CreateThread failed with error " << ::GetLastError() << ".";
// Give the watcher thread the same priority as ours to avoid being
@@ -1048,12 +1048,12 @@ GTestLog::~GTestLog() {
}
}
+#if GTEST_HAS_STREAM_REDIRECTION
+
// Disable Microsoft deprecation warnings for POSIX functions called from
// this class (creat, dup, dup2, and close)
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
-#if GTEST_HAS_STREAM_REDIRECTION
-
namespace {
#if defined(GTEST_OS_LINUX_ANDROID) || defined(GTEST_OS_IOS)
@@ -1348,8 +1348,8 @@ bool ParseInt32(const Message& src_text, const char* str, int32_t* value) {
) {
Message msg;
msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value " << str << ", which overflows.\n";
+ << " is expected to be a 32-bit integer, but actually" << " has value "
+ << str << ", which overflows.\n";
printf("%s", msg.GetString().c_str());
fflush(stdout);
return false;
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 2653dbb..a997707 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -3184,9 +3184,9 @@ static void PrintTestPartResult(const TestPartResult& test_part_result) {
}
// class PrettyUnitTestResultPrinter
-#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
- !defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
- !defined(GTEST_OS_WINDOWS_MINGW)
+#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
+ !defined(GTEST_OS_WINDOWS_GAMES) && !defined(GTEST_OS_WINDOWS_PHONE) && \
+ !defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_MINGW)
// Returns the character attribute for the given color.
static WORD GetColorAttribute(GTestColor color) {
@@ -3313,9 +3313,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
return;
}
-#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
- !defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
- !defined(GTEST_OS_WINDOWS_MINGW)
+#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
+ !defined(GTEST_OS_WINDOWS_GAMES) && !defined(GTEST_OS_WINDOWS_PHONE) && \
+ !defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_MINGW)
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
// Gets the current text color.
@@ -5473,7 +5473,7 @@ int UnitTest::Run() {
// about crashes - they are expected.
if (impl()->catch_exceptions() || in_death_test_child_process) {
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
- !defined(GTEST_OS_WINDOWS_RT)
+ !defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_GAMES)
// SetErrorMode doesn't exist on CE.
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);