Commit f3605199 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 2

Create the Windows portability header

Summary: Because Windows' defines seem to get in the way more than they help.

Reviewed By: yfeldblum

Differential Revision: D2989507

fb-gh-sync-id: 148f390ef6adf977bffa2262aa76839b2bf4f507
shipit-source-id: 148f390ef6adf977bffa2262aa76839b2bf4f507
parent 22a8195e
...@@ -276,6 +276,7 @@ nobase_follyinclude_HEADERS = \ ...@@ -276,6 +276,7 @@ nobase_follyinclude_HEADERS = \
portability/SysTypes.h \ portability/SysTypes.h \
portability/SysUio.h \ portability/SysUio.h \
portability/Time.h \ portability/Time.h \
portability/Windows.h \
Preprocessor.h \ Preprocessor.h \
ProducerConsumerQueue.h \ ProducerConsumerQueue.h \
Random.h \ Random.h \
......
/*
* Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
// Only do anything if we are on windows.
#ifdef _WIN32
// This header is intended to be used in-place of including <Windows.h>,
// <WinSock2.h>, <io.h> or <direct.h>.
// It includes all of them, and undefines certain names defined by them that
// are used in places in Folly.
//
// 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 <io.h> // nolint
#include <direct.h> // nolint
#undef __STDC__
#else
#include <io.h> // nolint
#include <direct.h> // nolint
#endif
#include <Windows.h>
#include <WinSock2.h>
#ifdef CAL_GREGORIAN
#undef CAL_GREGORIAN
#endif
// Defined in winnt.h
#ifdef DELETE
#undef DELETE
#endif
// Defined in the GDI interface.
#ifdef ERROR
#undef ERROR
#endif
// Defined in minwindef.h
#ifdef IN
#undef IN
#endif
// Defined in winerror.h
#ifdef NO_ERROR
#undef NO_ERROR
#endif
// Defined in minwindef.h
#ifdef OUT
#undef OUT
#endif
// Defined in minwindef.h
#ifdef STRICT
#undef STRICT
#endif
// Defined in Winbase.h
#ifdef Yield
#undef Yield
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment