[Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.
Reviewers: mclow.lists, bcraig, compnerd, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits, krytarowski
Differential Revision: https://reviews.llvm.org/D33080
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304357 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/experimental/dynarray b/include/experimental/dynarray
index f96a0e5..1619331 100644
--- a/include/experimental/dynarray
+++ b/include/experimental/dynarray
@@ -107,6 +107,9 @@
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
template <class _Tp>
@@ -295,5 +298,7 @@
struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // if _LIBCPP_STD_VER > 11
#endif // _LIBCPP_DYNARRAY