Add protection from min/max macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145407 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__bit_reference b/include/__bit_reference
index 4621333..9ee1dd9 100644
--- a/include/__bit_reference
+++ b/include/__bit_reference
@@ -14,6 +14,8 @@
#include <__config>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/__hash_table b/include/__hash_table
index 4399caa..39de62a 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -18,6 +18,8 @@
#include <algorithm>
#include <cmath>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/__split_buffer b/include/__split_buffer
index 33ce42d..581f159 100644
--- a/include/__split_buffer
+++ b/include/__split_buffer
@@ -6,6 +6,8 @@
#include <type_traits>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/__std_stream b/include/__std_stream
index 6df6556..7fe34d4 100644
--- a/include/__std_stream
+++ b/include/__std_stream
@@ -17,6 +17,8 @@
#include <__locale>
#include <cstdio>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/__undef_min_max b/include/__undef_min_max
new file mode 100644
index 0000000..88bc53f
--- /dev/null
+++ b/include/__undef_min_max
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef min
+#warning: macro min is incompatible with C++. #undef'ing min
+#undef min
+#endif
+
+#ifdef max
+#warning: macro max is incompatible with C++. #undef'ing max
+#undef max
+#endif
diff --git a/include/algorithm b/include/algorithm
index 6749bf6..6255c52 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -595,6 +595,8 @@
#include <iterator>
#include <cstdlib>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/bitset b/include/bitset
index c970f32..4735754 100644
--- a/include/bitset
+++ b/include/bitset
@@ -129,6 +129,8 @@
#include <cassert>
#endif
+#include <__undef_min_max>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
diff --git a/include/chrono b/include/chrono
index 1c79f4b..0571f9d 100644
--- a/include/chrono
+++ b/include/chrono
@@ -255,6 +255,8 @@
#include <ratio>
#include <limits>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/deque b/include/deque
index ab9ba58..f304f56 100644
--- a/include/deque
+++ b/include/deque
@@ -162,6 +162,8 @@
#include <algorithm>
#include <stdexcept>
+#include <__undef_min_max>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator> class __deque_base;
diff --git a/include/forward_list b/include/forward_list
index 61fe290..ffd44a5 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -174,6 +174,8 @@
#include <iterator>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/fstream b/include/fstream
index b6a2ab0..4456c01 100644
--- a/include/fstream
+++ b/include/fstream
@@ -171,6 +171,8 @@
#include <__locale>
#include <cstdio>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/istream b/include/istream
index 24d9f3a..f271393 100644
--- a/include/istream
+++ b/include/istream
@@ -155,6 +155,8 @@
#include <__config>
#include <ostream>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/limits b/include/limits
index 14b49b1..ea579ad 100644
--- a/include/limits
+++ b/include/limits
@@ -109,6 +109,8 @@
#include <__config>
#include <type_traits>
+#include <__undef_min_max>
+
#if defined(_MSC_VER)
#include "support/win32/limits_win32.h"
#endif // _MSC_VER
diff --git a/include/list b/include/list
index 345f24d..add519f 100644
--- a/include/list
+++ b/include/list
@@ -176,6 +176,8 @@
#include <iterator>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/locale b/include/locale
index b2afbd4..5dc3ff2 100644
--- a/include/locale
+++ b/include/locale
@@ -192,6 +192,8 @@
#include <nl_types.h>
#endif // !_WIN32
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/memory b/include/memory
index 878dda8..7576aae 100644
--- a/include/memory
+++ b/include/memory
@@ -600,6 +600,8 @@
#include <cassert>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/mutex b/include/mutex
index 37e74d6..d1d0a6e 100644
--- a/include/mutex
+++ b/include/mutex
@@ -179,6 +179,8 @@
#include <tuple>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/random b/include/random
index c5c33c0..e14425d 100644
--- a/include/random
+++ b/include/random
@@ -1646,6 +1646,8 @@
#include <ostream>
#include <cmath>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/ratio b/include/ratio
index 654cb33..eb1ad24 100644
--- a/include/ratio
+++ b/include/ratio
@@ -70,6 +70,8 @@
#include <climits>
#include <type_traits>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/regex b/include/regex
index 048fbef..1da7b0e 100644
--- a/include/regex
+++ b/include/regex
@@ -732,6 +732,8 @@
#include <vector>
#include <deque>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/sstream b/include/sstream
index 1b27195..22450f0 100644
--- a/include/sstream
+++ b/include/sstream
@@ -175,6 +175,8 @@
#include <istream>
#include <string>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/string b/include/string
index 5f5a347..344bb55 100644
--- a/include/string
+++ b/include/string
@@ -446,6 +446,8 @@
#include <cassert>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/valarray b/include/valarray
index 5d3154c..3ac9494 100644
--- a/include/valarray
+++ b/include/valarray
@@ -346,6 +346,8 @@
#include <algorithm>
#include <functional>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/vector b/include/vector
index 7f7e3d3..10702f3 100644
--- a/include/vector
+++ b/include/vector
@@ -270,6 +270,8 @@
#include <__split_buffer>
#include <__functional_base>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif