Use "#ifdef GTEST_OS_..." instead of "#if GTEST_OS_..."
This is compatible with compiling with "-Wundef" (#3267). PiperOrigin-RevId: 513943378 Change-Id: I47cf5fabbb77be061c4483a0adc54511af6b191c
This commit is contained in:
committed by
Copybara-Service
parent
cead3d57c9
commit
23142843f7
@@ -1592,7 +1592,7 @@ TEST(WithArgsTest, RefQualifiedInnerAction) {
|
||||
EXPECT_EQ(19, mock.AsStdFunction()(0, 17));
|
||||
}
|
||||
|
||||
#if !GTEST_OS_WINDOWS_MOBILE
|
||||
#ifndef GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
class SetErrnoAndReturnTest : public testing::Test {
|
||||
protected:
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
// Silence C4503 (decorated name length exceeded) for MSVC.
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4503)
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
// MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
|
||||
// we are getting compiler errors if we use basetyps.h, hence including
|
||||
// objbase.h for definition of STDMETHOD.
|
||||
@@ -120,7 +120,7 @@ class FooInterface {
|
||||
virtual int RefQualifiedOverloaded() & = 0;
|
||||
virtual int RefQualifiedOverloaded() && = 0;
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
STDMETHOD_(int, CTNullary)() = 0;
|
||||
STDMETHOD_(bool, CTUnary)(int x) = 0;
|
||||
STDMETHOD_(int, CTDecimal)
|
||||
@@ -178,7 +178,7 @@ class MockFoo : public FooInterface {
|
||||
MOCK_METHOD(int (*)(bool), ReturnsFunctionPointer1, (int), ());
|
||||
MOCK_METHOD(fn_ptr, ReturnsFunctionPointer2, (int), ());
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
|
||||
MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE)));
|
||||
MOCK_METHOD(int, CTDecimal,
|
||||
@@ -248,7 +248,7 @@ class LegacyMockFoo : public FooInterface {
|
||||
MOCK_METHOD1(ReturnsFunctionPointer1, int (*(int))(bool));
|
||||
MOCK_METHOD1(ReturnsFunctionPointer2, fn_ptr(int));
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
|
||||
MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int)); // NOLINT
|
||||
MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal,
|
||||
@@ -404,7 +404,7 @@ TYPED_TEST(FunctionMockerTest, MocksTypeWithTemplatedCopyCtor) {
|
||||
EXPECT_TRUE(this->foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>()));
|
||||
}
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
// Tests mocking a nullary function with calltype.
|
||||
TYPED_TEST(FunctionMockerTest, MocksNullaryFunctionWithCallType) {
|
||||
EXPECT_CALL(this->mock_foo_, CTNullary())
|
||||
@@ -620,7 +620,7 @@ TYPED_TEST(TemplateMockTest, MethodWithCommaInReturnTypeWorks) {
|
||||
EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1));
|
||||
}
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
// Tests mocking template interfaces with calltype.
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
#if GTEST_OS_CYGWIN
|
||||
#ifdef GTEST_OS_CYGWIN
|
||||
#include <sys/types.h> // For ssize_t. NOLINT
|
||||
#endif
|
||||
|
||||
@@ -167,7 +167,7 @@ TEST(KindOfTest, Integer) {
|
||||
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long long)); // NOLINT
|
||||
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(wchar_t)); // NOLINT
|
||||
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(size_t)); // NOLINT
|
||||
#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN
|
||||
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC) || defined(GTEST_OS_CYGWIN)
|
||||
// ssize_t is not defined on Windows and possibly some other OSes.
|
||||
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(ssize_t)); // NOLINT
|
||||
#endif
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
#if !GTEST_OS_WINDOWS_MOBILE
|
||||
#ifndef GTEST_OS_WINDOWS_MOBILE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
@@ -181,7 +181,7 @@ using testing::WithArg;
|
||||
using testing::WithArgs;
|
||||
using testing::WithoutArgs;
|
||||
|
||||
#if !GTEST_OS_WINDOWS_MOBILE
|
||||
#ifndef GTEST_OS_WINDOWS_MOBILE
|
||||
using testing::SetErrnoAndReturn;
|
||||
#endif
|
||||
|
||||
@@ -306,7 +306,7 @@ TEST(LinkTest, TestSetArrayArgument) {
|
||||
mock.VoidFromString(&ch);
|
||||
}
|
||||
|
||||
#if !GTEST_OS_WINDOWS_MOBILE
|
||||
#ifndef GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
// Tests the linkage of the SetErrnoAndReturn action.
|
||||
TEST(LinkTest, TestSetErrnoAndReturn) {
|
||||
|
||||
Reference in New Issue
Block a user