diff --git a/appveyor-reqs-install.cmd b/appveyor-reqs-install.cmd index 3a2087af51fe..e5b30cf43f3a 100644 --- a/appveyor-reqs-install.cmd +++ b/appveyor-reqs-install.cmd @@ -9,7 +9,7 @@ cd C:\projects\deps :: Setup Compiler ::########################################################################### if NOT EXIST llvm-installer.exe ( - appveyor DownloadFile http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r301646-win32.exe -FileName llvm-installer.exe + appveyor DownloadFile http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r303050-win32.exe -FileName llvm-installer.exe ) if "%CLANG_VERSION%"=="ToT" ( START /WAIT llvm-installer.exe /S /D=C:\"Program Files\LLVM" 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 -#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 __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,17 +20,18 @@ #include #include -#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 union __hash_value_type; @@ -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 #include #include -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#if defined(_LIBCPP_MSVCRT_LIKE) # include #elif defined(_AIX) # include @@ -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 #include #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& __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 #include -#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 @@ -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 -#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; #include // For EOF. #include // 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 #include #include -#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 #include -#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 __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 similarity index 81% rename from include/__undef_min_max rename to 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 #include #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, but can't because: @@ -2908,11 +2910,11 @@ struct __log2_imp<0, _Rp> static const size_t value = _Rp + 1; }; -template +template struct __log2 { static const size_t value = __log2_imp<_Xp, - sizeof(_UI) * __CHAR_BIT__ - 1>::value; + sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; }; template @@ -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 const T&& get(const array&&) noexce #pragma GCC system_header #endif + + _LIBCPP_BEGIN_NAMESPACE_STD template diff --git a/include/bitset b/include/bitset index b49c93ce2224..583122fbfdab 100644 --- a/include/bitset +++ b/include/bitset @@ -113,10 +113,6 @@ template struct hash>; */ -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #include <__config> #include <__bit_reference> #include @@ -126,7 +122,13 @@ template struct hash>; #include #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 operator "" ns(long doub #include #include -#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 */ -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #include <__config> #include <__split_buffer> #include @@ -162,7 +158,13 @@ template #include #include -#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 #include -#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 _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 @@ -295,5 +298,7 @@ template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _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 #include - #include #include #include #include #include -#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 #include #include +#if _LIBCPP_STD_VER > 11 +#include +#include +#include +#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 -#include -#include -#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 > @@ -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 */ #include <__config> - #include #include #include #include #include -#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 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 wfstream; #include <__locale> #include -#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 @@ -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 #include <__config> #include -#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 @@ -1683,4 +1685,6 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream class numeric_limits; */ #include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #include -#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; #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 +template 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 -struct __libcpp_compute_min<_Tp, digits, false> +template +struct __libcpp_compute_min<_Tp, __digits, false> { static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0); }; @@ -811,4 +812,6 @@ template _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 #include #include -#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 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 messages_byname; #endif #include #include -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#include -#elif defined(_NEWLIB_VERSION) -// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an -// include of once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html -// has had a chance to bake for a bit -#include -#endif +#include #ifdef _LIBCPP_HAS_CATOPEN #include #endif @@ -208,18 +201,20 @@ template class messages_byname; #include #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 #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 @@ -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());} _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(), __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 _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 _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 _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 #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 #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -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 #include #include @@ -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 #include -#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 _LIBCPP_TEMPLATE_VIS mersenne_twister_engine; -template +template 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 +template _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 _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 _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 + template 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 + template 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 _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 _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 +template 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 +template 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 _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 _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 class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine; -template +template 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 +template _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 _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 _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 _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 + template 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 + template 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 _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 _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 +template 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 +template 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 _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 _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; template class _LIBCPP_TEMPLATE_VIS independent_bits_engine { - template + template 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 + template 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 + template 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 _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 _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 +template 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 +template 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 _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 _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 #include -#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 _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 wsregex_token_iterator; #include #include -#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 #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 wstringstream; #include #include -#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 @@ -486,4 +489,6 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios operator "" s( const char32_t *str, size_t len ); // C++1 #include #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 @@ -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+, allocator - #include <__string> #include #include @@ -178,6 +177,10 @@ namespace std { #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template > @@ -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& 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 class __tuple_leaf { - _Hp value; + _Hp __value_; template 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 _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) - : value() + : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, 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 _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, 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 _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, 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 _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, 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 _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, 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 @@ -473,9 +473,9 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. template class _LIBCPP_TEMPLATE_VIS tuple { - typedef __tuple_impl::type, _Tp...> base; + typedef __tuple_impl::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::type(), __tuple_types<_Tp...>()) {} @@ -644,7 +644,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), @@ -662,7 +662,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::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::type(), typename __make_tuple_types::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::type(), typename __make_tuple_types::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::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, @@ -735,7 +735,7 @@ public: _Up... >::value )) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), @@ -760,7 +760,7 @@ public: explicit tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, @@ -768,7 +768,7 @@ public: _Up... >::value )) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::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::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::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::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -824,8 +824,8 @@ public: >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) - : base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) + : __base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) - : base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) + : __base_(_VSTD::forward<_Tuple>(__t)) {} template _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 (__t)) {} + : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all::value...>; using _CanMoveAssign = __all::value...>; @@ -876,7 +876,7 @@ public: tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all::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::value...>::value)) { - base_.operator=(static_cast(__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::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 @@ -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&>(__t.base_).get(); + return static_cast&>(__t.__base_).get(); } template @@ -967,7 +967,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( - static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get()); + static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template @@ -977,7 +977,7 @@ get(const tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( - static_cast&&>(__t.base_).get()); + static_cast&&>(__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 unspecified2 end(const valarray& v); #include #include -#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 _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& x, vector& y) #include <__split_buffer> #include <__functional_base> -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -3357,4 +3359,6 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_VECTOR 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); diff --git a/src/chrono.cpp b/src/chrono.cpp index 9b277a610cd2..d0e184ad32fb 100644 --- a/src/chrono.cpp +++ b/src/chrono.cpp @@ -37,7 +37,7 @@ #if defined(_LIBCPP_WIN32API) #define WIN32_LEAN_AND_MEAN #define VC_EXTRA_LEAN -#include +#include #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 #include #endif diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index 3f607271b9eb..2200aefb804d 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -14,6 +14,7 @@ #include "condition_variable" #include "thread" #include "system_error" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/ios.cpp b/src/ios.cpp index 7c76ca258b26..0f1d88e378f5 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -22,6 +22,7 @@ #include "new" #include "streambuf" #include "string" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/locale.cpp b/src/locale.cpp index 4163c2c0af65..3d61fbede58a 100644 --- a/src/locale.cpp +++ b/src/locale.cpp @@ -36,6 +36,7 @@ #endif #include #include +#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. diff --git a/src/mutex.cpp b/src/mutex.cpp index b858e8877ae5..c36bd5549da8 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -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 diff --git a/src/new.cpp b/src/new.cpp index 21b30740196b..2b2682fa6617 100644 --- a/src/new.cpp +++ b/src/new.cpp @@ -183,7 +183,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC if (static_cast(alignment) < sizeof(void*)) alignment = std::align_val_t(sizeof(void*)); void* p; -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) #else while (::posix_memalign(&p, static_cast(alignment), size) != 0) @@ -256,7 +256,7 @@ void operator delete(void* ptr, std::align_val_t) _NOEXCEPT { if (ptr) -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) ::_aligned_free(ptr); #else ::free(ptr); diff --git a/src/strstream.cpp b/src/strstream.cpp index be94f9c89e83..01523cf45462 100644 --- a/src/strstream.cpp +++ b/src/strstream.cpp @@ -13,6 +13,7 @@ #include "cstring" #include "cstdlib" #include "__debug" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/support/win32/locale_win32.cpp b/src/support/win32/locale_win32.cpp index 28cb4491781f..13a6eaedacb2 100644 --- a/src/support/win32/locale_win32.cpp +++ b/src/support/win32/locale_win32.cpp @@ -34,6 +34,18 @@ locale_t uselocale( locale_t newloc ) // uselocale returns the old locale_t return old_locale; } + +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) +{ +#if defined(_LIBCPP_MSVCRT) + return ___mb_cur_max_l_func(__l); +#else + __libcpp_locale_guard __current(__l); + return MB_CUR_MAX; +#endif +} + + lconv *localeconv_l( locale_t loc ) { __libcpp_locale_guard __current(loc); @@ -109,3 +121,15 @@ int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ) __libcpp_locale_guard __current(loc); return vasprintf( ret, format, ap ); } + +#if !defined(_LIBCPP_MSVCRT) +float strtof_l(const char* nptr, char** endptr, locale_t loc) { + __libcpp_locale_guard __current(loc); + return strtof(nptr, endptr); +} + +long double strtold_l(const char* nptr, char** endptr, locale_t loc) { + __libcpp_locale_guard __current(loc); + return strtold(nptr, endptr); +} +#endif diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp index e989681a6d5f..dbd1c4c418aa 100644 --- a/src/support/win32/support.cpp +++ b/src/support/win32/support.cpp @@ -15,17 +15,6 @@ #include // strcpy, wcsncpy #include // mbstate_t -// Some of these functions aren't standard or if they conform, the name does not. - -int asprintf(char **sptr, const char *__restrict format, ...) -{ - va_list ap; - va_start(ap, format); - int result; - result = vasprintf(sptr, format, ap); - va_end(ap); - return result; -} // Like sprintf, but when return value >= 0 it returns // a pointer to a malloc'd string in *sptr. diff --git a/src/system_error.cpp b/src/system_error.cpp index cbbbb5dcd15c..17f2c9a5ba79 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -65,7 +65,7 @@ constexpr size_t strerror_buff_size = 1024; string do_strerror_r(int ev); -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) string do_strerror_r(int ev) { char buffer[strerror_buff_size]; if (::strerror_s(buffer, strerror_buff_size, ev) == 0) diff --git a/src/thread.cpp b/src/thread.cpp index 412a8fa0a620..550da8ea71f3 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -34,7 +34,7 @@ #if defined(_LIBCPP_WIN32API) #include -#endif // defined(_LIBCPP_WIN32API) +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp new file mode 100644 index 000000000000..bae4175b1d63 --- /dev/null +++ b/test/libcxx/min_max_macros.sh.cpp @@ -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 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 +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); + +// experimental headers +#if __cplusplus >= 201103L +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#endif // __cplusplus >= 201103L + +// extended headers +#include +TEST_MACROS(); +#include +TEST_MACROS(); diff --git a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp index c18822bbe811..76d5f0d679f6 100644 --- a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp +++ b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp @@ -34,7 +34,7 @@ int main() { // FIXME: The below warnings may get emitted as an error, a warning, or not emitted at all // depending on the flags used to compile this test. { - // expected-warning@tuple:* 0+ {{binding reference member 'value' to a temporary value}} - // expected-error@tuple:* 0+ {{binding reference member 'value' to a temporary value}} + // expected-warning@tuple:* 0+ {{binding reference member '__value_' to a temporary value}} + // expected-error@tuple:* 0+ {{binding reference member '__value_' to a temporary value}} } } diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp index a744f56eb811..30081fc3ada3 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp index 05c3f230e5ca..278ea9d0660a 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp index 7b3bcc394c8c..e92adf033232 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp similarity index 93% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp index 48c3ca50cbf1..74a9e7bda04e 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp similarity index 94% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp index 9e7fb5b2f687..0cd3d05c2de0 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp similarity index 94% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp index 961253fb7ca5..be5174dd3439 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp similarity index 94% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp index 7258f93905f3..aba5eb66314e 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp similarity index 94% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp index 26a45b033ff5..636d5da4ec6c 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp index 5f66b3e11314..34223296231c 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp similarity index 93% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp index b38d7871be4b..4a61047a830a 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp index 9cc0d1d72bf7..df3337c4cc01 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp index b5ff187a49ce..21c05e2be9a4 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp similarity index 94% rename from test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp index 945304a4673d..844d34cc4896 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp index c1d3b818d403..e26f333aa407 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp index 1987f68e70ab..b10e72082c7a 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include @@ -70,4 +66,8 @@ int main() static_assert(std::is_trivially_copyable::value, ""); static_assert(check_suspend_constexpr(), ""); } + { + // suppress unused warnings for the global constexpr test variable + ((void)constexpr_sa); + } } diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.sh.cpp rename to test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp index 72e0ac024558..9c2f392381f2 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include @@ -72,4 +68,8 @@ int main() static_assert(std::is_trivially_copyable::value, ""); static_assert(check_suspend_constexpr(), ""); } + { + // suppress unused warnings for the global constexpr test variable + ((void)constexpr_sn); + } } diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/end.to.end/await_result.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp index cca875d1a6ba..769a825df001 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include @@ -58,6 +54,7 @@ coro_t f(int n) { co_return; } int val = co_await A{}; + ((void)val); set_value(42); } diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp similarity index 91% rename from test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp index e51ac67f0fef..9c3becffc0ac 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp @@ -9,13 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// FIXME: When run under UBSAN this test hits an assertion inside Clang -// XFAIL: ubsan - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/expected.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/end.to.end/expected.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp index b6832b0c1886..77070cc5a3b0 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/expected.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp similarity index 95% rename from test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp index c7e34fe919e1..20bcf60fbf00 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include @@ -67,6 +63,7 @@ coro2 a() { assert(alive == 1); assert(ctor_called == 1); assert(dtor_called == 0); + ((void)x); } assert(alive == 0); assert(dtor_called == 1); @@ -75,7 +72,7 @@ coro2 a() { coro2 b() { reset(); { - co_await Bug{}; + (void)(co_await Bug{}); assert(ctor_called == 1); assert(dtor_called == 1); assert(alive == 0); @@ -102,7 +99,7 @@ coro2 c() { coro2 d() { reset(); { - co_yield 42; + (void)(co_yield 42); assert(ctor_called == 1); assert(dtor_called == 1); assert(alive == 0); diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/generator.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp similarity index 92% rename from test/std/experimental/language.support/support.coroutines/end.to.end/generator.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp index 4681793ed814..9200fae91576 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/generator.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp @@ -9,13 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// FIXME: When run under UBSAN this test hits an assertion inside Clang -// XFAIL: ubsan - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/go.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/end.to.end/go.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp index e0d69104fdaf..1fdf2c8558eb 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/go.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include @@ -166,9 +162,7 @@ goroutine pusher(channel& left, channel& right) } } -const int N = 100; //100'000'000; -const int repeat = 1; - +const int N = 100; channel* c = new channel[N + 1]; int main() { diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp index e13196c253ea..e3c96530335d 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.sh.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp similarity index 96% rename from test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.sh.cpp rename to test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp index 9c94f73b2a70..d5f2c40e2a79 100644 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run #include #include diff --git a/test/std/experimental/language.support/support.coroutines/includes.sh.cpp b/test/std/experimental/language.support/support.coroutines/includes.pass.cpp similarity index 90% rename from test/std/experimental/language.support/support.coroutines/includes.sh.cpp rename to test/std/experimental/language.support/support.coroutines/includes.pass.cpp index f9d8a572256c..b30d8c7ed24f 100644 --- a/test/std/experimental/language.support/support.coroutines/includes.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/includes.pass.cpp @@ -9,10 +9,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run // @@ -20,8 +16,6 @@ #include - - int main(){ // std::nothrow is not implicitly defined by the compiler when the include is // missing, unlike other parts of . Therefore we use std::nothrow to diff --git a/test/support/nasty_macros.hpp b/test/support/nasty_macros.hpp index f6c8aaddbea6..ff141f7954c8 100644 --- a/test/support/nasty_macros.hpp +++ b/test/support/nasty_macros.hpp @@ -37,6 +37,14 @@ #define _Y NASTY_MACRO #define _Z NASTY_MACRO +// tchar.h defines these macros on Windows. +#define _UI NASTY_MACRO +#define _PUC NASTY_MACRO +#define _CPUC NASTY_MACRO +#define _PC NASTY_MACRO +#define _CRPC NASTY_MACRO +#define _CPC NASTY_MACRO + // Test that libc++ doesn't use names reserved by WIN32 API Macros. // NOTE: Obviously we can only define these on non-windows platforms. #ifndef _WIN32 diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 637686284ed2..cc2918a0875a 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -195,7 +195,7 @@ struct is_same { enum {value = 1}; }; #define ASSERT_SAME_TYPE(...) \ static_assert((test_macros_detail::is_same<__VA_ARGS__>::value), \ - "Types differ uexpectedly") + "Types differ unexpectedly") #ifndef TEST_HAS_NO_EXCEPTIONS #define TEST_THROW(...) throw __VA_ARGS__ diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 1bf2677a8509..0fbc2cf4ea62 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -484,9 +484,13 @@ def configure_compile_flags(self): # Configure extra flags compile_flags_str = self.get_lit_conf('compile_flags', '') self.cxx.compile_flags += shlex.split(compile_flags_str) - # FIXME: Can we remove this? if self.is_windows: + # FIXME: Can we remove this? self.cxx.compile_flags += ['-D_CRT_SECURE_NO_WARNINGS'] + # Required so that tests using min/max don't fail on Windows, + # and so that those tests don't have to be changed to tolerate + # this insanity. + self.cxx.compile_flags += ['-DNOMINMAX'] def configure_default_compile_flags(self): # Try and get the std version from the command line. Fall back to