Revert D4805628: [folly] Suppress more warnings for MSVC
[folly.git] / folly / portability / Windows.h
1 /*
2  * Copyright 2017 Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #pragma once
18
19 // Only do anything if we are on windows.
20 #ifdef _WIN32
21 // This header is intended to be used in-place of including <Windows.h>,
22 // <WinSock2.h>, <io.h> or <direct.h>.
23 // It includes all of them, and undefines certain names defined by them that
24 // are used in places in Folly.
25 //
26 // These have to be this way because we define our own versions
27 // of close(), because the normal Windows versions don't handle
28 // sockets at all.
29 #ifndef __STDC__
30 /* nolint */
31 #define __STDC__ 1
32 #include <io.h> // nolint
33 #include <direct.h> // nolint
34 #undef __STDC__
35 #else
36 #include <io.h> // nolint
37 #include <direct.h> // nolint
38 #endif
39
40 #include <WinSock2.h>
41 #include <Windows.h>
42
43 #ifdef CAL_GREGORIAN
44 #undef CAL_GREGORIAN
45 #endif
46
47 // Defined in winnt.h
48 #ifdef DELETE
49 #undef DELETE
50 #endif
51
52 // Defined in the GDI interface.
53 #ifdef ERROR
54 #undef ERROR
55 #endif
56
57 // Defined in minwindef.h
58 #ifdef IN
59 #undef IN
60 #endif
61
62 // Defined in winerror.h
63 #ifdef NO_ERROR
64 #undef NO_ERROR
65 #endif
66
67 // Defined in minwindef.h
68 #ifdef OUT
69 #undef OUT
70 #endif
71
72 // Defined in minwindef.h
73 #ifdef STRICT
74 #undef STRICT
75 #endif
76
77 // Defined in Winbase.h
78 #ifdef Yield
79 #undef Yield
80 #endif
81
82 #endif