Skip to content

Commit

Permalink
[Folly] define _CRT_INTERNAL_NONSTDC_NAMES to 0 to disable non-unders…
Browse files Browse the repository at this point in the history
…core posix names on windows (#6974)
  • Loading branch information
Phoebe authored and Rastaban committed Jun 20, 2019
1 parent f0902b3 commit 83520db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ports/folly/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: folly
Version: 2019.05.20.00
Version: 2019.05.20.00-1
Homepage: https://github.com/facebook/folly
Description: An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows
Build-Depends: openssl, libevent, double-conversion, glog, gflags, boost-chrono, boost-context, boost-conversion, boost-crc, boost-date-time, boost-filesystem, boost-multi-index, boost-program-options, boost-regex, boost-system, boost-thread, boost-smart-ptr
Expand Down
27 changes: 27 additions & 0 deletions ports/folly/disable-non-underscore-posix-names.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/folly/portability/Windows.h b/folly/portability/Windows.h
index f7990ca..b22fac5 100644
--- a/folly/portability/Windows.h
+++ b/folly/portability/Windows.h
@@ -26,16 +26,12 @@
// These have to be this way because we define our own versions
// of close(), because the normal Windows versions don't handle
// sockets at all.
-#ifndef __STDC__
-/* nolint */
-#define __STDC__ 1
-#include <direct.h> // @manual nolint
-#include <io.h> // @manual nolint
-#undef __STDC__
-#else
-#include <direct.h> // @manual nolint
-#include <io.h> // @manual nolint
-#endif
+#include <corecrt.h>
+#pragma push_macro("_CRT_INTERNAL_NONSTDC_NAMES")
+#define _CRT_INTERNAL_NONSTDC_NAMES 0
+#include <direct.h>
+#include <io.h>
+#pragma pop_macro("_CRT_INTERNAL_NONSTDC_NAMES")

#if defined(min) || defined(max)
#error Windows.h needs to be included by this header, or else NOMINMAX needs \
1 change: 1 addition & 0 deletions ports/folly/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vcpkg_from_github(
missing-include-atomic.patch
boost-1.70.patch
reorder-glog-gflags.patch
disable-non-underscore-posix-names.patch
)

file(COPY
Expand Down

0 comments on commit 83520db

Please sign in to comment.