From a016efb1dcda61e606e527b73791fbacf1bc9c86 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 31 May 2017 22:07:49 +0000 Subject: [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 llvm-svn: 304357 --- libcxx/include/vector | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libcxx/include/vector') diff --git a/libcxx/include/vector b/libcxx/include/vector index 6759dbd8a58..ee19fb7081a 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -275,14 +275,16 @@ void swap(vector& x, vector& y) #include <__split_buffer> #include <__functional_base> -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -3357,4 +3359,6 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_VECTOR -- cgit v1.2.3