Skip to content

Commit 61db1e1

Browse files
Merge pull request #4505 from to01z:add-winapi-partition-games-support
PiperOrigin-RevId: 621631167 Change-Id: I0790f7082ce3c20fef92958c820d40ec854fe91d
2 parents d3a29ff + a7678dd commit 61db1e1

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

googletest/include/gtest/internal/gtest-port-arch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
5757
#define GTEST_OS_WINDOWS_PHONE 1
5858
#define GTEST_OS_WINDOWS_TV_TITLE 1
59+
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES)
60+
#define GTEST_OS_WINDOWS_GAMES 1
5961
#else
6062
// WINAPI_FAMILY defined but no known partition matched.
6163
// Default to desktop.

googletest/include/gtest/internal/gtest-port.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@
340340

341341
#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS)
342342
#define GTEST_INTERNAL_HAS_ABSL_FLAGS // Used only in this file.
343-
#include "absl/flags/flag.h"
344343
#include "absl/flags/declare.h"
344+
#include "absl/flags/flag.h"
345345
#include "absl/flags/reflection.h"
346346
#endif
347347

@@ -659,9 +659,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
659659
// platforms except known mobile / embedded ones. Also, if the port doesn't have
660660
// a file system, stream redirection is not supported.
661661
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
662-
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
663-
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
664-
!GTEST_HAS_FILE_SYSTEM
662+
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_WINDOWS_GAMES) || \
663+
defined(GTEST_OS_ESP8266) || defined(GTEST_OS_XTENSA) || \
664+
defined(GTEST_OS_QURT) || !GTEST_HAS_FILE_SYSTEM
665665
#define GTEST_HAS_STREAM_REDIRECTION 0
666666
#else
667667
#define GTEST_HAS_STREAM_REDIRECTION 1
@@ -2108,8 +2108,9 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
21082108
// defined there.
21092109
#if GTEST_HAS_FILE_SYSTEM
21102110
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
2111-
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_ESP8266) && \
2112-
!defined(GTEST_OS_XTENSA) && !defined(GTEST_OS_QURT)
2111+
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_GAMES) && \
2112+
!defined(GTEST_OS_ESP8266) && !defined(GTEST_OS_XTENSA) && \
2113+
!defined(GTEST_OS_QURT)
21132114
inline int ChDir(const char* dir) { return chdir(dir); }
21142115
#endif
21152116
inline FILE* FOpen(const char* path, const char* mode) {

googletest/src/gtest-port.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,12 @@ class ThreadLocalRegistryImpl {
607607
// We need to pass a valid thread ID pointer into CreateThread for it
608608
// to work correctly under Win98.
609609
DWORD watcher_thread_id;
610-
HANDLE watcher_thread = ::CreateThread(
611-
nullptr, // Default security.
612-
0, // Default stack size
613-
&ThreadLocalRegistryImpl::WatcherThreadFunc,
614-
reinterpret_cast<LPVOID>(watcher_thread_params),
615-
CREATE_SUSPENDED, &watcher_thread_id);
610+
HANDLE watcher_thread =
611+
::CreateThread(nullptr, // Default security.
612+
0, // Default stack size
613+
&ThreadLocalRegistryImpl::WatcherThreadFunc,
614+
reinterpret_cast<LPVOID>(watcher_thread_params),
615+
CREATE_SUSPENDED, &watcher_thread_id);
616616
GTEST_CHECK_(watcher_thread != nullptr)
617617
<< "CreateThread failed with error " << ::GetLastError() << ".";
618618
// Give the watcher thread the same priority as ours to avoid being
@@ -1048,12 +1048,12 @@ GTestLog::~GTestLog() {
10481048
}
10491049
}
10501050

1051+
#if GTEST_HAS_STREAM_REDIRECTION
1052+
10511053
// Disable Microsoft deprecation warnings for POSIX functions called from
10521054
// this class (creat, dup, dup2, and close)
10531055
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
10541056

1055-
#if GTEST_HAS_STREAM_REDIRECTION
1056-
10571057
namespace {
10581058

10591059
#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) {
13481348
) {
13491349
Message msg;
13501350
msg << "WARNING: " << src_text
1351-
<< " is expected to be a 32-bit integer, but actually"
1352-
<< " has value " << str << ", which overflows.\n";
1351+
<< " is expected to be a 32-bit integer, but actually" << " has value "
1352+
<< str << ", which overflows.\n";
13531353
printf("%s", msg.GetString().c_str());
13541354
fflush(stdout);
13551355
return false;

googletest/src/gtest.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3184,9 +3184,9 @@ static void PrintTestPartResult(const TestPartResult& test_part_result) {
31843184
}
31853185

31863186
// class PrettyUnitTestResultPrinter
3187-
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
3188-
!defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
3189-
!defined(GTEST_OS_WINDOWS_MINGW)
3187+
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
3188+
!defined(GTEST_OS_WINDOWS_GAMES) && !defined(GTEST_OS_WINDOWS_PHONE) && \
3189+
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_MINGW)
31903190

31913191
// Returns the character attribute for the given color.
31923192
static WORD GetColorAttribute(GTestColor color) {
@@ -3313,9 +3313,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
33133313
return;
33143314
}
33153315

3316-
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
3317-
!defined(GTEST_OS_WINDOWS_PHONE) && !defined(GTEST_OS_WINDOWS_RT) && \
3318-
!defined(GTEST_OS_WINDOWS_MINGW)
3316+
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MOBILE) && \
3317+
!defined(GTEST_OS_WINDOWS_GAMES) && !defined(GTEST_OS_WINDOWS_PHONE) && \
3318+
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_MINGW)
33193319
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
33203320

33213321
// Gets the current text color.
@@ -5473,7 +5473,7 @@ int UnitTest::Run() {
54735473
// about crashes - they are expected.
54745474
if (impl()->catch_exceptions() || in_death_test_child_process) {
54755475
#if !defined(GTEST_OS_WINDOWS_MOBILE) && !defined(GTEST_OS_WINDOWS_PHONE) && \
5476-
!defined(GTEST_OS_WINDOWS_RT)
5476+
!defined(GTEST_OS_WINDOWS_RT) && !defined(GTEST_OS_WINDOWS_GAMES)
54775477
// SetErrorMode doesn't exist on CE.
54785478
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
54795479
SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);

0 commit comments

Comments
 (0)