diff options
Diffstat (limited to 'include')
50 files changed, 489 insertions, 291 deletions
diff --git a/include/__bit_reference b/include/__bit_reference index 9aea96145284..3e4a21d261ff 100644 --- a/include/__bit_reference +++ b/include/__bit_reference @@ -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 diff --git a/include/__config b/include/__config index 32e542bd1fd7..212a2d53136b 100644 --- a/include/__config +++ b/include/__config @@ -220,10 +220,12 @@ #endif // __NetBSD__ #if defined(_WIN32) -# define _LIBCPP_WIN32API 1 +# define _LIBCPP_WIN32API # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 # define _LIBCPP_SHORT_WCHAR 1 +// Both MinGW and native MSVC provide a "MSVC"-like enviroment +# define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only. # ifndef __MINGW32__ # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library @@ -1205,4 +1207,34 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #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 diff --git a/include/__hash_table b/include/__hash_table index acdc443a640a..79336ff793ec 100644 --- a/include/__hash_table +++ b/include/__hash_table @@ -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>::__subscriptable(const const_iterator*, } #endif // _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP__HASH_TABLE diff --git a/include/__locale b/include/__locale index cf3ba23b9092..766842294ca3 100644 --- a/include/__locale +++ b/include/__locale @@ -19,7 +19,7 @@ #include <cstdint> #include <cctype> #include <locale.h> -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#if defined(_LIBCPP_MSVCRT_LIKE) # include <support/win32/locale_win32.h> #elif defined(_AIX) # include <support/ibm/xlocale.h> @@ -367,7 +367,7 @@ public: static const mask punct = _ISpunct; static const mask xdigit = _ISxdigit; static const mask blank = _ISblank; -#elif defined(_LIBCPP_MSVCRT) +#elif defined(_LIBCPP_MSVCRT_LIKE) typedef unsigned short mask; static const mask space = _SPACE; static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; diff --git a/include/__mutex_base b/include/__mutex_base index 7f5e2ea2810e..159acd626618 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -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<mutex>& __lk, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MUTEX_BASE diff --git a/include/__split_buffer b/include/__split_buffer index 72073f024cd2..1daa4e5ada3d 100644 --- a/include/__split_buffer +++ b/include/__split_buffer @@ -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, __split_buffer<_Tp, _Allocator>& __y) __x.swap(__y); } - _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_SPLIT_BUFFER diff --git a/include/__std_stream b/include/__std_stream index fb5a346f10d8..db90795f66fc 100644 --- a/include/__std_stream +++ b/include/__std_stream @@ -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& __loc) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___STD_STREAM diff --git a/include/__string b/include/__string index 75608cea71d9..d30c7fddc8d6 100644 --- a/include/__string +++ b/include/__string @@ -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 diff --git a/include/__threading_support b/include/__threading_support index afd7cb506492..5d4c907966ee 100644 --- a/include/__threading_support +++ b/include/__threading_support @@ -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 __key, void *__p) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // !_LIBCPP_HAS_NO_THREADS #endif // _LIBCPP_THREADING_SUPPORT diff --git a/include/__tree b/include/__tree index 6771589bbc68..792870aa6ebc 100644 --- a/include/__tree +++ b/include/__tree @@ -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>& __x, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___TREE diff --git a/include/__undef_min_max b/include/__undef_macros index 71db3965e3cd..60ab1dbfb5f7 100644 --- a/include/__undef_min_max +++ b/include/__undef_macros @@ -1,13 +1,14 @@ // -*- C++ -*- -//===----------------------------------------------------------------------===// +//===------------------------ __undef_macros ------------------------------===// // // 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. +// 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) diff --git a/include/algorithm b/include/algorithm index 7ea4474a1bb4..9fe0361e577d 100644 --- a/include/algorithm +++ b/include/algorithm @@ -651,14 +651,16 @@ template <class BidirectionalIterator, class Compare> #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: @@ -2908,11 +2910,11 @@ struct __log2_imp<0, _Rp> static const size_t value = _Rp + 1; }; -template <class _UI, _UI _Xp> +template <class _UIntType, _UIntType _Xp> struct __log2 { static const size_t value = __log2_imp<_Xp, - sizeof(_UI) * __CHAR_BIT__ - 1>::value; + sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; }; template<class _Engine, class _UIntType> @@ -5904,4 +5906,6 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_ALGORITHM diff --git a/include/array b/include/array index 31f5501b9bc4..79f7e0d62c56 100644 --- a/include/array +++ b/include/array @@ -113,6 +113,8 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce #pragma GCC system_header #endif + + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, size_t _Size> diff --git a/include/bitset b/include/bitset index b49c93ce2224..583122fbfdab 100644 --- a/include/bitset +++ b/include/bitset @@ -113,10 +113,6 @@ template <size_t N> struct hash<std::bitset<N>>; */ -#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::bitset<N>>; #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>& __os, const bitset<_Size>& __x); _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_BITSET diff --git a/include/chrono b/include/chrono index 657808736d09..4b793c760559 100644 --- a/include/chrono +++ b/include/chrono @@ -305,12 +305,14 @@ constexpr chrono::duration<unspecified , nano> operator "" ns(long doub #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 into namespace std::chrono _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_CHRONO diff --git a/include/deque b/include/deque index bd4316412f60..f795b489edc6 100644 --- a/include/deque +++ b/include/deque @@ -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<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_DEQUE diff --git a/include/experimental/algorithm b/include/experimental/algorithm index b32d7ca66bd2..3801cae4f16e 100644 --- a/include/experimental/algorithm +++ b/include/experimental/algorithm @@ -39,17 +39,18 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last, #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(_PopulationIterator __first, _PopulationIterator __last, _LIBCPP_END_NAMESPACE_LFTS +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */ diff --git a/include/experimental/dynarray b/include/experimental/dynarray index f96a0e5fed38..16193317ad20 100644 --- a/include/experimental/dynarray +++ b/include/experimental/dynarray @@ -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 diff --git a/include/experimental/functional b/include/experimental/functional index 75fc8e99f352..a136cbb57c85 100644 --- a/include/experimental/functional +++ b/include/experimental/functional @@ -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( _RandomAccessIterator __f, _RandomAccessIter _LIBCPP_END_NAMESPACE_LFTS +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */ diff --git a/include/experimental/memory_resource b/include/experimental/memory_resource index 743f9cbe639c..d101f3e08113 100644 --- a/include/experimental/memory_resource +++ b/include/experimental/memory_resource @@ -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_adaptor_imp< _LIBCPP_END_NAMESPACE_LFTS_PMR +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */ diff --git a/include/experimental/numeric b/include/experimental/numeric index 6488a68eca6c..d784c08f0fe8 100644 --- a/include/experimental/numeric +++ b/include/experimental/numeric @@ -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 */ diff --git a/include/experimental/optional b/include/experimental/optional index 48adfbae5167..b251748fbf37 100644 --- a/include/experimental/optional +++ b/include/experimental/optional @@ -143,6 +143,21 @@ namespace std { namespace experimental { inline namespace fundamentals_v1 { #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 diff --git a/include/experimental/string_view b/include/experimental/string_view index 41c0d34d3c84..da104f9a1210 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view @@ -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_view <_CharT, _Traits> __sv, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LFTS_STRING_VIEW diff --git a/include/forward_list b/include/forward_list index e4ab41e38b11..8bfa9a084338 100644 --- a/include/forward_list +++ b/include/forward_list @@ -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, forward_list<_Tp, _Alloc>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_FORWARD_LIST diff --git a/include/fstream b/include/fstream index 5ec42bd13407..e41a53af4a0c 100644 --- a/include/fstream +++ b/include/fstream @@ -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 diff --git a/include/istream b/include/istream index 530f204cfad9..0b8e05d95bd8 100644 --- a/include/istream +++ b/include/istream @@ -162,12 +162,14 @@ template <class charT, class traits, class T> #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_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<ch _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_ISTREAM diff --git a/include/limits b/include/limits index 4755c57cf903..f530507f7246 100644 --- a/include/limits +++ b/include/limits @@ -102,15 +102,8 @@ template<> class numeric_limits<cv long double>; */ #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 double>; #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 @@ -182,14 +183,14 @@ protected: static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; }; -template <class _Tp, int digits, bool _IsSigned> +template <class _Tp, int __digits, bool _IsSigned> struct __libcpp_compute_min { - static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits); + static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits); }; -template <class _Tp, int digits> -struct __libcpp_compute_min<_Tp, digits, false> +template <class _Tp, int __digits> +struct __libcpp_compute_min<_Tp, __digits, false> { static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0); }; @@ -811,4 +812,6 @@ template <class _Tp> _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LIMITS diff --git a/include/list b/include/list index 5e76d1103371..20a66c36002d 100644 --- a/include/list +++ b/include/list @@ -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, _Alloc>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LIST diff --git a/include/locale b/include/locale index d29a2dc70a5b..6aaa22ccaa15 100644 --- a/include/locale +++ b/include/locale @@ -192,14 +192,7 @@ template <class charT> class messages_byname; #endif #include <cstdlib> #include <ctime> -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#include <support/win32/locale_win32.h> -#elif defined(_NEWLIB_VERSION) -// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an -// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html -// has had a chance to bake for a bit -#include <support/newlib/xlocale.h> -#endif +#include <cstdio> #ifdef _LIBCPP_HAS_CATOPEN #include <nl_types.h> #endif @@ -208,18 +201,20 @@ template <class charT> class messages_byname; #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 +4269,6 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LOCALE diff --git a/include/memory b/include/memory index 31dc73d8b142..711551d5732d 100644 --- a/include/memory +++ b/include/memory @@ -658,12 +658,14 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); # 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> @@ -1541,7 +1543,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits {return __a.allocate(__n);} _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) - {return allocate(__a, __n, __hint, + {return __allocate(__a, __n, __hint, __has_allocate_hint<allocator_type, size_type, const_void_pointer>());} _LIBCPP_INLINE_VISIBILITY @@ -1595,7 +1597,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits _LIBCPP_INLINE_VISIBILITY static allocator_type select_on_container_copy_construction(const allocator_type& __a) - {return select_on_container_copy_construction( + {return __select_on_container_copy_construction( __has_select_on_container_copy_construction<const allocator_type>(), __a);} @@ -1694,11 +1696,11 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits private: _LIBCPP_INLINE_VISIBILITY - static pointer allocate(allocator_type& __a, size_type __n, + static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer __hint, true_type) {return __a.allocate(__n, __hint);} _LIBCPP_INLINE_VISIBILITY - static pointer allocate(allocator_type& __a, size_type __n, + static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer, false_type) {return __a.allocate(__n);} @@ -1735,11 +1737,11 @@ private: _LIBCPP_INLINE_VISIBILITY static allocator_type - select_on_container_copy_construction(true_type, const allocator_type& __a) + __select_on_container_copy_construction(true_type, const allocator_type& __a) {return __a.select_on_container_copy_construction();} _LIBCPP_INLINE_VISIBILITY static allocator_type - select_on_container_copy_construction(false_type, const allocator_type& __a) + __select_on_container_copy_construction(false_type, const allocator_type& __a) {return __a;} }; @@ -3101,28 +3103,28 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< struct __destruct_n { private: - size_t size; + size_t __size_; template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT - {for (size_t __i = 0; __i < size; ++__i, ++__p) __p->~_Tp();} + {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT - {++size;} + {++__size_;} _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT - {size = __s;} + {__size_ = __s;} _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT {} public: _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT - : size(__s) {} + : __size_(__s) {} template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT @@ -5574,4 +5576,6 @@ struct __temp_value { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_MEMORY diff --git a/include/module.modulemap b/include/module.modulemap index 98b1870afcc1..3194b5c9f2a2 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -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 diff --git a/include/mutex b/include/mutex index 0b25614e8ead..55380882044d 100644 --- a/include/mutex +++ b/include/mutex @@ -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 _Callable& __func) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_MUTEX diff --git a/include/numeric b/include/numeric index 9c98cdbe262e..0e53ba33c3c7 100644 --- a/include/numeric +++ b/include/numeric @@ -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 diff --git a/include/optional b/include/optional index 70b6eb44dcd6..8c8ee76b1411 100644 --- a/include/optional +++ b/include/optional @@ -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 diff --git a/include/random b/include/random index 6c36e8c01ae2..ba8a088dfcb1 100644 --- a/include/random +++ b/include/random @@ -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 @@ -2013,41 +2015,41 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine; -template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> +template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> bool -operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); -template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> +template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, @@ -2129,44 +2131,44 @@ public: _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> friend bool - operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); - template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> friend bool - operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); private: @@ -2384,13 +2386,13 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, return __z ^ __rshift<__l>(__z); } -template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> +template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> bool -operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { if (__x.__i_ == __y.__i_) @@ -2428,26 +2430,26 @@ operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, __x.__x_ + (_Np - (__y.__i_ + __j))); } -template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> +template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { return !(__x == __y); } template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { __save_flags<_CharT, _Traits> __lx(__os); @@ -2463,17 +2465,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, - _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, - _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UI __t[_Np]; + _UInt __t[_Np]; for (size_t __i = 0; __i < _Np; ++__i) __is >> __t[__i]; if (!__is.fail()) @@ -2501,30 +2503,30 @@ typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, template<class _UIntType, size_t __w, size_t __s, size_t __r> class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine; -template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp> +template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> bool operator==( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); -template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp> +template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); template<class _UIntType, size_t __w, size_t __s, size_t __r> class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine @@ -2586,33 +2588,33 @@ public: _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> friend bool operator==( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); - template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> friend bool operator!=( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); private: @@ -2711,11 +2713,11 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() return __xr; } -template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp> +template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> bool operator==( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) { if (__x.__c_ != __y.__c_) return false; @@ -2754,21 +2756,21 @@ operator==( __x.__x_ + (_Rp - (__y.__i_ + __j))); } -template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp> +template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) { return !(__x == __y); } template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) { __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); @@ -2784,14 +2786,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template <class _CharT, class _Traits, - class _UI, size_t _Wp, size_t _Sp, size_t _Rp> + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) + subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) { __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UI __t[_Rp+1]; + _UInt __t[_Rp+1]; for (size_t __i = 0; __i < _Rp+1; ++__i) __is >> __t[__i]; if (!__is.fail()) @@ -2986,13 +2988,13 @@ typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48; template<class _Engine, size_t __w, class _UIntType> class _LIBCPP_TEMPLATE_VIS independent_bits_engine { - template <class _UI, _UI _R0, size_t _Wp, size_t _Mp> + template <class _UInt, _UInt _R0, size_t _Wp, size_t _Mp> class __get_n { - static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UI>::digits; + static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits; static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0); static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np; - static _LIBCPP_CONSTEXPR const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; + static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; public: static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np; }; @@ -3091,33 +3093,33 @@ public: _LIBCPP_INLINE_VISIBILITY const _Engine& base() const _NOEXCEPT {return __e_;} - template<class _Eng, size_t _Wp, class _UI> + template<class _Eng, size_t _Wp, class _UInt> friend bool operator==( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y); + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y); - template<class _Eng, size_t _Wp, class _UI> + template<class _Eng, size_t _Wp, class _UInt> friend bool operator!=( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y); + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y); template <class _CharT, class _Traits, - class _Eng, size_t _Wp, class _UI> + class _Eng, size_t _Wp, class _UInt> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _Wp, _UI>& __x); + const independent_bits_engine<_Eng, _Wp, _UInt>& __x); template <class _CharT, class _Traits, - class _Eng, size_t _Wp, class _UI> + class _Eng, size_t _Wp, class _UInt> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _Wp, _UI>& __x); + independent_bits_engine<_Eng, _Wp, _UInt>& __x); private: _LIBCPP_INLINE_VISIBILITY @@ -3179,40 +3181,40 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) return _Sp; } -template<class _Eng, size_t _Wp, class _UI> +template<class _Eng, size_t _Wp, class _UInt> inline _LIBCPP_INLINE_VISIBILITY bool operator==( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y) + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y) { return __x.base() == __y.base(); } -template<class _Eng, size_t _Wp, class _UI> +template<class _Eng, size_t _Wp, class _UInt> inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y) + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y) { return !(__x == __y); } template <class _CharT, class _Traits, - class _Eng, size_t _Wp, class _UI> + class _Eng, size_t _Wp, class _UInt> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _Wp, _UI>& __x) + const independent_bits_engine<_Eng, _Wp, _UInt>& __x) { return __os << __x.base(); } template <class _CharT, class _Traits, - class _Eng, size_t _Wp, class _UI> + class _Eng, size_t _Wp, class _UInt> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _Wp, _UI>& __x) + independent_bits_engine<_Eng, _Wp, _UInt>& __x) { _Eng __e; __is >> __e; @@ -6736,4 +6738,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_RANDOM diff --git a/include/ratio b/include/ratio index fa893637d51d..27aa0ded32e6 100644 --- a/include/ratio +++ b/include/ratio @@ -83,12 +83,14 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported #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_CONSTEXPR bool ratio_greater_equal_v _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_RATIO diff --git a/include/regex b/include/regex index 0f49b95a6561..443c2e303465 100644 --- a/include/regex +++ b/include/regex @@ -765,12 +765,14 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #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 diff --git a/include/shared_mutex b/include/shared_mutex index ff36ee6ac67d..9cb81528cd9d 100644 --- a/include/shared_mutex +++ b/include/shared_mutex @@ -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 diff --git a/include/sstream b/include/sstream index 411374207b4a..b9903f961823 100644 --- a/include/sstream +++ b/include/sstream @@ -175,12 +175,14 @@ typedef basic_stringstream<wchar_t> wstringstream; #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, _Allocator>::str(const string_type& __s) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_SSTREAM diff --git a/include/stdexcept b/include/stdexcept index d501d0916085..95a96cc07678 100644 --- a/include/stdexcept +++ b/include/stdexcept @@ -61,9 +61,9 @@ class _LIBCPP_HIDDEN __libcpp_refstring bool __uses_refcount() const; public: - explicit __libcpp_refstring(const char* msg); - __libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT; - __libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT; + explicit __libcpp_refstring(const char* __msg); + __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT; + __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT; ~__libcpp_refstring(); const char* c_str() const _NOEXCEPT {return __imp_;} diff --git a/include/stdio.h b/include/stdio.h index dc534970f9d8..f12417640164 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -110,10 +110,9 @@ void perror(const char* s); #ifdef __cplusplus // snprintf -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) extern "C" { int vasprintf(char **sptr, const char *__restrict fmt, va_list ap); -int asprintf(char **sptr, const char *__restrict fmt, ...); } #endif diff --git a/include/streambuf b/include/streambuf index 12eded5c4d31..a10ce1bf5636 100644 --- a/include/streambuf +++ b/include/streambuf @@ -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_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_STEAMBUF diff --git a/include/string b/include/string index af028a023c29..accf1ce27716 100644 --- a/include/string +++ b/include/string @@ -484,14 +484,16 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1 #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 @@ -899,7 +901,7 @@ public: void resize(size_type __n, value_type __c); _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());} - void reserve(size_type res_arg = 0); + void reserve(size_type __res_arg = 0); _LIBCPP_INLINE_VISIBILITY void shrink_to_fit() _NOEXCEPT {reserve();} _LIBCPP_INLINE_VISIBILITY @@ -985,9 +987,9 @@ public: basic_string& assign(const basic_string& __str) { return *this = __str; } #ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY - basic_string& assign(basic_string&& str) + basic_string& assign(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) - {*this = _VSTD::move(str); return *this;} + {*this = _VSTD::move(__str); return *this;} #endif basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); template <class _Tp> @@ -997,7 +999,7 @@ public: __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type - assign(const _Tp & __t, size_type pos, size_type n=npos); + assign(const _Tp & __t, size_type __pos, size_type __n=npos); basic_string& assign(const value_type* __s, size_type __n); basic_string& assign(const value_type* __s); basic_string& assign(size_type __n, value_type __c); @@ -4041,4 +4043,6 @@ _LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_STRING diff --git a/include/string_view b/include/string_view index e59f099f16e7..4c759ab5daea 100644 --- a/include/string_view +++ b/include/string_view @@ -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> > @@ -353,9 +356,9 @@ public: _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare( size_type __pos1, size_type __n1, - basic_string_view _sv, size_type __pos2, size_type __n2) const + basic_string_view __sv, size_type __pos2, size_type __n2) const { - return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); + return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); } _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -784,4 +787,6 @@ inline namespace literals #endif _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_STRING_VIEW diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h index 7a6c44ca9003..b2b3ac4c799b 100644 --- a/include/support/win32/locale_win32.h +++ b/include/support/win32/locale_win32.h @@ -52,20 +52,21 @@ size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc); wint_t btowc_l( int c, locale_t loc ); int wctob_l( wint_t c, locale_t loc ); -inline _LIBCPP_ALWAYS_INLINE -decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) -{ - return ___mb_cur_max_l_func(__l); -} + +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+ #define mbtowc_l _mbtowc_l #define strtoll_l _strtoi64_l #define strtoull_l _strtoui64_l -#define strtof_l _strtof_l #define strtod_l _strtod_l +#if defined(_LIBCPP_MSVCRT) +#define strtof_l _strtof_l #define strtold_l _strtold_l - +#else +float strtof_l(const char*, char**, locale_t); +long double strtold_l(const char*, char**, locale_t); +#endif inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, _locale_t loc) diff --git a/include/thread b/include/thread index 360b43d5e555..1b8dca394aa4 100644 --- a/include/thread +++ b/include/thread @@ -105,6 +105,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #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 diff --git a/include/tuple b/include/tuple index b869b861cce0..aa4713faf06f 100644 --- a/include/tuple +++ b/include/tuple @@ -169,7 +169,7 @@ void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) template <size_t _Ip, class _Hp, bool> class __tuple_leaf { - _Hp value; + _Hp __value_; template <class _Tp> static constexpr bool __can_bind_reference() { @@ -188,28 +188,28 @@ class __tuple_leaf __tuple_leaf& operator=(const __tuple_leaf&); public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() - _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value() + _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Alloc> _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant<int, 0>, const _Alloc&) - : value() + : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Alloc> _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a) - : value(allocator_arg_t(), __a) + : __value_(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Alloc> _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) - : value(__a) + : __value_(__a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} @@ -223,28 +223,28 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) - : value(_VSTD::forward<_Tp>(__t)) + : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template <class _Tp, class _Alloc> _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) - : value(_VSTD::forward<_Tp>(__t)) + : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template <class _Tp, class _Alloc> _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) - : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) + : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template <class _Tp, class _Alloc> _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) - : value(_VSTD::forward<_Tp>(__t), __a) + : __value_(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} @@ -256,7 +256,7 @@ public: __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { - value = _VSTD::forward<_Tp>(__t); + __value_ = _VSTD::forward<_Tp>(__t); return *this; } @@ -267,8 +267,8 @@ public: return 0; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return value;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} }; template <size_t _Ip, class _Hp> @@ -473,9 +473,9 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. template <class ..._Tp> class _LIBCPP_TEMPLATE_VIS tuple { - typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base; + typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT; - base base_; + _BaseT __base_; #if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION) static constexpr bool _EnableImplicitReducedArityExtension = true; @@ -628,7 +628,7 @@ public: >::type> _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), __tuple_types<_Tp...>()) {} @@ -644,7 +644,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) - : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), + : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types<tuple, 0>::type(), @@ -662,7 +662,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) - : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), + : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types<tuple, 0>::type(), @@ -680,7 +680,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), @@ -700,7 +700,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), @@ -727,7 +727,7 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible<base, + is_nothrow_constructible<_BaseT, typename __make_tuple_indices<sizeof...(_Up)>::type, typename __make_tuple_types<tuple, sizeof...(_Up)>::type, typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type, @@ -735,7 +735,7 @@ public: _Up... >::value )) - : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), + : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), @@ -760,7 +760,7 @@ public: explicit tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible<base, + is_nothrow_constructible<_BaseT, typename __make_tuple_indices<sizeof...(_Up)>::type, typename __make_tuple_types<tuple, sizeof...(_Up)>::type, typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type, @@ -768,7 +768,7 @@ public: _Up... >::value )) - : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), + : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), @@ -786,7 +786,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), @@ -806,7 +806,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), @@ -824,8 +824,8 @@ public: >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value)) - : base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) + : __base_(_VSTD::forward<_Tuple>(__t)) {} template <class _Tuple, typename enable_if @@ -839,8 +839,8 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value)) - : base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) + : __base_(_VSTD::forward<_Tuple>(__t)) {} template <class _Alloc, class _Tuple, typename enable_if @@ -853,7 +853,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) - : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} + : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} template <class _Alloc, class _Tuple, typename enable_if @@ -867,7 +867,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) - : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} + : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all<is_copy_assignable<_Tp>::value...>; using _CanMoveAssign = __all<is_move_assignable<_Tp>::value...>; @@ -876,7 +876,7 @@ public: tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value)) { - base_.operator=(__t.base_); + __base_.operator=(__t.__base_); return *this; } @@ -884,7 +884,7 @@ public: tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) _NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value)) { - base_.operator=(static_cast<base&&>(__t.base_)); + __base_.operator=(static_cast<_BaseT&&>(__t.__base_)); return *this; } @@ -896,15 +896,15 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple& - operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value)) + operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value)) { - base_.operator=(_VSTD::forward<_Tuple>(__t)); + __base_.operator=(_VSTD::forward<_Tuple>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) - {base_.swap(__t.base_);} + {__base_.swap(__t.__base_);} }; template <> @@ -948,7 +948,7 @@ typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; - return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get(); + return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template <size_t _Ip, class ..._Tp> @@ -957,7 +957,7 @@ const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; - return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get(); + return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template <size_t _Ip, class ..._Tp> @@ -967,7 +967,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<type&&>( - static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get()); + static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template <size_t _Ip, class ..._Tp> @@ -977,7 +977,7 @@ get(const tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<const type&&>( - static_cast<const __tuple_leaf<_Ip, type>&&>(__t.base_).get()); + static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } #if _LIBCPP_STD_VER > 11 diff --git a/include/valarray b/include/valarray index f8e19acdb719..ee61238a932f 100644 --- a/include/valarray +++ b/include/valarray @@ -347,12 +347,14 @@ template <class T> unspecified2 end(const valarray<T>& v); #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 diff --git a/include/vector b/include/vector index 6759dbd8a584..ee19fb7081a2 100644 --- a/include/vector +++ b/include/vector @@ -275,14 +275,16 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& 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 <bool> @@ -3357,4 +3359,6 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_VECTOR diff --git a/include/wchar.h b/include/wchar.h index 25a318faff25..a5666e193a5b 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -166,7 +166,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD } #endif -#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT) +#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE) extern "C" { size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, size_t nmc, size_t len, mbstate_t *__restrict ps); |