Skip to content

Commit

Permalink
Remove windows includes in gtest and gmock
Browse files Browse the repository at this point in the history
Summary: Remove windows includes in folly/portability/gtest.h and folly/portability/gmock.h because they are no longer needed now that windows UCRT declares its own posix functions.

Reviewed By: ilvokhin

Differential Revision: D66841402

fbshipit-source-id: cff160cbac70865d6cb5adeeb253a1afa5fa08cb
  • Loading branch information
skrueger authored and facebook-github-bot committed Dec 13, 2024
1 parent 0b61d58 commit 7329765
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 32 deletions.
1 change: 1 addition & 0 deletions folly/io/async/test/AsyncBaseTestLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <folly/experimental/io/FsUtil.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <folly/test/TestUtils.h>

#include <folly/experimental/io/AsyncBase.h>
Expand Down
1 change: 1 addition & 0 deletions folly/io/async/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ cpp_library(
"//folly/experimental/io/test:io_test_temp_file_util_lib",
"//folly/portability:gtest",
"//folly/portability:sockets",
"//folly/portability:unistd",
"//folly/test:test_utils",
],
exported_external_deps = [
Expand Down
1 change: 1 addition & 0 deletions folly/memory/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cpp_unittest(
"//folly/memory:mallctl_helper",
"//folly/memory:malloc",
"//folly/portability:gtest",
"//folly/portability:sys_types",
],
)

Expand Down
1 change: 1 addition & 0 deletions folly/memory/test/MallctlHelperTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <folly/init/Init.h>
#include <folly/memory/Malloc.h>
#include <folly/portability/GTest.h>
#include <folly/portability/SysTypes.h>

#if defined(FOLLY_USE_JEMALLOC) && (!defined(FOLLY_SANITIZE) || !FOLLY_SANITIZE)
#include <jemalloc/jemalloc.h>
Expand Down
1 change: 1 addition & 0 deletions folly/net/detail/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cpp_unittest(
"//folly/portability:fcntl",
"//folly/portability:gtest",
"//folly/portability:sockets",
"//folly/portability:unistd",
"//folly/portability:windows",
],
)
1 change: 1 addition & 0 deletions folly/net/detail/test/SocketFileDescriptorMapTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <folly/portability/Fcntl.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <folly/portability/Windows.h>

namespace folly {
Expand Down
16 changes: 0 additions & 16 deletions folly/portability/GMock.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,4 @@

#pragma once

// These _must_ be included before gmock.h, because
// it tries to include <io.h> on it's own, but we
// override all of those functions in Unistd.h :(
#include <folly/portability/Unistd.h>
#include <folly/portability/Windows.h>

#include <folly/Portability.h>

// Disable a couple of warnings due to GMock exporting classes
// that derive from stdlib classes which aren't explicitly exported.
FOLLY_PUSH_WARNING
FOLLY_MSVC_DISABLE_WARNING(4251)
FOLLY_MSVC_DISABLE_WARNING(4275)
// IWYU pragma: begin_exports
#include <gmock/gmock.h>
// IWYU pragma: end_exports
FOLLY_POP_WARNING
16 changes: 0 additions & 16 deletions folly/portability/GTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,4 @@

#pragma once

// These _must_ be included before gtest.h, because
// it tries to include <io.h> on it's own, but we
// override all of those functions in Unistd.h :(
#include <folly/portability/Unistd.h>
#include <folly/portability/Windows.h>

#include <folly/Portability.h>

// Disable a couple of warnings due to GTest exporting classes
// that derive from stdlib classes which aren't explicitly exported.
FOLLY_PUSH_WARNING
FOLLY_MSVC_DISABLE_WARNING(4251)
FOLLY_MSVC_DISABLE_WARNING(4275)
// IWYU pragma: begin_exports
#include <gtest/gtest.h>
// IWYU pragma: end_exports
FOLLY_POP_WARNING
2 changes: 2 additions & 0 deletions folly/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ cpp_unittest(
"//folly/container:array",
"//folly/detail:iterators",
"//folly/portability:gtest",
"//folly/portability:sys_types",
],
)

Expand Down Expand Up @@ -1037,6 +1038,7 @@ cpp_unittest(
"//folly:memcpy",
"//folly:portability",
"//folly/portability:gtest",
"//folly/portability:sys_types",
],
)

Expand Down
1 change: 1 addition & 0 deletions folly/test/IteratorsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <folly/container/Array.h>
#include <folly/portability/GTest.h>
#include <folly/portability/SysTypes.h>

using namespace folly::detail;

Expand Down
1 change: 1 addition & 0 deletions folly/test/MemcpyTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <folly/FollyMemcpy.h>
#include <folly/Portability.h>
#include <folly/portability/GTest.h>
#include <folly/portability/SysTypes.h>

namespace {

Expand Down
1 change: 1 addition & 0 deletions folly/testing/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cpp_unittest(
"//folly/portability:fcntl",
"//folly/portability:gtest",
"//folly/portability:stdlib",
"//folly/portability:unistd",
"//folly/testing:test_util",
],
external_deps = [
Expand Down
1 change: 1 addition & 0 deletions folly/testing/test/TestUtilTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <folly/portability/Fcntl.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Stdlib.h>
#include <folly/portability/Unistd.h>

using namespace folly;
using namespace folly::test;
Expand Down

0 comments on commit 7329765

Please sign in to comment.