[libcxx] r304357 - [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Wed May 31 15:07:50 PDT 2017
Author: ericwf
Date: Wed May 31 17:07:49 2017
New Revision: 304357
URL: http://llvm.org/viewvc/llvm-project?rev=304357&view=rev
Log:
[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
Added:
libcxx/trunk/include/__undef_macros
libcxx/trunk/test/libcxx/min_max_macros.sh.cpp
Removed:
libcxx/trunk/include/__undef_min_max
Modified:
libcxx/trunk/include/__bit_reference
libcxx/trunk/include/__config
libcxx/trunk/include/__hash_table
libcxx/trunk/include/__mutex_base
libcxx/trunk/include/__split_buffer
libcxx/trunk/include/__std_stream
libcxx/trunk/include/__string
libcxx/trunk/include/__threading_support
libcxx/trunk/include/__tree
libcxx/trunk/include/algorithm
libcxx/trunk/include/array
libcxx/trunk/include/bitset
libcxx/trunk/include/chrono
libcxx/trunk/include/deque
libcxx/trunk/include/experimental/algorithm
libcxx/trunk/include/experimental/dynarray
libcxx/trunk/include/experimental/functional
libcxx/trunk/include/experimental/memory_resource
libcxx/trunk/include/experimental/numeric
libcxx/trunk/include/experimental/optional
libcxx/trunk/include/experimental/string_view
libcxx/trunk/include/forward_list
libcxx/trunk/include/fstream
libcxx/trunk/include/istream
libcxx/trunk/include/limits
libcxx/trunk/include/list
libcxx/trunk/include/locale
libcxx/trunk/include/memory
libcxx/trunk/include/module.modulemap
libcxx/trunk/include/mutex
libcxx/trunk/include/numeric
libcxx/trunk/include/optional
libcxx/trunk/include/random
libcxx/trunk/include/ratio
libcxx/trunk/include/regex
libcxx/trunk/include/shared_mutex
libcxx/trunk/include/sstream
libcxx/trunk/include/streambuf
libcxx/trunk/include/string
libcxx/trunk/include/string_view
libcxx/trunk/include/thread
libcxx/trunk/include/valarray
libcxx/trunk/include/vector
libcxx/trunk/src/condition_variable.cpp
libcxx/trunk/src/ios.cpp
libcxx/trunk/src/locale.cpp
libcxx/trunk/src/mutex.cpp
libcxx/trunk/src/strstream.cpp
Modified: libcxx/trunk/include/__bit_reference
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__bit_reference?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__bit_reference (original)
+++ libcxx/trunk/include/__bit_reference Wed May 31 17:07:49 2017
@@ -14,12 +14,14 @@
#include <__config>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
@@ -1273,4 +1275,6 @@ private:
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___BIT_REFERENCE
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed May 31 17:07:49 2017
@@ -1205,4 +1205,34 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
#endif
+#if defined(_LIBCPP_COMPILER_IBM)
+#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
+#endif
+
+#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
+# define _LIBCPP_PUSH_MACROS
+# define _LIBCPP_POP_MACROS
+#else
+ // Don't warn about macro conflicts when we can restore them at the
+ // end of the header.
+# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
+# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
+# endif
+# if defined(_LIBCPP_COMPILER_MSVC)
+# define _LIBCPP_PUSH_MACROS \
+ __pragma(push_macro("min")) \
+ __pragma(push_macro("max"))
+# define _LIBCPP_POP_MACROS \
+ __pragma(pop_macro("min")) \
+ __pragma(pop_macro("max"))
+# else
+# define _LIBCPP_PUSH_MACROS \
+ _Pragma("push_macro(\"min\")") \
+ _Pragma("push_macro(\"max\")")
+# define _LIBCPP_POP_MACROS \
+ _Pragma("pop_macro(\"min\")") \
+ _Pragma("pop_macro(\"max\")")
+# endif
+#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
+
#endif // _LIBCPP_CONFIG
Modified: libcxx/trunk/include/__hash_table
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Wed May 31 17:07:49 2017
@@ -20,16 +20,17 @@
#include <utility>
#include <type_traits>
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
-_LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp>
@@ -2667,6 +2668,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>
}
#endif // _LIBCPP_DEBUG_LEVEL >= 2
+
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP__HASH_TABLE
Modified: libcxx/trunk/include/__mutex_base
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__mutex_base?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__mutex_base (original)
+++ libcxx/trunk/include/__mutex_base Wed May 31 17:07:49 2017
@@ -15,12 +15,16 @@
#include <chrono>
#include <system_error>
#include <__threading_support>
-#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
@@ -428,4 +432,6 @@ condition_variable::wait_for(unique_lock
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___MUTEX_BASE
Modified: libcxx/trunk/include/__split_buffer
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__split_buffer?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__split_buffer (original)
+++ libcxx/trunk/include/__split_buffer Wed May 31 17:07:49 2017
@@ -6,12 +6,14 @@
#include <type_traits>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <bool>
@@ -628,7 +630,8 @@ swap(__split_buffer<_Tp, _Allocator>& __
__x.swap(__y);
}
-
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_SPLIT_BUFFER
Modified: libcxx/trunk/include/__std_stream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__std_stream?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__std_stream (original)
+++ libcxx/trunk/include/__std_stream Wed May 31 17:07:49 2017
@@ -17,12 +17,14 @@
#include <__locale>
#include <cstdio>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
static const int __limit = 8;
@@ -355,4 +357,6 @@ __stdoutbuf<_CharT>::imbue(const locale&
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___STD_STREAM
Modified: libcxx/trunk/include/__string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__string?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__string (original)
+++ libcxx/trunk/include/__string Wed May 31 17:07:49 2017
@@ -57,14 +57,16 @@ template <> struct char_traits<wchar_t>;
#include <cstdio> // For EOF.
#include <memory> // for __murmur2_or_cityhash
-#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
// char_traits
@@ -870,4 +872,6 @@ struct __quoted_output_proxy
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___STRING
Modified: libcxx/trunk/include/__threading_support
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Wed May 31 17:07:49 2017
@@ -30,9 +30,12 @@
#include <windows.h>
#include <process.h>
#include <fibersapi.h>
-#include <__undef_min_max>
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
@@ -629,6 +632,8 @@ int __libcpp_tls_set(__libcpp_tls_key __
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // !_LIBCPP_HAS_NO_THREADS
#endif // _LIBCPP_THREADING_SUPPORT
Modified: libcxx/trunk/include/__tree
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Wed May 31 17:07:49 2017
@@ -17,12 +17,14 @@
#include <stdexcept>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare, class _Allocator> class __tree;
@@ -2685,4 +2687,6 @@ swap(__tree<_Tp, _Compare, _Allocator>&
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___TREE
Added: libcxx/trunk/include/__undef_macros
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__undef_macros?rev=304357&view=auto
==============================================================================
--- libcxx/trunk/include/__undef_macros (added)
+++ libcxx/trunk/include/__undef_macros Wed May 31 17:07:49 2017
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//===------------------------ __undef_macros ------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+#ifdef min
+#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
+#if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
+ "before any Windows header. #undefing min")
+#else
+#warning: macro min is incompatible with C++. #undefing min
+#endif
+#endif
+#undef min
+#endif
+
+#ifdef max
+#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
+#if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
+ "before any Windows header. #undefing max")
+#else
+#warning: macro max is incompatible with C++. #undefing max
+#endif
+#endif
+#undef max
+#endif
Removed: libcxx/trunk/include/__undef_min_max
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__undef_min_max?rev=304356&view=auto
==============================================================================
--- libcxx/trunk/include/__undef_min_max (original)
+++ libcxx/trunk/include/__undef_min_max (removed)
@@ -1,33 +0,0 @@
-// -*- 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
-#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
-#if defined(_LIBCPP_WARNING)
-_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
- "before any Windows header. #undefing min")
-#else
-#warning: macro min is incompatible with C++. #undefing min
-#endif
-#endif
-#undef min
-#endif
-
-#ifdef max
-#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
-#if defined(_LIBCPP_WARNING)
-_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
- "before any Windows header. #undefing max")
-#else
-#warning: macro max is incompatible with C++. #undefing max
-#endif
-#endif
-#undef max
-#endif
Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Wed May 31 17:07:49 2017
@@ -651,14 +651,16 @@ template <class BidirectionalIterator, c
#include <intrin.h>
#endif
-#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
// I'd like to replace these with _VSTD::equal_to<void>, but can't because:
@@ -5904,4 +5906,6 @@ prev_permutation(_BidirectionalIterator
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_ALGORITHM
Modified: libcxx/trunk/include/array
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Wed May 31 17:07:49 2017
@@ -113,6 +113,8 @@ template <size_t I, class T, size_t N> c
#pragma GCC system_header
#endif
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
Modified: libcxx/trunk/include/bitset
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bitset?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/bitset (original)
+++ libcxx/trunk/include/bitset Wed May 31 17:07:49 2017
@@ -113,10 +113,6 @@ template <size_t N> struct hash<std::bit
*/
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#include <__config>
#include <__bit_reference>
#include <cstddef>
@@ -126,7 +122,13 @@ template <size_t N> struct hash<std::bit
#include <iosfwd>
#include <__functional_base>
-#include <__undef_min_max>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -1090,4 +1092,6 @@ operator<<(basic_ostream<_CharT, _Traits
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_BITSET
Modified: libcxx/trunk/include/chrono
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/chrono (original)
+++ libcxx/trunk/include/chrono Wed May 31 17:07:49 2017
@@ -305,12 +305,14 @@ constexpr chrono::duration<unspecified ,
#include <ratio>
#include <limits>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
@@ -1160,4 +1162,6 @@ namespace chrono { // hoist the literals
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_CHRONO
Modified: libcxx/trunk/include/deque
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/deque (original)
+++ libcxx/trunk/include/deque Wed May 31 17:07:49 2017
@@ -150,10 +150,6 @@ template <class T, class Allocator>
*/
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#include <__config>
#include <__split_buffer>
#include <type_traits>
@@ -162,7 +158,13 @@ template <class T, class Allocator>
#include <algorithm>
#include <stdexcept>
-#include <__undef_min_max>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -2900,4 +2902,6 @@ swap(deque<_Tp, _Allocator>& __x, deque<
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_DEQUE
Modified: libcxx/trunk/include/experimental/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/algorithm?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/algorithm (original)
+++ libcxx/trunk/include/experimental/algorithm Wed May 31 17:07:49 2017
@@ -39,17 +39,18 @@ SampleIterator sample(PopulationIterator
#include <algorithm>
#include <type_traits>
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
-_LIBCPP_BEGIN_NAMESPACE_LFTS
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
template <class _ForwardIterator, class _Searcher>
_LIBCPP_INLINE_VISIBILITY
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
@@ -67,4 +68,6 @@ _SampleIterator sample(_PopulationIterat
_LIBCPP_END_NAMESPACE_LFTS
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */
Modified: libcxx/trunk/include/experimental/dynarray
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/dynarray?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/dynarray (original)
+++ libcxx/trunk/include/experimental/dynarray Wed May 31 17:07:49 2017
@@ -107,6 +107,9 @@ public:
#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 @@ template <class _Tp, class _Alloc>
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
Modified: libcxx/trunk/include/experimental/functional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/functional?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/functional (original)
+++ libcxx/trunk/include/experimental/functional Wed May 31 17:07:49 2017
@@ -89,21 +89,22 @@ inline namespace fundamentals_v1 {
#include <experimental/__config>
#include <functional>
-
#include <algorithm>
#include <type_traits>
#include <vector>
#include <array>
#include <unordered_map>
-#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_LFTS
#if _LIBCPP_STD_VER > 11
@@ -456,4 +457,6 @@ make_boyer_moore_horspool_searcher( _Ran
_LIBCPP_END_NAMESPACE_LFTS
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
Modified: libcxx/trunk/include/experimental/memory_resource
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/memory_resource?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/memory_resource (original)
+++ libcxx/trunk/include/experimental/memory_resource Wed May 31 17:07:49 2017
@@ -82,6 +82,9 @@ namespace pmr {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
// Round __s up to next multiple of __a.
@@ -419,4 +422,6 @@ using resource_adaptor = __resource_adap
_LIBCPP_END_NAMESPACE_LFTS_PMR
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */
Modified: libcxx/trunk/include/experimental/numeric
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/numeric?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/numeric (original)
+++ libcxx/trunk/include/experimental/numeric Wed May 31 17:07:49 2017
@@ -41,6 +41,9 @@ inline namespace fundamentals_v2 {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#if _LIBCPP_STD_VER > 11
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
@@ -110,4 +113,7 @@ lcm(_Tp __m, _Up __n)
_LIBCPP_END_NAMESPACE_LFTS_V2
#endif /* _LIBCPP_STD_VER > 11 */
+
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */
Modified: libcxx/trunk/include/experimental/optional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/optional?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/optional (original)
+++ libcxx/trunk/include/experimental/optional Wed May 31 17:07:49 2017
@@ -143,6 +143,21 @@ namespace std { namespace experimental {
#include <experimental/__config>
#include <functional>
#include <stdexcept>
+#if _LIBCPP_STD_VER > 11
+#include <initializer_list>
+#include <type_traits>
+#include <new>
+#include <__functional_base>
+#include <__debug>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
@@ -160,17 +175,6 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL
#if _LIBCPP_STD_VER > 11
-#include <initializer_list>
-#include <type_traits>
-#include <new>
-#include <__functional_base>
-#include <__undef_min_max>
-#include <__debug>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
_LIBCPP_BEGIN_NAMESPACE_LFTS
struct in_place_t {};
@@ -913,4 +917,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 11
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
Modified: libcxx/trunk/include/experimental/string_view
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/string_view?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/string_view (original)
+++ libcxx/trunk/include/experimental/string_view Wed May 31 17:07:49 2017
@@ -189,6 +189,9 @@ namespace std {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_LFTS
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
@@ -810,4 +813,6 @@ quoted ( std::experimental::basic_string
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LFTS_STRING_VIEW
Modified: libcxx/trunk/include/forward_list
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/forward_list (original)
+++ libcxx/trunk/include/forward_list Wed May 31 17:07:49 2017
@@ -167,19 +167,20 @@ template <class T, class Allocator>
*/
#include <__config>
-
#include <initializer_list>
#include <memory>
#include <limits>
#include <iterator>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _VoidPtr> struct __forward_list_node;
@@ -1719,4 +1720,6 @@ swap(forward_list<_Tp, _Alloc>& __x, for
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_FORWARD_LIST
Modified: libcxx/trunk/include/fstream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/fstream?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/fstream (original)
+++ libcxx/trunk/include/fstream Wed May 31 17:07:49 2017
@@ -171,12 +171,14 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale>
#include <cstdio>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
@@ -1476,4 +1478,6 @@ basic_fstream<_CharT, _Traits>::close()
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_FSTREAM
Modified: libcxx/trunk/include/istream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/istream?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/istream (original)
+++ libcxx/trunk/include/istream Wed May 31 17:07:49 2017
@@ -162,12 +162,14 @@ template <class charT, class traits, cla
#include <__config>
#include <ostream>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
@@ -1683,4 +1685,6 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EX
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_ISTREAM
Modified: libcxx/trunk/include/limits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/limits (original)
+++ libcxx/trunk/include/limits Wed May 31 17:07:49 2017
@@ -102,15 +102,8 @@ template<> class numeric_limits<cv long
*/
#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#include <type_traits>
-#include <__undef_min_max>
-
#if defined(_LIBCPP_COMPILER_MSVC)
#include "support/win32/limits_msvc_win32.h"
#endif // _LIBCPP_MSVCRT
@@ -119,6 +112,14 @@ template<> class numeric_limits<cv long
#include "support/ibm/limits.h"
#endif // __IBMCPP__
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
enum float_round_style
@@ -811,4 +812,6 @@ template <class _Tp>
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LIMITS
Modified: libcxx/trunk/include/list
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Wed May 31 17:07:49 2017
@@ -177,14 +177,16 @@ template <class T, class Alloc>
#include <algorithm>
#include <type_traits>
-#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 <class _Tp, class _VoidPtr> struct __list_node;
@@ -2415,4 +2417,6 @@ swap(list<_Tp, _Alloc>& __x, list<_Tp, _
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LIST
Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Wed May 31 17:07:49 2017
@@ -208,18 +208,20 @@ template <class charT> class messages_by
#include <Availability.h>
#endif
-#include <__undef_min_max>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
#include <__bsd_locale_defaults.h>
#else
#include <__bsd_locale_fallbacks.h>
#endif
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
@@ -4274,4 +4276,6 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::_
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LOCALE
Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed May 31 17:07:49 2017
@@ -658,12 +658,14 @@ void* align(size_t alignment, size_t siz
# include <atomic>
#endif
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ValueType>
@@ -5574,4 +5576,6 @@ struct __temp_value {
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_MEMORY
Modified: libcxx/trunk/include/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/module.modulemap (original)
+++ libcxx/trunk/include/module.modulemap Wed May 31 17:07:49 2017
@@ -484,7 +484,7 @@ module std [system] {
module __string { header "__string" export * }
module __tree { header "__tree" export * }
module __tuple { header "__tuple" export * }
- module __undef_min_max { header "__undef_min_max" export * }
+ module __undef_macros { header "__undef_macros" export * }
module experimental {
requires cplusplus11
Modified: libcxx/trunk/include/mutex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/mutex (original)
+++ libcxx/trunk/include/mutex Wed May 31 17:07:49 2017
@@ -196,12 +196,14 @@ template<class Callable, class ...Args>
#endif
#include <__threading_support>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
@@ -696,4 +698,6 @@ call_once(once_flag& __flag, const _Call
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_MUTEX
Modified: libcxx/trunk/include/numeric
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/numeric?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/numeric (original)
+++ libcxx/trunk/include/numeric Wed May 31 17:07:49 2017
@@ -71,6 +71,9 @@ template <class M, class N>
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Tp>
@@ -267,4 +270,6 @@ lcm(_Tp __m, _Up __n)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_NUMERIC
Modified: libcxx/trunk/include/optional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Wed May 31 17:07:49 2017
@@ -146,7 +146,6 @@ namespace std {
#include <__config>
#include <__debug>
#include <__functional_base>
-#include <__undef_min_max>
#include <functional>
#include <initializer_list>
#include <new>
@@ -158,6 +157,10 @@ namespace std {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
namespace std // purposefully not using versioning namespace
{
@@ -1315,4 +1318,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 14
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_OPTIONAL
Modified: libcxx/trunk/include/random
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/random?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/random (original)
+++ libcxx/trunk/include/random Wed May 31 17:07:49 2017
@@ -1646,12 +1646,14 @@ class piecewise_linear_distribution
#include <istream>
#include <ostream>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// __is_seed_sequence
@@ -6736,4 +6738,6 @@ operator>>(basic_istream<_CharT, _Traits
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_RANDOM
Modified: libcxx/trunk/include/ratio
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ratio?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/ratio (original)
+++ libcxx/trunk/include/ratio Wed May 31 17:07:49 2017
@@ -83,12 +83,14 @@ typedef ratio<1000000000000000000000000,
#include <climits>
#include <type_traits>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// __static_gcd
@@ -520,4 +522,6 @@ template <class _R1, class _R2> _LIBCPP_
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_RATIO
Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Wed May 31 17:07:49 2017
@@ -765,12 +765,14 @@ typedef regex_token_iterator<wstring::co
#include <vector>
#include <deque>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
namespace regex_constants
@@ -6562,4 +6564,6 @@ regex_replace(const _CharT* __s,
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_REGEX
Modified: libcxx/trunk/include/shared_mutex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/shared_mutex?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/shared_mutex (original)
+++ libcxx/trunk/include/shared_mutex Wed May 31 17:07:49 2017
@@ -125,12 +125,14 @@ template <class Mutex>
#include <__config>
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
#if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX)
#include <__mutex_base>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -500,4 +502,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 11
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_SHARED_MUTEX
Modified: libcxx/trunk/include/sstream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/sstream?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/sstream (original)
+++ libcxx/trunk/include/sstream Wed May 31 17:07:49 2017
@@ -175,12 +175,14 @@ typedef basic_stringstream<wchar_t> wstr
#include <istream>
#include <string>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
@@ -970,4 +972,6 @@ basic_stringstream<_CharT, _Traits, _All
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_SSTREAM
Modified: libcxx/trunk/include/streambuf
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/streambuf?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/streambuf (original)
+++ libcxx/trunk/include/streambuf Wed May 31 17:07:49 2017
@@ -116,6 +116,9 @@ protected:
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
@@ -486,4 +489,6 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EX
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STEAMBUF
Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed May 31 17:07:49 2017
@@ -484,14 +484,16 @@ basic_string<char32_t> operator "" s( co
#include <cstdint>
#endif
-#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
// fpos
@@ -4041,4 +4043,6 @@ _LIBCPP_EXTERN_TEMPLATE(string operator+
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STRING
Modified: libcxx/trunk/include/string_view
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/string_view (original)
+++ libcxx/trunk/include/string_view Wed May 31 17:07:49 2017
@@ -166,7 +166,6 @@ namespace std {
*/
#include <__config>
-
#include <__string>
#include <algorithm>
#include <iterator>
@@ -178,6 +177,10 @@ namespace std {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _CharT, class _Traits = char_traits<_CharT> >
@@ -784,4 +787,6 @@ inline namespace literals
#endif
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STRING_VIEW
Modified: libcxx/trunk/include/thread
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/thread (original)
+++ libcxx/trunk/include/thread Wed May 31 17:07:49 2017
@@ -105,6 +105,9 @@ void sleep_for(const chrono::duration<Re
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#define __STDCPP_THREADS__ __cplusplus
#ifdef _LIBCPP_HAS_NO_THREADS
@@ -476,4 +479,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // !_LIBCPP_HAS_NO_THREADS
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_THREAD
Modified: libcxx/trunk/include/valarray
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/valarray?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/valarray (original)
+++ libcxx/trunk/include/valarray Wed May 31 17:07:49 2017
@@ -347,12 +347,14 @@ template <class T> unspecified2 end(cons
#include <functional>
#include <new>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_TEMPLATE_VIS valarray;
@@ -4865,4 +4867,6 @@ end(const valarray<_Tp>& __v)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_VALARRAY
Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Wed May 31 17:07:49 2017
@@ -275,14 +275,16 @@ void swap(vector<T,Allocator>& x, vector
#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 <bool>
@@ -3357,4 +3359,6 @@ swap(vector<_Tp, _Allocator>& __x, vecto
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_VECTOR
Modified: libcxx/trunk/src/condition_variable.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/condition_variable.cpp?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/src/condition_variable.cpp (original)
+++ libcxx/trunk/src/condition_variable.cpp Wed May 31 17:07:49 2017
@@ -14,6 +14,7 @@
#include "condition_variable"
#include "thread"
#include "system_error"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
Modified: libcxx/trunk/src/ios.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/ios.cpp?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/src/ios.cpp (original)
+++ libcxx/trunk/src/ios.cpp Wed May 31 17:07:49 2017
@@ -22,6 +22,7 @@
#include "new"
#include "streambuf"
#include "string"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Wed May 31 17:07:49 2017
@@ -36,6 +36,7 @@
#endif
#include <stdlib.h>
#include <stdio.h>
+#include "__undef_macros"
// On Linux, wint_t and wchar_t have different signed-ness, and this causes
// lots of noise in the build log, but no bugs that I know of.
Modified: libcxx/trunk/src/mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/mutex.cpp?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/src/mutex.cpp (original)
+++ libcxx/trunk/src/mutex.cpp Wed May 31 17:07:49 2017
@@ -12,6 +12,7 @@
#include "limits"
#include "system_error"
#include "include/atomic_support.h"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
Modified: libcxx/trunk/src/strstream.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/strstream.cpp?rev=304357&r1=304356&r2=304357&view=diff
==============================================================================
--- libcxx/trunk/src/strstream.cpp (original)
+++ libcxx/trunk/src/strstream.cpp Wed May 31 17:07:49 2017
@@ -13,6 +13,7 @@
#include "cstring"
#include "cstdlib"
#include "__debug"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
Added: libcxx/trunk/test/libcxx/min_max_macros.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/min_max_macros.sh.cpp?rev=304357&view=auto
==============================================================================
--- libcxx/trunk/test/libcxx/min_max_macros.sh.cpp (added)
+++ libcxx/trunk/test/libcxx/min_max_macros.sh.cpp Wed May 31 17:07:49 2017
@@ -0,0 +1,298 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that we can include each header in two TU's and link them together.
+
+// RUN: %compile -fsyntax-only
+
+// Prevent <ext/hash_map> from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#undef __DEPRECATED
+#endif
+
+#define TEST_MACROS() static_assert(min() == true && max() == true, "")
+#define min() true
+#define max() true
+
+// Top level headers
+#include <algorithm>
+TEST_MACROS();
+#include <any>
+TEST_MACROS();
+#include <array>
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <atomic>
+TEST_MACROS();
+#endif
+#include <bitset>
+TEST_MACROS();
+#include <cassert>
+TEST_MACROS();
+#include <ccomplex>
+TEST_MACROS();
+#include <cctype>
+TEST_MACROS();
+#include <cerrno>
+TEST_MACROS();
+#include <cfenv>
+TEST_MACROS();
+#include <cfloat>
+TEST_MACROS();
+#include <chrono>
+TEST_MACROS();
+#include <cinttypes>
+TEST_MACROS();
+#include <ciso646>
+TEST_MACROS();
+#include <climits>
+TEST_MACROS();
+#include <clocale>
+TEST_MACROS();
+#include <cmath>
+TEST_MACROS();
+#include <codecvt>
+TEST_MACROS();
+#include <complex>
+TEST_MACROS();
+#include <complex.h>
+TEST_MACROS();
+#include <condition_variable>
+TEST_MACROS();
+#include <csetjmp>
+TEST_MACROS();
+#include <csignal>
+TEST_MACROS();
+#include <cstdarg>
+TEST_MACROS();
+#include <cstdbool>
+TEST_MACROS();
+#include <cstddef>
+TEST_MACROS();
+#include <cstdint>
+TEST_MACROS();
+#include <cstdio>
+TEST_MACROS();
+#include <cstdlib>
+TEST_MACROS();
+#include <cstring>
+TEST_MACROS();
+#include <ctgmath>
+TEST_MACROS();
+#include <ctime>
+TEST_MACROS();
+#include <ctype.h>
+TEST_MACROS();
+#include <cwchar>
+TEST_MACROS();
+#include <cwctype>
+TEST_MACROS();
+#include <deque>
+TEST_MACROS();
+#include <errno.h>
+TEST_MACROS();
+#include <exception>
+TEST_MACROS();
+#include <float.h>
+TEST_MACROS();
+#include <forward_list>
+TEST_MACROS();
+#include <fstream>
+TEST_MACROS();
+#include <functional>
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <future>
+TEST_MACROS();
+#endif
+#include <initializer_list>
+TEST_MACROS();
+#include <inttypes.h>
+TEST_MACROS();
+#include <iomanip>
+TEST_MACROS();
+#include <ios>
+TEST_MACROS();
+#include <iosfwd>
+TEST_MACROS();
+#include <iostream>
+TEST_MACROS();
+#include <istream>
+TEST_MACROS();
+#include <iterator>
+TEST_MACROS();
+#include <limits>
+TEST_MACROS();
+#include <limits.h>
+TEST_MACROS();
+#include <list>
+TEST_MACROS();
+#include <locale>
+TEST_MACROS();
+#include <locale.h>
+TEST_MACROS();
+#include <map>
+TEST_MACROS();
+#include <math.h>
+TEST_MACROS();
+#include <memory>
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <mutex>
+TEST_MACROS();
+#endif
+#include <new>
+TEST_MACROS();
+#include <numeric>
+TEST_MACROS();
+#include <optional>
+TEST_MACROS();
+#include <ostream>
+TEST_MACROS();
+#include <queue>
+TEST_MACROS();
+#include <random>
+TEST_MACROS();
+#include <ratio>
+TEST_MACROS();
+#include <regex>
+TEST_MACROS();
+#include <scoped_allocator>
+TEST_MACROS();
+#include <set>
+TEST_MACROS();
+#include <setjmp.h>
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <shared_mutex>
+TEST_MACROS();
+#endif
+#include <sstream>
+TEST_MACROS();
+#include <stack>
+TEST_MACROS();
+#include <stdbool.h>
+TEST_MACROS();
+#include <stddef.h>
+TEST_MACROS();
+#include <stdexcept>
+TEST_MACROS();
+#include <stdint.h>
+TEST_MACROS();
+#include <stdio.h>
+TEST_MACROS();
+#include <stdlib.h>
+TEST_MACROS();
+#include <streambuf>
+TEST_MACROS();
+#include <string>
+TEST_MACROS();
+#include <string.h>
+TEST_MACROS();
+#include <string_view>
+TEST_MACROS();
+#include <strstream>
+TEST_MACROS();
+#include <system_error>
+TEST_MACROS();
+#include <tgmath.h>
+TEST_MACROS();
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <thread>
+TEST_MACROS();
+#endif
+#include <tuple>
+TEST_MACROS();
+#include <typeindex>
+TEST_MACROS();
+#include <typeinfo>
+TEST_MACROS();
+#include <type_traits>
+TEST_MACROS();
+#include <unordered_map>
+TEST_MACROS();
+#include <unordered_set>
+TEST_MACROS();
+#include <utility>
+TEST_MACROS();
+#include <valarray>
+TEST_MACROS();
+#include <variant>
+TEST_MACROS();
+#include <vector>
+TEST_MACROS();
+#include <wchar.h>
+TEST_MACROS();
+#include <wctype.h>
+TEST_MACROS();
+
+// experimental headers
+#if __cplusplus >= 201103L
+#include <experimental/algorithm>
+TEST_MACROS();
+#include <experimental/any>
+TEST_MACROS();
+#include <experimental/chrono>
+TEST_MACROS();
+#include <experimental/deque>
+TEST_MACROS();
+#include <experimental/dynarray>
+TEST_MACROS();
+#include <experimental/filesystem>
+TEST_MACROS();
+#include <experimental/forward_list>
+TEST_MACROS();
+#include <experimental/functional>
+TEST_MACROS();
+#include <experimental/iterator>
+TEST_MACROS();
+#include <experimental/list>
+TEST_MACROS();
+#include <experimental/map>
+TEST_MACROS();
+#include <experimental/memory_resource>
+TEST_MACROS();
+#include <experimental/numeric>
+TEST_MACROS();
+#include <experimental/optional>
+TEST_MACROS();
+#include <experimental/propagate_const>
+TEST_MACROS();
+#include <experimental/ratio>
+TEST_MACROS();
+#include <experimental/regex>
+TEST_MACROS();
+#include <experimental/set>
+TEST_MACROS();
+#include <experimental/string>
+TEST_MACROS();
+#include <experimental/string_view>
+TEST_MACROS();
+#include <experimental/system_error>
+TEST_MACROS();
+#include <experimental/tuple>
+TEST_MACROS();
+#include <experimental/type_traits>
+TEST_MACROS();
+#include <experimental/unordered_map>
+TEST_MACROS();
+#include <experimental/unordered_set>
+TEST_MACROS();
+#include <experimental/utility>
+TEST_MACROS();
+#include <experimental/vector>
+TEST_MACROS();
+#endif // __cplusplus >= 201103L
+
+// extended headers
+#include <ext/hash_map>
+TEST_MACROS();
+#include <ext/hash_set>
+TEST_MACROS();
More information about the cfe-commits
mailing list