fix ASAN stl_tests:stl_vector_test
[folly.git] / folly / portability / Windows.h
old mode 100755 (executable)
new mode 100644 (file)
index f10c428..4186058
 #ifndef __STDC__
 /* nolint */
 #define __STDC__ 1
-#include <io.h> // nolint
-#include <direct.h> // nolint
+#include <direct.h> // @manual nolint
+#include <io.h> // @manual nolint
 #undef __STDC__
 #else
-#include <io.h> // nolint
-#include <direct.h> // nolint
+#include <direct.h> // @manual nolint
+#include <io.h> // @manual nolint
 #endif
 
-#include <WinSock2.h>
-#include <Windows.h>
+#if defined(min) || defined(max)
+#error Windows.h needs to be included by this header, or else NOMINMAX needs \
+ to be defined before including it yourself.
+#endif
 
-#ifdef CAL_GREGORIAN
-#undef CAL_GREGORIAN
+// This is needed because, for some absurd reason, one of the windows headers
+// tries to define "min" and "max" as macros, which messes up most uses of
+// std::numeric_limits.
+#ifndef NOMINMAX
+#define NOMINMAX 1
 #endif
 
-// Defined in winnt.h
-#ifdef DELETE
-#undef DELETE
+#include <WinSock2.h> // @manual
+#include <Windows.h> // @manual
+
+#ifdef CAL_GREGORIAN
+#undef CAL_GREGORIAN
 #endif
 
 // Defined in the GDI interface.