diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-20 21:21:10 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-20 21:21:10 +0000 |
commit | 1c3313bd0215c89fb38710a1ea0762ccf32e859c (patch) | |
tree | 65e6d33ca6254b41a8f4230edff47c5344dbd019 | |
parent | 0dc0969cd0a732760f0aa79942a04e0eaef297c4 (diff) |
Vendor import of libc++ trunk r300890:vendor/libc++/libc++-trunk-r300890
Notes
Notes:
svn path=/vendor/libc++/dist/; revision=317224
svn path=/vendor/libc++/libc++-trunk-r300890/; revision=317225; tag=vendor/libc++/libc++-trunk-r300890
356 files changed, 2947 insertions, 2096 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e2ee1e52d2e6..d3bd533396b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,12 @@ option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." O option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) -option(LIBCXX_ENABLE_FILESYSTEM - "Build filesystem as part of libc++experimental.a" ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) +set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) +if (WIN32) + set(ENABLE_FILESYSTEM_DEFAULT OFF) +endif() +option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++experimental.a" + ${ENABLE_FILESYSTEM_DEFAULT}) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) # Benchmark options ----------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000000..3cb2ce6f6bab --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,97 @@ +version: '{build}' + +shallow_clone: true + +os: + - Visual Studio 2015 + +build: + verbosity: detailed + +branches: + only: + - master + +configuration: + - Debug + +environment: + matrix: + - COMPILER: Clang-CL 4.0 + +install: + ############################################################################ + # All external dependencies are installed in C:\projects\deps + ############################################################################ + - mkdir C:\projects\deps + - cd C:\projects\deps + + ############################################################################ + # Install Ninja + ############################################################################ + - set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip" + - appveyor DownloadFile %NINJA_URL% -FileName ninja.zip + - 7z x ninja.zip -oC:\projects\deps\ninja > nul + - set PATH=C:\projects\deps\ninja;%PATH% + - ninja --version + + ############################################################################ + # Install a recent CMake + ############################################################################ + - set CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip" + - appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip + - 7z x cmake.zip -oC:\projects\deps > nul + - move C:\projects\deps\cmake-* C:\projects\deps\cmake # Move to a version-agnostic directory + - set PATH=C:\projects\deps\cmake\bin;%PATH% + - cmake --version + + ############################################################################ + # Setup the path to Clang-cl + ############################################################################ + - set PATH="C:\Program Files\LLVM\bin";%PATH% + - clang-cl -v + + ############################################################################ + # Setup the cached copy of LLVM + ############################################################################ + - if exist llvm (git -C llvm pull --rebase=true --ff-only) + - if not exist llvm (git clone --depth=1 http://llvm.org/git/llvm.git) + + +before_build: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 + - cd C:\projects\libcxx + +build_script: + - md C:\projects\build-libcxx + - cd C:\projects\build-libcxx + - echo %configuration% + + ############################################################################# + # Configuration Step + ############################################################################# + - cmake -G Ninja %extra_cmake_flags% + -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe + "-DCMAKE_BUILD_TYPE=%configuration%" + "-DLLVM_PATH=C:\projects\deps\llvm" -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF + -DLLVM_LIT_ARGS="-sv --no-progress-bar --show-xfail --show-unsupported" + C:\projects\libcxx + + ############################################################################# + # Build Step + ############################################################################# + - ninja + +test_script: + - ninja check-cxx + +on_failure: + - appveyor PushArtifact CMakeFiles/CMakeOutput.log + - appveyor PushArtifact CMakeFiles/CMakeError.log + +artifacts: + - path: '_build/CMakeFiles/*.log' + name: logs + +cache: + - C:\projects\deps\llvm diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index a4105be08340..8211ebd009a7 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -63,7 +63,7 @@ endif() # Benchmark tests configuration #============================================================================== add_custom_target(cxx-benchmarks) - +set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx) set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native) set(BENCHMARK_TEST_COMPILE_FLAGS @@ -111,6 +111,7 @@ macro(add_benchmark_test name source_file) set_target_properties(${libcxx_target} PROPERTIES OUTPUT_NAME "${name}.libcxx.out" + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" COMPILE_FLAGS "${BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_LIBCXX_LINK_FLAGS}") if (LIBCXX_BENCHMARK_NATIVE_STDLIB) @@ -131,6 +132,7 @@ macro(add_benchmark_test name source_file) set_target_properties(${native_target} PROPERTIES OUTPUT_NAME "${name}.native.out" + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" INCLUDE_DIRECTORIES "" COMPILE_FLAGS "${BENCHMARK_TEST_NATIVE_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_NATIVE_LINK_FLAGS}") diff --git a/include/__functional_base b/include/__functional_base index 4e2b7eb8d289..0d2c2fc65015 100644 --- a/include/__functional_base +++ b/include/__functional_base @@ -251,7 +251,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> }; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // 3 or more arguments template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> @@ -296,10 +296,6 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> typedef _Rp result_type; }; -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_CXX03_LANG - template <class _Tp, class ..._Args> struct __invoke_return { @@ -316,7 +312,7 @@ struct __invoke_return template <class _Ret> struct __invoke_void_return_wrapper { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class ..._Args> static _Ret __call(_Args&&... __args) { return __invoke(_VSTD::forward<_Args>(__args)...); @@ -347,7 +343,7 @@ struct __invoke_void_return_wrapper template <> struct __invoke_void_return_wrapper<void> { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class ..._Args> static void __call(_Args&&... __args) { __invoke(_VSTD::forward<_Args>(__args)...); @@ -389,7 +385,7 @@ public: // construct/copy/destroy _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(_VSTD::addressof(__f)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG private: reference_wrapper(type&&); public: // = delete; // do not bind to temps #endif @@ -397,7 +393,7 @@ public: _LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;} _LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;} -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // invoke template <class... _ArgTypes> _LIBCPP_INLINE_VISIBILITY @@ -510,7 +506,7 @@ public: operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { return __invoke(get(), __a0, __a1, __a2); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG }; @@ -568,7 +564,7 @@ public: struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY) extern const allocator_arg_t allocator_arg; #else constexpr allocator_arg_t allocator_arg = allocator_arg_t(); @@ -611,7 +607,7 @@ template <class _Tp, class _Alloc> constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; #endif -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // allocator construction @@ -663,7 +659,7 @@ void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __storage, __a, _VSTD::forward<_Args>(__args)... ); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD diff --git a/include/__hash_table b/include/__hash_table index a20cbb8ed08b..acdc443a640a 100644 --- a/include/__hash_table +++ b/include/__hash_table @@ -798,8 +798,7 @@ public: _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) : __data_(__size, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __bucket_list_deallocator(__bucket_list_deallocator&& __x) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) @@ -807,8 +806,7 @@ public: { __x.size() = 0; } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif _LIBCPP_INLINE_VISIBILITY size_type& size() _NOEXCEPT {return __data_.first();} diff --git a/include/__mutex_base b/include/__mutex_base index 4940f931c97f..a6d5e79c4c86 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -34,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; #else __libcpp_mutex_t __m_; @@ -42,7 +42,7 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG constexpr mutex() _NOEXCEPT = default; #else mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;} @@ -66,7 +66,7 @@ struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; struct _LIBCPP_TYPE_VIS adopt_lock_t {}; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX) extern const defer_lock_t defer_lock; extern const try_to_lock_t try_to_lock; @@ -150,7 +150,7 @@ private: unique_lock& operator=(unique_lock const&); // = delete; public: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) @@ -167,7 +167,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG void lock(); bool try_lock(); @@ -279,7 +279,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) class _LIBCPP_TYPE_VIS condition_variable { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; #else __libcpp_condvar_t __cv_; @@ -287,7 +287,7 @@ class _LIBCPP_TYPE_VIS condition_variable public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG constexpr condition_variable() _NOEXCEPT = default; #else condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;} diff --git a/include/__split_buffer b/include/__split_buffer index e74cf1f3b772..72073f024cd2 100644 --- a/include/__split_buffer +++ b/include/__split_buffer @@ -66,7 +66,7 @@ public: __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); ~__split_buffer(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG __split_buffer(__split_buffer&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); @@ -74,7 +74,7 @@ public: _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value) || !__alloc_traits::propagate_on_container_move_assignment::value); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} @@ -99,14 +99,12 @@ public: void shrink_to_fit() _NOEXCEPT; void push_front(const_reference __x); _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#ifndef _LIBCPP_CXX03_LANG void push_front(value_type&& __x); void push_back(value_type&& __x); -#if !defined(_LIBCPP_HAS_NO_VARIADICS) template <class... _Args> void emplace_back(_Args&&... __args); -#endif // !defined(_LIBCPP_HAS_NO_VARIADICS) -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#endif // !defined(_LIBCPP_CXX03_LANG) _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} @@ -343,7 +341,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer() __alloc_traits::deallocate(__alloc(), __first_, capacity()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) @@ -405,7 +403,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> void @@ -492,7 +490,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) --__begin_; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> void @@ -524,7 +522,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) --__begin_; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -556,7 +554,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) ++__end_; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> void @@ -588,8 +586,6 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) ++__end_; } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template <class _Tp, class _Allocator> template <class... _Args> void @@ -621,9 +617,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) ++__end_; } -#endif // _LIBCPP_HAS_NO_VARIADICS - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/__tree b/include/__tree index 2161c6cb79d1..6771589bbc68 100644 --- a/include/__tree +++ b/include/__tree @@ -1105,7 +1105,7 @@ public: void __assign_unique(_InputIterator __first, _InputIterator __last); template <class _InputIterator> void __assign_multi(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG __tree(__tree&& __t) _NOEXCEPT_( is_nothrow_move_constructible<__node_allocator>::value && @@ -1116,7 +1116,7 @@ public: __node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<value_compare>::value && is_nothrow_move_assignable<__node_allocator>::value); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG ~__tree(); @@ -1675,7 +1675,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) __begin_node() = __end_node(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) @@ -1805,7 +1805,7 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::~__tree() diff --git a/include/__tuple b/include/__tuple index 4193d2cfffb7..69d6ee961113 100644 --- a/include/__tuple +++ b/include/__tuple @@ -85,7 +85,7 @@ template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_li // tuple specializations -#if !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template <size_t...> struct __tuple_indices {}; @@ -189,7 +189,8 @@ template <size_t _Ip, class ..._Tp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&&) _NOEXCEPT; -#endif + +#endif // !defined(_LIBCPP_CXX03_LANG) // pair specializations @@ -205,7 +206,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) _NOEXCEPT; -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#ifndef _LIBCPP_CXX03_LANG template <size_t _Ip, class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& @@ -233,7 +234,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#ifndef _LIBCPP_CXX03_LANG template <size_t _Ip, class _Tp, size_t _Size> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp&& @@ -245,8 +246,7 @@ const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; #endif -#if !defined(_LIBCPP_HAS_NO_VARIADICS) - +#ifndef _LIBCPP_CXX03_LANG // __tuple_types @@ -468,9 +468,6 @@ template <size_t _Ip, class ..._Tp> using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; #endif -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_CXX03_LANG template <bool _IsTuple, class _SizeTrait, size_t _Expected> struct __tuple_like_with_size_imp : false_type {}; @@ -495,7 +492,7 @@ struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { template <class ...> static constexpr bool __enable_assign() { return false; } }; -#endif +#endif // !defined(_LIBCPP_CXX03_LANG) #if _LIBCPP_STD_VER > 14 diff --git a/include/algorithm b/include/algorithm index 571edd265508..c3517a11bb0d 100644 --- a/include/algorithm +++ b/include/algorithm @@ -2548,7 +2548,7 @@ min(const _Tp& __a, const _Tp& __b) return _VSTD::min(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _Tp, class _Compare> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2566,7 +2566,7 @@ min(initializer_list<_Tp> __t) return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // max_element @@ -2613,7 +2613,7 @@ max(const _Tp& __a, const _Tp& __b) return _VSTD::max(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _Tp, class _Compare> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2631,7 +2631,7 @@ max(initializer_list<_Tp> __t) return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 // clamp @@ -2732,7 +2732,7 @@ minmax(const _Tp& __a, const _Tp& __b) return _VSTD::minmax(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _Tp, class _Compare> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2779,7 +2779,7 @@ minmax(initializer_list<_Tp> __t) return _VSTD::minmax(__t, __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // random_shuffle @@ -2837,7 +2837,7 @@ private: _Engine_result_type __mask0_; _Engine_result_type __mask1_; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3080,7 +3080,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) template <class _RandomAccessIterator, class _RandomNumberGenerator> void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _RandomNumberGenerator&& __rand) #else _RandomNumberGenerator& __rand) @@ -3173,7 +3173,7 @@ _SampleIterator sample(_PopulationIterator __first, template<class _RandomAccessIterator, class _UniformRandomNumberGenerator> void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _UniformRandomNumberGenerator&& __g) #else _UniformRandomNumberGenerator& __g) diff --git a/include/bitset b/include/bitset index 827a901ffd71..b49c93ce2224 100644 --- a/include/bitset +++ b/include/bitset @@ -197,11 +197,11 @@ protected: _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; private: -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG void __init(unsigned long long __v, false_type) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void __init(unsigned long long __v, true_type) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_CONSTEXPR +#endif // _LIBCPP_CXX03_LANG unsigned long to_ulong(false_type) const; _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong(true_type) const; @@ -217,16 +217,16 @@ template <size_t _N_words, size_t _Size> inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG : __first_{0} #endif { -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG _VSTD::fill_n(__first_, _N_words, __storage_type(0)); #endif } -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG template <size_t _N_words, size_t _Size> void @@ -249,13 +249,13 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); } -#endif // _LIBCPP_HAS_NO_CONSTEXPR +#endif // _LIBCPP_CXX03_LANG template <size_t _N_words, size_t _Size> inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG #if __SIZEOF_SIZE_T__ == 8 : __first_{__v} #elif __SIZEOF_SIZE_T__ == 4 @@ -265,7 +265,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #endif #endif { -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>()); #endif } diff --git a/include/exception b/include/exception index 181d604d6c1e..f12ae42093aa 100644 --- a/include/exception +++ b/include/exception @@ -209,11 +209,11 @@ struct __throw_with_nested; template <class _Tp, class _Up> struct __throw_with_nested<_Tp, _Up, true> { _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void - #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG __do_throw(_Tp&& __t) - #else +#else __do_throw (_Tp& __t) - #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG { throw __nested<_Up>(_VSTD::forward<_Tp>(__t)); } @@ -222,11 +222,11 @@ struct __throw_with_nested<_Tp, _Up, true> { template <class _Tp, class _Up> struct __throw_with_nested<_Tp, _Up, false> { _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void - #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG __do_throw(_Tp&& __t) - #else +#else __do_throw (_Tp& __t) - #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG { throw _VSTD::forward<_Tp>(__t); } @@ -236,11 +236,11 @@ struct __throw_with_nested<_Tp, _Up, false> { template <class _Tp> _LIBCPP_NORETURN void -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG throw_with_nested(_Tp&& __t) #else throw_with_nested (_Tp& __t) -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG { #ifndef _LIBCPP_NO_EXCEPTIONS typedef typename decay<_Tp>::type _Up; diff --git a/include/ext/hash_map b/include/ext/hash_map index fab36a155bac..66f2b11c0594 100644 --- a/include/ext/hash_map +++ b/include/ext/hash_map @@ -331,7 +331,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) : __na_(__x.__na_), @@ -340,7 +340,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x) : __na_(__x.__na_), @@ -349,7 +349,7 @@ public: { const_cast<bool&>(__x.__value_constructed) = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) diff --git a/include/fstream b/include/fstream index 7bcc5d450daf..5ec42bd13407 100644 --- a/include/fstream +++ b/include/fstream @@ -193,13 +193,13 @@ public: // 27.9.1.2 Constructors/destructor: basic_filebuf(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG basic_filebuf(basic_filebuf&& __rhs); #endif virtual ~basic_filebuf(); // 27.9.1.3 Assign/swap: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_filebuf& operator=(basic_filebuf&& __rhs); #endif @@ -276,7 +276,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf() setbuf(0, 4096); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) @@ -352,7 +352,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>::~basic_filebuf() @@ -1017,12 +1017,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_ifstream(basic_ifstream&& __rhs); -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ifstream& operator=(basic_ifstream&& __rhs); #endif @@ -1071,7 +1069,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope } #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> inline @@ -1092,7 +1090,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> inline @@ -1177,12 +1175,10 @@ public: explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_ofstream(basic_ofstream&& __rhs); -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ofstream& operator=(basic_ofstream&& __rhs); #endif @@ -1231,7 +1227,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope } #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> inline @@ -1252,7 +1248,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> inline @@ -1339,12 +1335,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_fstream(basic_fstream&& __rhs); -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_fstream& operator=(basic_fstream&& __rhs); #endif @@ -1393,7 +1387,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm } #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> inline @@ -1414,7 +1408,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> inline diff --git a/include/functional b/include/functional index 15e672e0efc7..386fe678bff3 100644 --- a/include/functional +++ b/include/functional @@ -1264,7 +1264,7 @@ private: public: _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {} -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // invoke template <class... _ArgTypes> _LIBCPP_INLINE_VISIBILITY @@ -1454,7 +1454,7 @@ bool __not_null(function<_Fp> const& __f) { return !!__f; } } // namespace __function -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG namespace __function { @@ -1983,7 +1983,7 @@ void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {return __x.swap(__y);} -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG #include <__functional_03> @@ -2047,7 +2047,7 @@ struct __is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {}; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Uj> inline _LIBCPP_INLINE_VISIBILITY @@ -2347,7 +2347,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args) return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 diff --git a/include/initializer_list b/include/initializer_list index d6dfa80817a5..8c234aaaab2a 100644 --- a/include/initializer_list +++ b/include/initializer_list @@ -53,7 +53,7 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in namespace std // purposefully not versioned { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _Ep> class _LIBCPP_TEMPLATE_VIS initializer_list @@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT return __il.end(); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // !defined(_LIBCPP_CXX03_LANG) } // std diff --git a/include/ios b/include/ios index 49f0c01f9858..61d00b90ee04 100644 --- a/include/ios +++ b/include/ios @@ -657,7 +657,7 @@ protected: _LIBCPP_INLINE_VISIBILITY void move(basic_ios& __rhs); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_ALWAYS_INLINE void move(basic_ios&& __rhs) {move(__rhs);} #endif diff --git a/include/istream b/include/istream index 774f38df2e3c..9a8bb44ef3ec 100644 --- a/include/istream +++ b/include/istream @@ -189,12 +189,11 @@ public: { this->init(__sb); } virtual ~basic_istream(); protected: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_istream(basic_istream&& __rhs); -#endif + // 27.7.1.1.2 Assign/swap: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_istream& operator=(basic_istream&& __rhs); #endif @@ -332,7 +331,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _ __is.setstate(ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) @@ -350,7 +349,7 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>::~basic_istream() @@ -1424,7 +1423,7 @@ ws(basic_istream<_CharT, _Traits>& __is) return __is; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Tp> inline _LIBCPP_INLINE_VISIBILITY @@ -1435,7 +1434,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) return __is; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> class _LIBCPP_TEMPLATE_VIS basic_iostream @@ -1458,13 +1457,11 @@ public: virtual ~basic_iostream(); protected: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_iostream(basic_iostream&& __rhs); -#endif // assign/swap -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_iostream& operator=(basic_iostream&& __rhs); #endif @@ -1474,7 +1471,7 @@ protected: public: }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) @@ -1490,7 +1487,7 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_iostream<_CharT, _Traits>::~basic_iostream() @@ -1607,7 +1604,7 @@ getline(basic_istream<_CharT, _Traits>& __is, return getline(__is, __str, __is.widen('\n')); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template<class _CharT, class _Traits, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -1627,7 +1624,7 @@ getline(basic_istream<_CharT, _Traits>&& __is, return getline(__is, __str, __is.widen('\n')); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, size_t _Size> basic_istream<_CharT, _Traits>& diff --git a/include/iterator b/include/iterator index 66d1a310d22f..47a7811a3004 100644 --- a/include/iterator +++ b/include/iterator @@ -783,10 +783,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_back(__value_); return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_back(_VSTD::move(__value_)); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;} @@ -816,10 +816,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_front(__value_); return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_front(_VSTD::move(__value_)); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;} @@ -851,10 +851,10 @@ public: : container(_VSTD::addressof(__x)), iter(__i) {} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) {iter = container->insert(iter, __value_); ++iter; return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;} @@ -1060,7 +1060,7 @@ public: typedef typename iterator_traits<iterator_type>::value_type value_type; typedef typename iterator_traits<iterator_type>::difference_type difference_type; typedef iterator_type pointer; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG typedef typename iterator_traits<iterator_type>::reference __reference; typedef typename conditional< is_reference<__reference>::value, diff --git a/include/locale b/include/locale index da31a1e62cb2..6bce16e64884 100644 --- a/include/locale +++ b/include/locale @@ -3570,7 +3570,7 @@ public: wstring_convert(_Codecvt* __pcvt, state_type __state); _LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string()); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_ALWAYS_INLINE wstring_convert(wstring_convert&& __wc); #endif @@ -3629,7 +3629,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: __cvtptr_ = new _Codecvt; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> inline @@ -3643,7 +3643,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: __wc.__cvtptr_ = nullptr; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert() diff --git a/include/map b/include/map index c8131eceb72b..71f18693f6d1 100644 --- a/include/map +++ b/include/map @@ -582,7 +582,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT : __na_(__x.__na_), @@ -591,7 +591,7 @@ public: { __x.__value_constructed = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -667,7 +667,7 @@ private: ~__value_type(); }; -#endif +#endif // _LIBCPP_CXX03_LANG template <class _Tp> struct __extract_key_value_types; @@ -921,7 +921,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY map(map&& __m) @@ -940,10 +940,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY map(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -971,7 +967,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit map(const allocator_type& __a) @@ -1082,6 +1078,10 @@ public: _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list<value_type> __il) + {insert(__il.begin(), __il.end());} #endif template <class _InputIterator> @@ -1092,14 +1092,6 @@ public: insert(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - #if _LIBCPP_STD_VER > 14 template <class... _Args> @@ -1194,7 +1186,7 @@ public: return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); } -#endif +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} @@ -1307,7 +1299,6 @@ private: #ifndef _LIBCPP_CXX03_LANG - template <class _Key, class _Tp, class _Compare, class _Allocator> map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) : __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a)) @@ -1321,10 +1312,27 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) } } -#endif // !_LIBCPP_CXX03_LANG +template <class _Key, class _Tp, class _Compare, class _Allocator> +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(__k), + _VSTD::forward_as_tuple()).first->__cc.second; +} +template <class _Key, class _Tp, class _Compare, class _Allocator> +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(_VSTD::move(__k)), + _VSTD::forward_as_tuple()).first->__cc.second; +} -#ifdef _LIBCPP_CXX03_LANG +#else // _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Compare, class _Allocator> typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder @@ -1355,29 +1363,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) return __r->__value_.__cc.second; } -#else - -template <class _Key, class _Tp, class _Compare, class _Allocator> -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(__k), - _VSTD::forward_as_tuple()).first->__cc.second; -} - -template <class _Key, class _Tp, class _Compare, class _Allocator> -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(_VSTD::move(__k)), - _VSTD::forward_as_tuple()).first->__cc.second; -} - -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Compare, class _Allocator> _Tp& @@ -1593,7 +1579,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multimap(multimap&& __m) @@ -1612,10 +1598,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -1643,7 +1625,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit multimap(const allocator_type& __a) @@ -1736,6 +1718,11 @@ public: iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p.__i_, _VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list<value_type> __il) + {insert(__il.begin(), __il.end());} + #endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -1753,14 +1740,6 @@ public: __tree_.__insert_multi(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} _LIBCPP_INLINE_VISIBILITY diff --git a/include/memory b/include/memory index 44a0c34e43e1..3fc0e5a1bf12 100644 --- a/include/memory +++ b/include/memory @@ -2079,17 +2079,12 @@ struct __compressed_pair_elem { typedef const _Tp& const_reference; #ifndef _LIBCPP_CXX03_LANG - template <bool _Dummy = true, class = typename enable_if< - __dependent_type<is_default_constructible<_Tp>, _Dummy>::value - >::type - > - _LIBCPP_CONSTEXPR __compressed_pair_elem() - _NOEXCEPT_(is_nothrow_default_constructible<_Tp>::value) - : __value_() {} + constexpr __compressed_pair_elem() : __value_() {} template <class _Up, class = typename enable_if< - !is_same<__compressed_pair_elem, _Up>::value>::type> - _LIBCPP_CONSTEXPR explicit + !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value + >::type> + constexpr explicit __compressed_pair_elem(_Up&& __u) : __value_(_VSTD::forward<_Up>(__u)){}; @@ -2118,11 +2113,12 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { typedef _Tp __value_type; #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_CONSTEXPR __compressed_pair_elem() = default; + constexpr __compressed_pair_elem() = default; template <class _Up, class = typename enable_if< - !is_same<__compressed_pair_elem, _Up>::value>::type> - _LIBCPP_CONSTEXPR explicit + !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value + >::type> + constexpr explicit __compressed_pair_elem(_Up&& __u) : __value_type(_VSTD::forward<_Up>(__u)){}; @@ -2161,8 +2157,14 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, public: #ifndef _LIBCPP_CXX03_LANG + template <bool _Dummy = true, + class = typename enable_if< + __dependent_type<is_default_constructible<_T1>, _Dummy>::value && + __dependent_type<is_default_constructible<_T2>, _Dummy>::value + >::type + > _LIBCPP_INLINE_VISIBILITY - __compressed_pair() = default; + constexpr __compressed_pair() {} template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type, __compressed_pair>::value, @@ -2734,7 +2736,7 @@ public: > _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept - : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) { + : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) { } template <class _Up, class _Ep, diff --git a/include/mutex b/include/mutex index f28d37c83e63..e92baa51ae75 100644 --- a/include/mutex +++ b/include/mutex @@ -191,7 +191,7 @@ template<class Callable, class ...Args> #include <__mutex_base> #include <functional> #include <memory> -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #include <tuple> #endif #include <__threading_support> @@ -343,7 +343,7 @@ try_lock(_L0& __l0, _L1& __l1) return 0; } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class _L0, class _L1, class _L2, class... _L3> int @@ -362,7 +362,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) return __r; } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG template <class _L0, class _L1> void @@ -391,7 +391,7 @@ lock(_L0& __l0, _L1& __l1) } } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class _L0, class _L1, class _L2, class ..._L3> void @@ -466,7 +466,7 @@ void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { _VSTD::__unlock(__l2, __l3...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template <class ..._Mutexes> @@ -550,13 +550,13 @@ private: struct _LIBCPP_TEMPLATE_VIS once_flag; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template<class _Callable, class... _Args> _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template<class _Callable> _LIBCPP_INLINE_VISIBILITY @@ -566,7 +566,7 @@ template<class _Callable> _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG struct _LIBCPP_TEMPLATE_VIS once_flag { @@ -580,11 +580,11 @@ private: unsigned long __state_; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template<class _Callable, class... _Args> friend void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template<class _Callable> friend void call_once(once_flag&, _Callable&); @@ -592,10 +592,10 @@ private: template<class _Callable> friend void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG }; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class _Fp> class __call_once_param @@ -650,7 +650,7 @@ __call_once_proxy(void* __vp) _LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*)); -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template<class _Callable, class... _Args> inline _LIBCPP_INLINE_VISIBILITY @@ -666,7 +666,7 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) } } -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template<class _Callable> inline _LIBCPP_INLINE_VISIBILITY @@ -692,7 +692,7 @@ call_once(once_flag& __flag, const _Callable& __func) } } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD diff --git a/include/optional b/include/optional index 118d71782882..8c7a242113a0 100644 --- a/include/optional +++ b/include/optional @@ -17,29 +17,31 @@ // C++1z namespace std { - // 20.6.3, optional for object types + // 23.6.3, optional for object types template <class T> class optional; - // 20.6.4, no-value state indicator + // 23.6.4, no-value state indicator struct nullopt_t{see below }; constexpr nullopt_t nullopt(unspecified ); - // 20.6.5, class bad_optional_access + // 23.6.5, class bad_optional_access class bad_optional_access; - // 20.6.6, relational operators - template <class T> - constexpr bool operator==(const optional<T>&, const optional<T>&); - template <class T> - constexpr bool operator!=(const optional<T>&, const optional<T>&); - template <class T> - constexpr bool operator<(const optional<T>&, const optional<T>&); - template <class T> - constexpr bool operator>(const optional<T>&, const optional<T>&); - template <class T> - constexpr bool operator<=(const optional<T>&, const optional<T>&); - template <class T> - constexpr bool operator>=(const optional<T>&, const optional<T>&); + // 23.6.6, relational operators + template <class T, class U> + constexpr bool operator==(const optional<T>&, const optional<U>&); + template <class T, class U> + constexpr bool operator!=(const optional<T>&, const optional<U>&); + template <class T, class U> + constexpr bool operator<(const optional<T>&, const optional<U>&); + template <class T, class U> + constexpr bool operator>(const optional<T>&, const optional<U>&); + template <class T, class U> + constexpr bool operator<=(const optional<T>&, const optional<U>&); + template <class T, class U> + constexpr bool operator>=(const optional<T>&, const optional<U>&); + + // 23.6.7 comparison with nullopt template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept; template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept; template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept; @@ -53,21 +55,21 @@ namespace std { template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept; template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept; - // 20.6.8, comparison with T - template <class T> constexpr bool operator==(const optional<T>&, const T&); - template <class T> constexpr bool operator==(const T&, const optional<T>&); - template <class T> constexpr bool operator!=(const optional<T>&, const T&); - template <class T> constexpr bool operator!=(const T&, const optional<T>&); - template <class T> constexpr bool operator<(const optional<T>&, const T&); - template <class T> constexpr bool operator<(const T&, const optional<T>&); - template <class T> constexpr bool operator<=(const optional<T>&, const T&); - template <class T> constexpr bool operator<=(const T&, const optional<T>&); - template <class T> constexpr bool operator>(const optional<T>&, const T&); - template <class T> constexpr bool operator>(const T&, const optional<T>&); - template <class T> constexpr bool operator>=(const optional<T>&, const T&); - template <class T> constexpr bool operator>=(const T&, const optional<T>&); - - // 20.6.9, specialized algorithms + // 23.6.8, comparison with T + template <class T, class U> constexpr bool operator==(const optional<T>&, const U&); + template <class T, class U> constexpr bool operator==(const U&, const optional<T>&); + template <class T, class U> constexpr bool operator!=(const optional<T>&, const U&); + template <class T, class U> constexpr bool operator!=(const U&, const optional<T>&); + template <class T, class U> constexpr bool operator<(const optional<T>&, const U&); + template <class T, class U> constexpr bool operator<(const U&, const optional<T>&); + template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&); + template <class T, class U> constexpr bool operator<=(const U&, const optional<T>&); + template <class T, class U> constexpr bool operator>(const optional<T>&, const U&); + template <class T, class U> constexpr bool operator>(const U&, const optional<T>&); + template <class T, class U> constexpr bool operator>=(const optional<T>&, const U&); + template <class T, class U> constexpr bool operator>=(const U&, const optional<T>&); + + // 23.6.9, specialized algorithms template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below ); template <class T> constexpr optional<see below > make_optional(T&&); template <class T, class... Args> @@ -75,7 +77,7 @@ namespace std { template <class T, class U, class... Args> constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args); - // 20.6.10, hash support + // 23.6.10, hash support template <class T> struct hash; template <class T> struct hash<optional<T>>; @@ -83,7 +85,7 @@ namespace std { public: using value_type = T; - // 20.6.3.1, constructors + // 23.6.3.1, constructors constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; optional(const optional &); @@ -98,10 +100,10 @@ namespace std { template <class U> constexpr EXPLICIT optional(optional<U> &&); - // 20.6.3.2, destructor + // 23.6.3.2, destructor ~optional(); - // 20.6.3.3, assignment + // 23.6.3.3, assignment optional &operator=(nullopt_t) noexcept; optional &operator=(const optional &); optional &operator=(optional &&) noexcept(see below ); @@ -112,10 +114,10 @@ namespace std { template <class U, class... Args> T& emplace(initializer_list<U>, Args &&...); - // 20.6.3.4, swap + // 23.6.3.4, swap void swap(optional &) noexcept(see below ); - // 20.6.3.5, observers + // 23.6.3.5, observers constexpr T const *operator->() const; constexpr T *operator->(); constexpr T const &operator*() const &; @@ -131,7 +133,7 @@ namespace std { template <class U> constexpr T value_or(U &&) const &; template <class U> constexpr T value_or(U &&) &&; - // 20.6.3.6, modifiers + // 23.6.3.6, modifiers void reset() noexcept; private: diff --git a/include/ostream b/include/ostream index 3d9be8b7aa56..ca2c83f74a3f 100644 --- a/include/ostream +++ b/include/ostream @@ -165,13 +165,11 @@ public: { this->init(__sb); } virtual ~basic_ostream(); protected: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_ostream(basic_ostream&& __rhs); -#endif // 27.7.2.3 Assign/swap -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_ostream& operator=(basic_ostream&& __rhs); #endif @@ -290,7 +288,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry() } } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) @@ -306,7 +304,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::~basic_ostream() @@ -1023,7 +1021,7 @@ flush(basic_ostream<_CharT, _Traits>& __os) return __os; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Stream, class _Tp> inline _LIBCPP_INLINE_VISIBILITY @@ -1039,7 +1037,7 @@ operator<<(_Stream&& __os, const _Tp& __x) return _VSTD::move(__os); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template<class _CharT, class _Traits, class _Allocator> basic_ostream<_CharT, _Traits>& diff --git a/include/queue b/include/queue index 57d420c7406c..feaae8920463 100644 --- a/include/queue +++ b/include/queue @@ -213,29 +213,27 @@ public: _LIBCPP_INLINE_VISIBILITY queue(const queue& __q) : c(__q.c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + queue& operator=(const queue& __q) {c = __q.c; return *this;} + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value) : c(_VSTD::move(__q.c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - queue& operator=(const queue& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit queue(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Alloc> _LIBCPP_INLINE_VISIBILITY explicit queue(const _Alloc& __a, @@ -254,7 +252,7 @@ public: typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__c, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Alloc> _LIBCPP_INLINE_VISIBILITY queue(container_type&& __c, const _Alloc& __a, @@ -268,7 +266,7 @@ public: _Alloc>::value>::type* = 0) : c(_VSTD::move(__q.c), __a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -286,10 +284,9 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} -#ifndef _LIBCPP_HAS_NO_VARIADICS template <class... _Args> _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -299,8 +296,7 @@ public: void emplace(_Args&&... __args) { c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_front();} @@ -418,32 +414,30 @@ public: _LIBCPP_INLINE_VISIBILITY priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + priority_queue& operator=(const priority_queue& __q) + {c = __q.c; comp = __q.comp; return *this;} + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY priority_queue(priority_queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value && is_nothrow_move_constructible<value_compare>::value) : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - - _LIBCPP_INLINE_VISIBILITY - priority_queue& operator=(const priority_queue& __q) - {c = __q.c; comp = __q.comp; return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY priority_queue& operator=(priority_queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value && is_nothrow_move_assignable<value_compare>::value) {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {} _LIBCPP_INLINE_VISIBILITY priority_queue(const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp, container_type&& __c); #endif @@ -455,12 +449,12 @@ public: _LIBCPP_INLINE_VISIBILITY priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _InputIter> _LIBCPP_INLINE_VISIBILITY priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Alloc> _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const _Alloc& __a, @@ -482,7 +476,7 @@ public: priority_queue(const priority_queue& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Alloc> _LIBCPP_INLINE_VISIBILITY priority_queue(const value_compare& __comp, container_type&& __c, @@ -494,7 +488,7 @@ public: priority_queue(priority_queue&& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -505,13 +499,13 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v); -#ifndef _LIBCPP_HAS_NO_VARIADICS - template <class... _Args> _LIBCPP_INLINE_VISIBILITY void emplace(_Args&&... __args); -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template <class... _Args> + _LIBCPP_INLINE_VISIBILITY + void emplace(_Args&&... __args); +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop(); @@ -531,7 +525,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> inline @@ -543,7 +537,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _ _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> template <class _InputIter> @@ -569,7 +563,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> template <class _InputIter> @@ -584,7 +578,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> template <class _Alloc> @@ -635,7 +629,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> template <class _Alloc> @@ -664,7 +658,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> inline @@ -675,7 +669,7 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) _VSTD::push_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> inline @@ -686,8 +680,6 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) _VSTD::push_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template <class _Tp, class _Container, class _Compare> template <class... _Args> inline @@ -698,8 +690,7 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) _VSTD::push_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp, class _Container, class _Compare> inline diff --git a/include/random b/include/random index 835ebdb6c136..83fff90a4178 100644 --- a/include/random +++ b/include/random @@ -2826,7 +2826,7 @@ public: static _LIBCPP_CONSTEXPR const size_t block_size = __p; static _LIBCPP_CONSTEXPR const size_t used_block = __r; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; #else @@ -2845,11 +2845,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(_Engine&& __e) : __e_(_VSTD::move(__e)), __n_(0) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} template<class _Sseq> @@ -3014,7 +3014,7 @@ private: result_type, _Engine_result_type >::type _Working_result_type; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3055,11 +3055,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(_Engine&& __e) : __e_(_VSTD::move(__e)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} template<class _Sseq> @@ -3264,7 +3264,7 @@ public: // engine characteristics static _LIBCPP_CONSTEXPR const size_t table_size = __k; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; #else @@ -3285,11 +3285,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) {__init();} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(_Engine&& __e) : __e_(_VSTD::move(__e)) {__init();} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} template<class _Sseq> @@ -3526,11 +3526,11 @@ public: // constructors _LIBCPP_INLINE_VISIBILITY seed_seq() _NOEXCEPT {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _Tp> _LIBCPP_INLINE_VISIBILITY seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _InputIterator> _LIBCPP_INLINE_VISIBILITY @@ -3637,7 +3637,7 @@ generate_canonical(_URNG& __g) { const size_t _Dt = numeric_limits<_RealType>::digits; const size_t __b = _Dt < __bits ? _Dt : __bits; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG const size_t __logR = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value; #else const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value; @@ -5851,11 +5851,11 @@ public: _LIBCPP_INLINE_VISIBILITY param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {__init();} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY param_type(initializer_list<double> __wl) : __p_(__wl.begin(), __wl.end()) {__init();} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _UnaryOperation> param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw); @@ -5898,11 +5898,11 @@ public: _LIBCPP_INLINE_VISIBILITY discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY discrete_distribution(initializer_list<double> __wl) : __p_(__wl) {} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _UnaryOperation> _LIBCPP_INLINE_VISIBILITY discrete_distribution(size_t __nw, double __xmin, double __xmax, @@ -6079,10 +6079,10 @@ public: template<class _InputIteratorB, class _InputIteratorW> param_type(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _UnaryOperation> param_type(initializer_list<result_type> __bl, _UnaryOperation __fw); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _UnaryOperation> param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); @@ -6132,13 +6132,13 @@ public: _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _UnaryOperation> _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _UnaryOperation> _LIBCPP_INLINE_VISIBILITY @@ -6268,7 +6268,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type( } } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _RealType> template<class _UnaryOperation> @@ -6293,7 +6293,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type( } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _RealType> template<class _UnaryOperation> @@ -6402,10 +6402,10 @@ public: template<class _InputIteratorB, class _InputIteratorW> param_type(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _UnaryOperation> param_type(initializer_list<result_type> __bl, _UnaryOperation __fw); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _UnaryOperation> param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); @@ -6455,13 +6455,13 @@ public: _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _UnaryOperation> _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _UnaryOperation> _LIBCPP_INLINE_VISIBILITY @@ -6595,7 +6595,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type( } } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template<class _RealType> template<class _UnaryOperation> @@ -6620,7 +6620,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type( } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template<class _RealType> template<class _UnaryOperation> diff --git a/include/regex b/include/regex index fe97a63763c9..0f49b95a6561 100644 --- a/include/regex +++ b/include/regex @@ -2539,14 +2539,14 @@ public: : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(0) {__parse(__first, __last);} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex(initializer_list<value_type> __il, flag_type __f = regex_constants::ECMAScript) : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(0) {__parse(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~basic_regex() = default; @@ -2555,11 +2555,11 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(const value_type* __p) {return assign(__p);} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(initializer_list<value_type> __il) {return assign(__il);} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _ST, class _SA> _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p) @@ -2569,7 +2569,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const basic_regex& __that) {return *this = __that;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex& assign(basic_regex&& __that) _NOEXCEPT {return *this = _VSTD::move(__that);} @@ -2626,14 +2626,14 @@ public: return assign(basic_regex(__first, __last, __f)); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex& assign(initializer_list<value_type> __il, flag_type __f = regex_constants::ECMAScript) {return assign(__il.begin(), __il.end(), __f);} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // const operations: _LIBCPP_INLINE_VISIBILITY @@ -6213,7 +6213,7 @@ public: regex_constants::match_default) = delete; #endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, initializer_list<int> __submatches, @@ -6227,7 +6227,7 @@ public: regex_constants::match_flag_type __m = regex_constants::match_default) = delete; #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <size_t _Np> regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, @@ -6327,7 +6327,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: __init(__a, __b); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template <class _BidirectionalIterator, class _CharT, class _Traits> regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: @@ -6342,7 +6342,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: __init(__a, __b); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _BidirectionalIterator, class _CharT, class _Traits> template <size_t _Np> diff --git a/include/set b/include/set index be5c9528caf8..30f2fa88f256 100644 --- a/include/set +++ b/include/set @@ -486,12 +486,12 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit set(const allocator_type& __a) @@ -504,11 +504,9 @@ public: insert(__s.begin(), __s.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG set(set&& __s, const allocator_type& __a); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -536,9 +534,7 @@ public: __tree_.__assign_unique(__il.begin(), __il.end()); return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -546,7 +542,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -587,7 +583,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template <class... _Args> _LIBCPP_INLINE_VISIBILITY pair<iterator, bool> emplace(_Args&&... __args) @@ -596,23 +592,15 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY pair<iterator,bool> insert(const value_type& __v) {return __tree_.__insert_unique(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - pair<iterator,bool> insert(value_type&& __v) - {return __tree_.__insert_unique(_VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_unique(__p, __v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_unique(__p, _VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __f, _InputIterator __l) @@ -621,11 +609,19 @@ public: __tree_.__insert_unique(__e, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + pair<iterator,bool> insert(value_type&& __v) + {return __tree_.__insert_unique(_VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_unique(__p, _VSTD::move(__v));} + _LIBCPP_INLINE_VISIBILITY void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p);} @@ -727,7 +723,7 @@ public: #endif }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Key, class _Compare, class _Allocator> set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) @@ -741,7 +737,7 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Key, class _Compare, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -901,12 +897,14 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multiset(multiset&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + multiset(multiset&& __s, const allocator_type& __a); +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit multiset(const allocator_type& __a) : __tree_(__a) {} @@ -916,11 +914,8 @@ public: { insert(__s.begin(), __s.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - multiset(multiset&& __s, const allocator_type& __a); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -948,9 +943,7 @@ public: __tree_.__assign_multi(__il.begin(), __il.end()); return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -958,7 +951,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -999,7 +992,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template <class... _Args> _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -1008,23 +1001,15 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __v) - {return __tree_.__insert_multi(_VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_multi(__p, __v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_multi(__p, _VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __f, _InputIterator __l) @@ -1033,11 +1018,19 @@ public: __tree_.__insert_multi(__e, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + iterator insert(value_type&& __v) + {return __tree_.__insert_multi(_VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_multi(__p, _VSTD::move(__v));} + _LIBCPP_INLINE_VISIBILITY void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p);} @@ -1140,7 +1133,7 @@ public: #endif }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Key, class _Compare, class _Allocator> multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) @@ -1154,7 +1147,7 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Key, class _Compare, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/sstream b/include/sstream index 40b97854f7f0..411374207b4a 100644 --- a/include/sstream +++ b/include/sstream @@ -212,12 +212,10 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_stringbuf(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG basic_stringbuf(basic_stringbuf&& __rhs); -#endif // 27.8.1.2 Assign and swap: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES basic_stringbuf& operator=(basic_stringbuf&& __rhs); #endif void swap(basic_stringbuf& __rhs); @@ -255,7 +253,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& str(__s); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) @@ -346,7 +344,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> void @@ -641,13 +639,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_istringstream(basic_istringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_istringstream& operator=(basic_istringstream&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(basic_istringstream& __rhs); @@ -675,7 +673,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri { } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) @@ -694,7 +692,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream& return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) @@ -758,13 +756,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_ostringstream(basic_ostringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_ostringstream& operator=(basic_ostringstream&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(basic_ostringstream& __rhs); @@ -792,7 +790,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri { } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) @@ -811,7 +809,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream& return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> void @@ -877,13 +875,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_stringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_stringstream(basic_stringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_stringstream& operator=(basic_stringstream&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(basic_stringstream& __rhs); @@ -911,7 +909,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string { } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) @@ -930,7 +928,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> void diff --git a/include/stack b/include/stack index c797ea5ec6e9..b2d4e2395017 100644 --- a/include/stack +++ b/include/stack @@ -126,29 +126,28 @@ public: _LIBCPP_INLINE_VISIBILITY stack(const stack& __q) : c(__q.c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + stack& operator=(const stack& __q) {c = __q.c; return *this;} + + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value) : c(_VSTD::move(__q.c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - stack& operator=(const stack& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - explicit stack(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG + + _LIBCPP_INLINE_VISIBILITY + explicit stack(const container_type& __c) : c(__c) {} + template <class _Alloc> _LIBCPP_INLINE_VISIBILITY explicit stack(const _Alloc& __a, @@ -167,7 +166,7 @@ public: typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__s.c, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Alloc> _LIBCPP_INLINE_VISIBILITY stack(container_type&& __c, const _Alloc& __a, @@ -180,7 +179,7 @@ public: typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(_VSTD::move(__s.c), __a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -193,10 +192,10 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} -#ifndef _LIBCPP_HAS_NO_VARIADICS + template <class... _Args> _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -206,8 +205,8 @@ public: void emplace(_Args&&... __args) { c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_back();} diff --git a/include/string b/include/string index 1bc91ed12492..af028a023c29 100644 --- a/include/string +++ b/include/string @@ -763,7 +763,7 @@ public: basic_string(const basic_string& __str); basic_string(const basic_string& __str, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str) #if _LIBCPP_STD_VER <= 14 @@ -774,7 +774,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s); _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s, const _Allocator& __a); @@ -806,12 +806,12 @@ public: template<class _InputIterator> _LIBCPP_INLINE_VISIBILITY basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list<_CharT> __il); _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list<_CharT> __il, const _Allocator& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG inline ~basic_string(); @@ -825,17 +825,15 @@ public: #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); + _LIBCPP_INLINE_VISIBILITY + basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);} basic_string& operator=(value_type __c); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY @@ -918,9 +916,9 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(__self_view __sv) {return append(__sv);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& append(const basic_string& __str); @@ -968,10 +966,10 @@ public: return __append_forward_unsafe(__first, __last); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG void push_back(value_type __c); _LIBCPP_INLINE_VISIBILITY @@ -985,7 +983,7 @@ public: basic_string& assign(__self_view __sv) { return assign(__sv.data(), __sv.size()); } _LIBCPP_INLINE_VISIBILITY basic_string& assign(const basic_string& __str) { return *this = __str; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& assign(basic_string&& str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) @@ -1021,10 +1019,10 @@ public: basic_string& >::type assign(_ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& insert(size_type __pos1, const basic_string& __str); @@ -1063,11 +1061,11 @@ public: iterator >::type insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __pos, initializer_list<value_type> __il) {return insert(__pos, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG basic_string& erase(size_type __pos = 0, size_type __n = npos); _LIBCPP_INLINE_VISIBILITY @@ -1109,11 +1107,11 @@ public: basic_string& >::type replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il) {return replace(__i1, __i2, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; _LIBCPP_INLINE_VISIBILITY @@ -1408,7 +1406,7 @@ private: void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void __move_assign(basic_string& __str, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value); @@ -1641,7 +1639,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( #endif } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -1680,7 +1678,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> void @@ -1874,7 +1872,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, #endif } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -1900,7 +1898,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( #endif } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>::~basic_string() @@ -2049,7 +2047,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _CharT, class _Traits, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -3790,7 +3788,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) return __r; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template<class _CharT, class _Traits, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -3850,7 +3848,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) return _VSTD::move(__lhs); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG // swap @@ -3952,7 +3950,7 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template<class _CharT, class _Traits, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY @@ -3966,7 +3964,7 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_DEBUG_LEVEL >= 2 diff --git a/include/strstream b/include/strstream index 81eef2ab4849..b00b9d830dff 100644 --- a/include/strstream +++ b/include/strstream @@ -151,12 +151,12 @@ public: strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0); strstreambuf(const unsigned char* __gnext, streamsize __n); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY strstreambuf(strstreambuf&& __rhs); _LIBCPP_INLINE_VISIBILITY strstreambuf& operator=(strstreambuf&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~strstreambuf(); @@ -191,7 +191,7 @@ private: void __init(char* __gnext, streamsize __n, char* __pbeg); }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY strstreambuf::strstreambuf(strstreambuf&& __rhs) @@ -226,7 +226,7 @@ strstreambuf::operator=(strstreambuf&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG class _LIBCPP_TYPE_VIS istrstream : public istream @@ -245,7 +245,7 @@ public: istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY istrstream(istrstream&& __rhs) : istream(_VSTD::move(__rhs)), @@ -261,7 +261,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~istrstream(); @@ -294,7 +294,7 @@ public: __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY ostrstream(ostrstream&& __rhs) : ostream(_VSTD::move(__rhs)), @@ -310,7 +310,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~ostrstream(); @@ -354,7 +354,7 @@ public: __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY strstream(strstream&& __rhs) : iostream(_VSTD::move(__rhs)), @@ -370,7 +370,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~strstream(); diff --git a/include/thread b/include/thread index 874ce3ec196c..360b43d5e555 100644 --- a/include/thread +++ b/include/thread @@ -95,7 +95,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #include <system_error> #include <chrono> #include <__mutex_base> -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #include <tuple> #endif #include <__threading_support> @@ -291,7 +291,7 @@ public: _LIBCPP_INLINE_VISIBILITY thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class _Fp, class ..._Args, class = typename enable_if < @@ -300,19 +300,19 @@ public: > _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template <class _Fp> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f); #endif ~thread(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;} _LIBCPP_INLINE_VISIBILITY thread& operator=(thread&& __t) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);} @@ -329,7 +329,7 @@ public: static unsigned hardware_concurrency() _NOEXCEPT; }; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template <class _TSp, class _Fp, class ..._Args, size_t ..._Indices> inline _LIBCPP_INLINE_VISIBILITY @@ -369,7 +369,18 @@ thread::thread(_Fp&& __f, _Args&&... __args) __throw_system_error(__ec, "thread constructor failed"); } -#else // _LIBCPP_HAS_NO_VARIADICS +inline +thread& +thread::operator=(thread&& __t) _NOEXCEPT +{ + if (!__libcpp_thread_isnull(&__t_)) + terminate(); + __t_ = __t.__t_; + __t.__t_ = _LIBCPP_NULL_THREAD; + return *this; +} + +#else // _LIBCPP_CXX03_LANG template <class _Fp> struct __thread_invoke_pair { @@ -404,22 +415,7 @@ thread::thread(_Fp __f) __throw_system_error(__ec, "thread constructor failed"); } -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -inline -thread& -thread::operator=(thread&& __t) _NOEXCEPT -{ - if (!__libcpp_thread_isnull(&__t_)) - terminate(); - __t_ = __t.__t_; - __t.__t_ = _LIBCPP_NULL_THREAD; - return *this; -} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);} diff --git a/include/tuple b/include/tuple index f2a74721921a..b869b861cce0 100644 --- a/include/tuple +++ b/include/tuple @@ -148,7 +148,7 @@ template <class... Types> _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // __tuple_leaf @@ -1345,9 +1345,6 @@ template <class ..._Tp, class _Alloc> struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> : true_type {}; -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_CXX03_LANG template <class _T1, class _T2> template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2> inline _LIBCPP_INLINE_VISIBILITY @@ -1358,7 +1355,6 @@ pair<_T1, _T2>::pair(piecewise_construct_t, second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) { } -#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template <class _Tp> @@ -1404,6 +1400,8 @@ _LIBCPP_NOEXCEPT_RETURN( #endif // _LIBCPP_STD_VER > 14 +#endif // !defined(_LIBCPP_CXX03_LANG) + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_TUPLE diff --git a/include/unordered_map b/include/unordered_map index 4fdac160f928..0546c0e2f9f2 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -547,7 +547,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) _NOEXCEPT @@ -557,7 +557,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x) : __na_(__x.__na_), @@ -566,7 +566,7 @@ public: { const_cast<bool&>(__x.__value_constructed) = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -819,20 +819,18 @@ public: explicit unordered_map(const allocator_type& __a); unordered_map(const unordered_map& __u); unordered_map(const unordered_map& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_map(unordered_map&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_map(initializer_list<value_type> __il); unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_map(size_type __n, const allocator_type& __a) @@ -875,15 +873,13 @@ public: #endif return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_map& operator=(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_map& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -928,13 +924,11 @@ public: _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY pair<iterator, bool> insert(value_type&& __x) {return __table_.__insert_unique(_VSTD::move(__x));} @@ -1078,7 +1072,7 @@ public: // FIXME: Add debug mode checking for the iterator input return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first; } -#endif +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} @@ -1277,7 +1271,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline @@ -1314,10 +1308,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list<value_type> __il) @@ -1354,10 +1344,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1368,10 +1354,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1382,22 +1364,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifdef _LIBCPP_CXX03_LANG -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) -{ - __node_allocator& __na = __table_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k); - __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); - __h.get_deleter().__second_constructed = true; - return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 -} -#endif +#endif // _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> @@ -1410,20 +1377,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, __table_.__insert_unique(*__first); } -#ifdef _LIBCPP_CXX03_LANG -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) -{ - iterator __i = find(__k); - if (__i != end()) - return __i->second; - __node_holder __h = __construct_node_with_key(__k); - pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get()); - __h.release(); - return __r.first->second; -} -#else +#ifndef _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> _Tp& @@ -1442,8 +1396,35 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()).first->__cc.second; } +#else // _LIBCPP_CXX03_LANG -#endif // !_LIBCPP_CXX03_MODE +template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> +typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); + __h.get_deleter().__second_constructed = true; + return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 +} + +template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> +_Tp& +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) +{ + iterator __i = find(__k); + if (__i != end()) + return __i->second; + __node_holder __h = __construct_node_with_key(__k); + pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get()); + __h.release(); + return __r.first->second; +} + +#endif // _LIBCPP_CXX03_MODE template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> _Tp& @@ -1586,13 +1567,11 @@ public: explicit unordered_multimap(const allocator_type& __a); unordered_multimap(const unordered_multimap& __u); unordered_multimap(const unordered_multimap& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multimap(unordered_multimap&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_multimap(unordered_multimap&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multimap(initializer_list<value_type> __il); unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), @@ -1600,7 +1579,7 @@ public: unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_multimap(size_type __n, const allocator_type& __a) @@ -1643,15 +1622,13 @@ public: #endif return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multimap& operator=(unordered_multimap&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_multimap& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -1688,13 +1665,10 @@ public: _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} @@ -1912,7 +1886,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline @@ -1951,10 +1925,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list<value_type> __il) @@ -1991,10 +1961,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -2005,10 +1971,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -2019,7 +1981,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG diff --git a/include/unordered_set b/include/unordered_set index fc53c8271109..a14fb0004922 100644 --- a/include/unordered_set +++ b/include/unordered_set @@ -408,13 +408,11 @@ public: explicit unordered_set(const allocator_type& __a); unordered_set(const unordered_set& __u); unordered_set(const unordered_set& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_set(unordered_set&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_set(initializer_list<value_type> __il); unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), @@ -432,7 +430,7 @@ public: const hasher& __hf, const allocator_type& __a) : unordered_set(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~unordered_set() = default; _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(const unordered_set& __u) @@ -440,15 +438,13 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -474,7 +470,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template <class... _Args> _LIBCPP_INLINE_VISIBILITY pair<iterator, bool> emplace(_Args&&... __args) @@ -493,51 +489,47 @@ public: iterator emplace_hint(const_iterator, _Args&&... __args) {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;} #endif -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert(const value_type& __x) - {return __table_.__insert_unique(__x);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY pair<iterator, bool> insert(value_type&& __x) {return __table_.__insert_unique(_VSTD::move(__x));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_DEBUG_LEVEL >= 2 - iterator insert(const_iterator __p, const value_type& __x) + iterator insert(const_iterator __p, value_type&& __x) { _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, - "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" + "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" " referring to this unordered_set"); - return insert(__x).first; + return insert(_VSTD::move(__x)).first; } #else - iterator insert(const_iterator, const value_type& __x) - {return insert(__x).first;} + iterator insert(const_iterator, value_type&& __x) + {return insert(_VSTD::move(__x)).first;} #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list<value_type> __il) + {insert(__il.begin(), __il.end());} +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + pair<iterator, bool> insert(const value_type& __x) + {return __table_.__insert_unique(__x);} + _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_DEBUG_LEVEL >= 2 - iterator insert(const_iterator __p, value_type&& __x) + iterator insert(const_iterator __p, const value_type& __x) { _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, - "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" + "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" " referring to this unordered_set"); - return insert(_VSTD::move(__x)).first; + return insert(__x).first; } #else - iterator insert(const_iterator, value_type&& __x) - {return insert(_VSTD::move(__x)).first;} + iterator insert(const_iterator, const value_type& __x) + {return insert(__x).first;} #endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p);} @@ -717,7 +709,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Value, class _Hash, class _Pred, class _Alloc> inline @@ -752,10 +744,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list<value_type> __il) @@ -792,10 +780,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_set<_Value, _Hash, _Pred, _Alloc>& @@ -806,10 +790,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_set<_Value, _Hash, _Pred, _Alloc>& @@ -820,7 +800,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> @@ -949,13 +929,11 @@ public: explicit unordered_multiset(const allocator_type& __a); unordered_multiset(const unordered_multiset& __u); unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multiset(unordered_multiset&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multiset(initializer_list<value_type> __il); unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), @@ -971,7 +949,7 @@ public: unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~unordered_multiset() = default; _LIBCPP_INLINE_VISIBILITY unordered_multiset& operator=(const unordered_multiset& __u) @@ -979,14 +957,12 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multiset& operator=(unordered_multiset&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multiset& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -1012,7 +988,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template <class... _Args> _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -1021,29 +997,27 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) - _LIBCPP_INLINE_VISIBILITY - iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} -#endif - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, const value_type& __x) - {return __table_.__insert_multi(__p, __x);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __x) {return __table_.__insert_multi(__p, _VSTD::move(__x));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, const value_type& __x) + {return __table_.__insert_multi(__p, __x);} + + template <class _InputIterator> + _LIBCPP_INLINE_VISIBILITY + void insert(_InputIterator __first, _InputIterator __last); _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p);} @@ -1224,7 +1198,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Value, class _Hash, class _Pred, class _Alloc> inline @@ -1259,10 +1233,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list<value_type> __il) @@ -1299,10 +1269,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& @@ -1314,10 +1280,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& @@ -1328,7 +1290,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> diff --git a/include/utility b/include/utility index 1f41c0771128..be73207133b5 100644 --- a/include/utility +++ b/include/utility @@ -272,14 +272,14 @@ swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::v template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG typename conditional < !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&& >::type -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG const _Tp& #endif move_if_noexcept(_Tp& __x) _NOEXCEPT @@ -293,7 +293,7 @@ template <class _Tp> void as_const(const _Tp&&) = delete; #endif struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { }; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_UTILITY) extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); #else constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); @@ -608,8 +608,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) __x.swap(__y); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> struct __make_pair_return_impl @@ -638,7 +637,7 @@ make_pair(_T1&& __t1, _T2&& __t2) (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG template <class _T1, class _T2> inline _LIBCPP_INLINE_VISIBILITY @@ -648,7 +647,7 @@ make_pair(_T1 __x, _T2 __y) return pair<_T1, _T2>(__x, __y); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _T1, class _T2> class _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> > @@ -685,8 +684,7 @@ struct __get_pair<0> const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template <class _T1, class _T2> static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -698,8 +696,7 @@ struct __get_pair<0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG }; template <> @@ -717,8 +714,7 @@ struct __get_pair<1> const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template <class _T1, class _T2> static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -730,8 +726,7 @@ struct __get_pair<1> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG }; template <size_t _Ip, class _T1, class _T2> @@ -750,8 +745,7 @@ get(const pair<_T1, _T2>& __p) _NOEXCEPT return __get_pair<_Ip>::get(__p); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template <size_t _Ip, class _T1, class _T2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& @@ -767,8 +761,7 @@ get(const pair<_T1, _T2>&& __p) _NOEXCEPT { return __get_pair<_Ip>::get(_VSTD::move(__p)); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 template <class _T1, class _T2> @@ -906,7 +899,7 @@ inline constexpr in_place_t in_place{}; template <class _Tp> -struct _LIBCPP_TYPE_VIS in_place_type_t { +struct _LIBCPP_TEMPLATE_VIS in_place_type_t { explicit in_place_type_t() = default; }; template <class _Tp> diff --git a/include/valarray b/include/valarray index f0f1f62a1db8..f8e19acdb719 100644 --- a/include/valarray +++ b/include/valarray @@ -807,13 +807,11 @@ public: valarray(const value_type& __x, size_t __n); valarray(const value_type* __p, size_t __n); valarray(const valarray& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY valarray(valarray&& __v) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS valarray(initializer_list<value_type> __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG valarray(const slice_array<value_type>& __sa); valarray(const gslice_array<value_type>& __ga); valarray(const mask_array<value_type>& __ma); @@ -823,14 +821,12 @@ public: // assignment: valarray& operator=(const valarray& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY valarray& operator=(valarray&& __v) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY valarray& operator=(initializer_list<value_type>); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY valarray& operator=(const value_type& __x); _LIBCPP_INLINE_VISIBILITY @@ -861,32 +857,32 @@ public: __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const; _LIBCPP_INLINE_VISIBILITY gslice_array<value_type> operator[](const gslice& __gs); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const; _LIBCPP_INLINE_VISIBILITY gslice_array<value_type> operator[](gslice&& __gs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const; _LIBCPP_INLINE_VISIBILITY mask_array<value_type> operator[](const valarray<bool>& __vb); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const; _LIBCPP_INLINE_VISIBILITY mask_array<value_type> operator[](valarray<bool>&& __vb); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const; _LIBCPP_INLINE_VISIBILITY indirect_array<value_type> operator[](const valarray<size_t>& __vs); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const; _LIBCPP_INLINE_VISIBILITY indirect_array<value_type> operator[](valarray<size_t>&& __vs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG // unary operators: valarray operator+() const; @@ -1480,7 +1476,7 @@ public: __stride_(__stride) {__init(__start);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY gslice(size_t __start, const valarray<size_t>& __size, @@ -1503,7 +1499,7 @@ public: __stride_(move(__stride)) {__init(__start);} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG // gslice(const gslice&) = default; // gslice(gslice&&) = default; @@ -1656,12 +1652,12 @@ private: __1d_(__gs.__1d_) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG gslice_array(gslice&& __gs, const valarray<value_type>& __v) : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(move(__gs.__1d_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class> friend class valarray; }; @@ -2353,7 +2349,7 @@ private: __1d_(__ia) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v) @@ -2361,7 +2357,7 @@ private: __1d_(move(__ia)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class> friend class valarray; }; @@ -2572,7 +2568,7 @@ private: __1d_(__ia) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e) @@ -2580,7 +2576,7 @@ private: __1d_(move(__ia)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG public: _LIBCPP_INLINE_VISIBILITY @@ -2814,7 +2810,7 @@ valarray<_Tp>::valarray(const valarray& __v) } } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -2825,10 +2821,6 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT __v.__begin_ = __v.__end_ = nullptr; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Tp> valarray<_Tp>::valarray(initializer_list<value_type> __il) : __begin_(0), @@ -2855,7 +2847,7 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il) } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _Tp> valarray<_Tp>::valarray(const slice_array<value_type>& __sa) @@ -2990,7 +2982,7 @@ valarray<_Tp>::operator=(const valarray& __v) return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3005,10 +2997,6 @@ valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <class _Tp> inline valarray<_Tp>& @@ -3020,7 +3008,7 @@ valarray<_Tp>::operator=(initializer_list<value_type> __il) return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3132,7 +3120,7 @@ valarray<_Tp>::operator[](const gslice& __gs) return gslice_array<value_type>(__gs, *this); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3150,7 +3138,7 @@ valarray<_Tp>::operator[](gslice&& __gs) return gslice_array<value_type>(move(__gs), *this); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3168,7 +3156,7 @@ valarray<_Tp>::operator[](const valarray<bool>& __vb) return mask_array<value_type>(__vb, *this); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3186,7 +3174,7 @@ valarray<_Tp>::operator[](valarray<bool>&& __vb) return mask_array<value_type>(move(__vb), *this); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3204,7 +3192,7 @@ valarray<_Tp>::operator[](const valarray<size_t>& __vs) return indirect_array<value_type>(__vs, *this); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> inline @@ -3222,7 +3210,7 @@ valarray<_Tp>::operator[](valarray<size_t>&& __vs) return indirect_array<value_type>(move(__vs), *this); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template <class _Tp> valarray<_Tp> diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8f1d57158028..15dc05c761c2 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -241,11 +241,16 @@ endif() if (LIBCXX_ENABLE_STATIC) add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>) target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) + set(STATIC_OUTPUT_NAME "c++") + if (WIN32) + set(STATIC_OUTPUT_NAME "libc++") + endif() set_target_properties(cxx_static PROPERTIES LINK_FLAGS "${LIBCXX_LINK_FLAGS}" - OUTPUT_NAME "c++" + OUTPUT_NAME "${STATIC_OUTPUT_NAME}" ) + list(APPEND LIBCXX_TARGETS "cxx_static") # Attempt to merge the libc++.a archive and the ABI library archive into one. if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) diff --git a/src/iostream.cpp b/src/iostream.cpp index a972be95499b..534b47a917d5 100644 --- a/src/iostream.cpp +++ b/src/iostream.cpp @@ -15,14 +15,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_STDIN _ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cin@__1@std@@3V?$basic_istream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin[sizeof(__stdinbuf <char>)]; static mbstate_t mb_cin; _ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcin@__1@std@@3V?$basic_istream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -32,14 +32,14 @@ static mbstate_t mb_wcin; #ifndef _LIBCPP_HAS_NO_STDOUT _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cout@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)]; static mbstate_t mb_cout; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcout@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -48,14 +48,14 @@ static mbstate_t mb_wcout; #endif _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cerr@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)]; static mbstate_t mb_cerr; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcerr@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -63,12 +63,12 @@ _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wcha static mbstate_t mb_wcerr; _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?clog@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wclog@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; diff --git a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp index 43324e9418f9..30cf3f42e902 100644 --- a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp +++ b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp @@ -13,6 +13,7 @@ #include <vector> #include <cassert> +#include "test_macros.h" #include "asan_testing.h" class X { @@ -70,7 +71,7 @@ void test_push_back() { } void test_emplace_back() { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 std::vector<X> v; v.reserve(2); v.push_back(X(2)); @@ -83,7 +84,7 @@ void test_emplace_back() { } assert(v.size() == 1); assert(is_contiguous_container_asan_correct(v)); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } void test_insert_range() { @@ -121,7 +122,7 @@ void test_insert() { } void test_emplace() { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 std::vector<X> v; v.reserve(3); v.insert(v.end(), X(1)); @@ -135,7 +136,7 @@ void test_emplace() { } assert(v.size() == 2); assert(is_contiguous_container_asan_correct(v)); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } void test_insert_range2() { diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp index d924a57ffeab..fa3ebf260486 100644 --- a/test/libcxx/iterators/trivial_iterators.pass.cpp +++ b/test/libcxx/iterators/trivial_iterators.pass.cpp @@ -179,7 +179,7 @@ int main() static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::const_iterator> ::value), ""); diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp index b236c5180b93..7dea53c4c3e9 100644 --- a/test/libcxx/strings/iterators.exceptions.pass.cpp +++ b/test/libcxx/strings/iterators.exceptions.pass.cpp @@ -80,7 +80,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), ""); diff --git a/test/libcxx/strings/iterators.noexcept.pass.cpp b/test/libcxx/strings/iterators.noexcept.pass.cpp index b8e0b4cdf34d..20b4e3d769e5 100644 --- a/test/libcxx/strings/iterators.noexcept.pass.cpp +++ b/test/libcxx/strings/iterators.noexcept.pass.cpp @@ -28,6 +28,7 @@ #include <vector> #include <initializer_list> +#include "test_macros.h" #include "test_iterators.h" int main() @@ -72,7 +73,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), ""); diff --git a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp index 1c715e04970c..886884234b46 100644 --- a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp +++ b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // type_traits // extension @@ -16,7 +18,6 @@ #include <type_traits> -#ifndef _LIBCPP_HAS_NO_CONSTEXPR struct A { @@ -54,11 +55,9 @@ struct J constexpr J* operator&() const &&; }; -#endif // _LIBCPP_HAS_NO_CONSTEXPR int main() { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR static_assert(std::__has_operator_addressof<int>::value == false, ""); static_assert(std::__has_operator_addressof<A>::value == false, ""); static_assert(std::__has_operator_addressof<B>::value == true, ""); @@ -67,5 +66,4 @@ int main() static_assert(std::__has_operator_addressof<G>::value == true, ""); static_assert(std::__has_operator_addressof<H>::value == true, ""); static_assert(std::__has_operator_addressof<J>::value == true, ""); -#endif // _LIBCPP_HAS_NO_CONSTEXPR } diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp index 9a954d934c4e..0c1cc15445f7 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp @@ -16,10 +16,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" template <class InIter, class OutIter> @@ -38,8 +37,7 @@ test() assert(ia[i] == ib[i]); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class InIter, class OutIter> void test1() @@ -55,8 +53,7 @@ test1() for (unsigned i = 0; i < N; ++i) assert(*ib[i] == static_cast<int>(i)); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif int main() { @@ -95,7 +92,7 @@ int main() test<const int*, random_access_iterator<int*> >(); test<const int*, int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test1<input_iterator<std::unique_ptr<int>*>, output_iterator<std::unique_ptr<int>*> >(); test1<input_iterator<std::unique_ptr<int>*>, input_iterator<std::unique_ptr<int>*> >(); test1<input_iterator<std::unique_ptr<int>*>, forward_iterator<std::unique_ptr<int>*> >(); @@ -130,5 +127,5 @@ int main() test1<std::unique_ptr<int>*, bidirectional_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*, random_access_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*, std::unique_ptr<int>*>(); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp index c5f9d3ac7b6b..9b3df5af4324 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp @@ -16,10 +16,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" template <class InIter, class OutIter> @@ -38,8 +37,7 @@ test() assert(ia[i] == ib[i]); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class InIter, class OutIter> void test1() @@ -55,8 +53,7 @@ test1() for (unsigned i = 0; i < N; ++i) assert(*ib[i] == static_cast<int>(i)); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif int main() { @@ -72,7 +69,7 @@ int main() test<const int*, random_access_iterator<int*> >(); test<const int*, int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test1<bidirectional_iterator<std::unique_ptr<int>*>, bidirectional_iterator<std::unique_ptr<int>*> >(); test1<bidirectional_iterator<std::unique_ptr<int>*>, random_access_iterator<std::unique_ptr<int>*> >(); test1<bidirectional_iterator<std::unique_ptr<int>*>, std::unique_ptr<int>*>(); @@ -84,5 +81,5 @@ int main() test1<std::unique_ptr<int>*, bidirectional_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*, random_access_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*, std::unique_ptr<int>*>(); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp index 8eddfbc4d048..ce74684f3c96 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp @@ -17,9 +17,7 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#include <memory> -#endif + #include "test_iterators.h" diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp index 80f86568c4d9..a77a9eddb191 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp @@ -17,10 +17,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" template <class Iter> @@ -39,8 +38,7 @@ test() assert(ia[5] == 4); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class Iter> void test1() @@ -62,8 +60,7 @@ test1() assert(*ia[4] == 3); assert(*ia[5] == 4); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -72,12 +69,10 @@ int main() test<random_access_iterator<int*> >(); test<int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1<forward_iterator<std::unique_ptr<int>*> >(); test1<bidirectional_iterator<std::unique_ptr<int>*> >(); test1<random_access_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp index b234431295a4..c40f3e727836 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp @@ -18,10 +18,9 @@ #include <algorithm> #include <functional> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" #include "counting_predicates.hpp" @@ -46,8 +45,7 @@ test() assert(cp.count() == sa); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 struct pred { bool operator()(const std::unique_ptr<int>& i) {return *i == 2;} @@ -77,8 +75,7 @@ test1() assert(*ia[4] == 3); assert(*ia[5] == 4); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -87,12 +84,10 @@ int main() test<random_access_iterator<int*> >(); test<int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1<forward_iterator<std::unique_ptr<int>*> >(); test1<bidirectional_iterator<std::unique_ptr<int>*> >(); test1<random_access_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp index 64a5a6a5a064..84f2c8c9f11d 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp @@ -16,10 +16,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" template<class Iter1, class Iter2> @@ -38,8 +37,7 @@ test() assert(j[2] == 3); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template<class Iter1, class Iter2> void test1() @@ -59,8 +57,7 @@ test1() assert(*j[1] == 2); assert(*j[2] == 3); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 void test2() { @@ -131,8 +128,7 @@ int main() test<int*, random_access_iterator<int*> >(); test<int*, int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1<forward_iterator<std::unique_ptr<int>*>, forward_iterator<std::unique_ptr<int>*> >(); test1<forward_iterator<std::unique_ptr<int>*>, bidirectional_iterator<std::unique_ptr<int>*> >(); test1<forward_iterator<std::unique_ptr<int>*>, random_access_iterator<std::unique_ptr<int>*> >(); @@ -152,8 +148,7 @@ int main() test1<std::unique_ptr<int>*, bidirectional_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*, random_access_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*, std::unique_ptr<int>*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 test2(); } diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp index ab4ffad60f9e..049ccfe9871a 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp @@ -17,10 +17,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" template <class Iter> @@ -84,7 +83,7 @@ test() assert(ii[2] == 2); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 struct do_nothing { @@ -168,8 +167,7 @@ test1() assert(*ii[1] == 1); assert(*ii[2] == 2); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -178,12 +176,10 @@ int main() test<random_access_iterator<int*> >(); test<int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1<forward_iterator<Ptr*> >(); test1<bidirectional_iterator<Ptr*> >(); test1<random_access_iterator<Ptr*> >(); test1<Ptr*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp index c6df235bed6d..1640052058c7 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp @@ -17,10 +17,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" struct count_equal @@ -110,7 +109,7 @@ test() assert(count_equal::count == si-1); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 struct do_nothing { @@ -210,8 +209,7 @@ test1() assert(*ii[2] == 2); assert(count_equal::count == si-1); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -220,12 +218,10 @@ int main() test<random_access_iterator<int*> >(); test<int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1<forward_iterator<Ptr*> >(); test1<bidirectional_iterator<Ptr*> >(); test1<random_access_iterator<Ptr*> >(); test1<Ptr*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp index 8e7931f7ea5d..33b8ff9ae43c 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp @@ -18,9 +18,9 @@ #include <functional> #include <random> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" struct indirect_less { @@ -29,7 +29,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES std::mt19937 randomness; @@ -53,7 +52,7 @@ int main() { test(1000); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { const int N = 1000; std::unique_ptr<int>* ia = new std::unique_ptr<int> [N]; @@ -68,5 +67,5 @@ int main() } delete [] ia; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp index 38d09ceda6e2..1b1987aa9205 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp @@ -19,9 +19,10 @@ #include <functional> #include <random> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" + struct indirect_less { template <class P> @@ -29,8 +30,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void test(int N) @@ -51,7 +50,7 @@ int main() { test(1000); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { const int N = 1000; std::unique_ptr<int>* ia = new std::unique_ptr<int> [N]; @@ -65,5 +64,5 @@ int main() } delete [] ia; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp index c0a05e4209b3..02839abab337 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp @@ -18,9 +18,10 @@ #include <functional> #include <random> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" + struct indirect_less { template <class P> @@ -28,8 +29,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void test(int N) @@ -53,7 +52,7 @@ int main() test(10); test(1000); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { const int N = 1000; std::unique_ptr<int>* ia = new std::unique_ptr<int> [N]; @@ -65,5 +64,5 @@ int main() assert(std::is_sorted(ia, ia+N, indirect_less())); delete [] ia; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp index 88249ed78d27..fa30797bd3f9 100644 --- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp @@ -21,9 +21,10 @@ #include <random> #include <cassert> #include <cstddef> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" + struct indirect_less { template <class P> @@ -31,8 +32,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void @@ -78,7 +77,7 @@ int main() test(1000); test(1009); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector<std::unique_ptr<int> > v(1000); for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i) @@ -86,5 +85,5 @@ int main() std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less()); assert(static_cast<std::size_t>(*v[v.size()/2]) == v.size()/2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp index 847a5829140a..fb7976713719 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp @@ -21,9 +21,10 @@ #include <random> #include <cassert> #include <cstddef> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" + struct indirect_less { template <class P> @@ -31,8 +32,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void @@ -84,7 +83,7 @@ int main() test_larger_sorts(1009); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector<std::unique_ptr<int> > v(1000); for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i) @@ -93,5 +92,5 @@ int main() for (int i = 0; static_cast<std::size_t>(i) < v.size()/2; ++i) assert(*v[i] == i); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp index c77015993c8c..87d66c4723d1 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp @@ -20,9 +20,10 @@ #include <vector> #include <cassert> #include <cstddef> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" + struct indirect_less { template <class P> @@ -30,8 +31,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { { @@ -43,7 +42,7 @@ int main() assert(std::is_sorted(v.begin(), v.end())); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector<std::unique_ptr<int> > v(1000); for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i) @@ -54,5 +53,5 @@ int main() assert(*v[1] == 1); assert(*v[2] == 2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp index 347711bf5e3a..8306cc3b1b12 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp @@ -21,9 +21,10 @@ #include <random> #include <cassert> #include <cstddef> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> +#include "test_macros.h" + struct indirect_less { template <class P> @@ -31,8 +32,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; struct first_only @@ -72,7 +71,7 @@ int main() { test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector<std::unique_ptr<int> > v(1000); for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i) @@ -83,5 +82,5 @@ int main() assert(*v[1] == 1); assert(*v[2] == 2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/containers/Emplaceable.h b/test/std/containers/Emplaceable.h index 34dd326203b0..f9319d410d2b 100644 --- a/test/std/containers/Emplaceable.h +++ b/test/std/containers/Emplaceable.h @@ -10,7 +10,10 @@ #ifndef EMPLACEABLE_H #define EMPLACEABLE_H -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#include <utility> +#include "test_macros.h" + +#if TEST_STD_VER >= 11 class Emplaceable { @@ -49,6 +52,5 @@ struct hash<Emplaceable> } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#endif // TEST_STD_VER >= 11 #endif // EMPLACEABLE_H diff --git a/test/std/containers/associative/map/map.access/index_tuple.pass.cpp b/test/std/containers/associative/map/map.access/index_tuple.pass.cpp index f8fc21f1f2f5..8d27eabdf6a6 100644 --- a/test/std/containers/associative/map/map.access/index_tuple.pass.cpp +++ b/test/std/containers/associative/map/map.access/index_tuple.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -17,17 +19,13 @@ #include <map> -#ifndef _LIBCPP_HAS_NO_VARIADICS #include <tuple> -#endif int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS using namespace std; map<tuple<int,int>, size_t> m; m[make_tuple(2,3)]=7; -#endif } diff --git a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp index 679600662fda..354911b76071 100644 --- a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair<const int, double> V; std::map<int, double> m = @@ -45,7 +46,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; std::map<int, double, std::less<int>, min_allocator<V>> m = @@ -70,6 +70,4 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp index c55d18f54094..0504b1adc22e 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair<const int, double> V; std::map<int, double> m = @@ -41,7 +42,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; std::map<int, double, std::less<int>, min_allocator<V>> m = @@ -62,6 +62,4 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp index 3133eb2e0dd6..d9c1fb89854b 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair<const int, double> V; typedef test_compare<std::less<int> > C; @@ -42,7 +43,6 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.key_comp() == C(3)); } -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; typedef test_compare<std::less<int> > C; @@ -64,6 +64,4 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.key_comp() == C(3)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp index d7552b3608eb..70783e625770 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair<const int, double> V; typedef test_compare<std::less<int> > C; @@ -45,7 +46,6 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == A(6)); } -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; typedef test_compare<std::less<int> > C; @@ -69,7 +69,6 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == A()); } -#if TEST_STD_VER > 11 { typedef std::pair<const int, double> V; typedef min_allocator<V> A; @@ -94,7 +93,6 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.get_allocator() == a); } -#endif { typedef std::pair<const int, double> V; typedef explicit_allocator<V> A; @@ -119,6 +117,4 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == a); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/move.pass.cpp b/test/std/containers/associative/map/map.cons/move.pass.cpp index 2d19b88bdda8..dd68f9c39ec8 100644 --- a/test/std/containers/associative/map/map.cons/move.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef std::pair<const int, double> V; { typedef test_compare<std::less<int> > C; @@ -69,7 +70,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#if TEST_STD_VER >= 11 { typedef test_compare<std::less<int> > C; typedef min_allocator<V> A; @@ -115,6 +115,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp index 8349f13fdebf..5f7ab8ece9f1 100644 --- a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -189,7 +190,6 @@ int main() } assert(Counter_base::gConstructed == 0); } -#if TEST_STD_VER >= 11 { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -268,6 +268,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp index 09b41d3b130b..8c0ef6e9a5c4 100644 --- a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -144,7 +145,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -185,6 +185,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp index 63d014fe8cc5..3b595fc73d7c 100644 --- a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::map<int, DefaultOnly> M; typedef std::pair<M::iterator, bool> R; @@ -92,7 +93,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M; typedef std::pair<M::iterator, bool> R; @@ -160,6 +160,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp index 319a239525ad..7236276a29a4 100644 --- a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::map<int, DefaultOnly> M; typedef M::iterator R; @@ -89,7 +90,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M; typedef M::iterator R; @@ -155,6 +155,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp index 9cf3f3dcf74f..de8191a6bb60 100644 --- a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair<const int, double> V; std::map<int, double> m = @@ -43,7 +44,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; std::map<int, double, std::less<int>, min_allocator<V>> m = @@ -66,6 +66,4 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp index 4c0326d90fe6..ae4ab349d234 100644 --- a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap<int, double> C; typedef C::value_type V; @@ -50,7 +51,6 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#if TEST_STD_VER >= 11 { typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C; typedef C::value_type V; @@ -80,6 +80,4 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp index 6f645b63b44c..54b948c3e551 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap<int, double> C; typedef C::value_type V; @@ -49,7 +50,6 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#if TEST_STD_VER >= 11 { typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C; typedef C::value_type V; @@ -78,6 +78,4 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp index 6d20d14f4200..a78e1889ac9e 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare<std::less<int> > Cmp; typedef std::multimap<int, double, Cmp> C; @@ -53,7 +54,6 @@ int main() assert(*++i == V(3, 2)); assert(m.key_comp() == Cmp(4)); } -#if TEST_STD_VER >= 11 { typedef test_compare<std::less<int> > Cmp; typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C; @@ -86,6 +86,4 @@ int main() assert(*++i == V(3, 2)); assert(m.key_comp() == Cmp(4)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp index 8d12a059b89d..ba6f76e52d65 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare<std::less<int> > Cmp; typedef test_allocator<std::pair<const int, double> > A; @@ -56,8 +57,6 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A(5)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef test_compare<std::less<int> > Cmp; typedef min_allocator<std::pair<const int, double> > A; @@ -92,7 +91,6 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A()); } -#if TEST_STD_VER > 11 { typedef test_compare<std::less<int> > C; typedef std::pair<const int, double> V; @@ -124,7 +122,6 @@ int main() assert(*++i == V(3, 2)); assert(m.get_allocator() == a); } -#endif { typedef test_compare<std::less<int> > Cmp; typedef explicit_allocator<std::pair<const int, double> > A; @@ -159,5 +156,4 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A{}); } -#endif } diff --git a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp index 7edec77365d8..769c709cf203 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef std::pair<const int, double> V; { typedef test_compare<std::less<int> > C; @@ -75,7 +76,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#if TEST_STD_VER >= 11 { typedef test_compare<std::less<int> > C; typedef min_allocator<V> A; @@ -127,6 +127,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp index 6ce7127ea7cf..5882283abe3e 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -189,7 +190,6 @@ int main() } assert(Counter_base::gConstructed == 0); } -#if TEST_STD_VER >= 11 { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -268,6 +268,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp index 924e9ddf1936..24742541571a 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -144,7 +145,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair<MoveOnly, MoveOnly> V; typedef std::pair<const MoveOnly, MoveOnly> VC; @@ -185,6 +185,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp index 7f5b698fa068..024cc670e814 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multimap<int, DefaultOnly> M; typedef M::iterator R; @@ -84,7 +85,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M; typedef M::iterator R; @@ -145,6 +145,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp index a6ed318c7598..d5fde83a7b65 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multimap<int, DefaultOnly> M; typedef M::iterator R; @@ -89,7 +90,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M; typedef M::iterator R; @@ -155,6 +155,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp index 89befb3e9971..20e0ba17ef42 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <map> // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap<int, double> C; typedef C::value_type V; @@ -53,7 +54,6 @@ int main() assert(*++i == V(3, 2)); assert(*++i == V(3, 1.5)); } -#if TEST_STD_VER >= 11 { typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C; typedef C::value_type V; @@ -86,6 +86,4 @@ int main() assert(*++i == V(3, 2)); assert(*++i == V(3, 1.5)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/emplace.pass.cpp b/test/std/containers/associative/multiset/emplace.pass.cpp index 93842a250f8e..7e2628db0daa 100644 --- a/test/std/containers/associative/multiset/emplace.pass.cpp +++ b/test/std/containers/associative/multiset/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset<DefaultOnly> M; typedef M::iterator R; @@ -68,7 +69,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#if TEST_STD_VER >= 11 { typedef std::multiset<int, std::less<int>, min_allocator<int>> M; typedef M::iterator R; @@ -78,6 +78,4 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/test/std/containers/associative/multiset/emplace_hint.pass.cpp index 48519fd4356a..2b9b92d0bf0a 100644 --- a/test/std/containers/associative/multiset/emplace_hint.pass.cpp +++ b/test/std/containers/associative/multiset/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset<DefaultOnly> M; typedef M::iterator R; @@ -68,7 +69,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#if TEST_STD_VER >= 11 { typedef std::multiset<int, std::less<int>, min_allocator<int>> M; typedef M::iterator R; @@ -78,6 +78,4 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp index 590c66801f99..23a65a3ccf54 100644 --- a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset<int> C; typedef C::value_type V; @@ -39,8 +40,6 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef std::multiset<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -58,5 +57,4 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#endif } diff --git a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp index 0afc8dc87c23..f39fca5c8f38 100644 --- a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset<MoveOnly> M; typedef M::iterator R; @@ -46,8 +47,6 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M; typedef M::iterator R; @@ -72,5 +71,4 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif } diff --git a/test/std/containers/associative/multiset/insert_rv.pass.cpp b/test/std/containers/associative/multiset/insert_rv.pass.cpp index 3ee464bc5bc7..68d348793c45 100644 --- a/test/std/containers/associative/multiset/insert_rv.pass.cpp +++ b/test/std/containers/associative/multiset/insert_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset<MoveOnly> M; typedef M::iterator R; @@ -46,8 +47,6 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M; typedef M::iterator R; @@ -72,5 +71,4 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp index 2c5318afd73b..915a15fc65ac 100644 --- a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset<int> C; typedef C::value_type V; @@ -36,8 +37,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef std::multiset<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -53,5 +52,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp index b3d6066ebeb3..f3ee002dc5f4 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset<int> C; typedef C::value_type V; @@ -36,8 +37,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef std::multiset<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -52,7 +51,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#if TEST_STD_VER > 11 { typedef std::multiset<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -69,6 +67,4 @@ int main() assert(*++i == V(6)); assert(m.get_allocator() == a); } -#endif -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp index c67657aff8ac..3312ca1383ef 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare<std::less<int> > Cmp; typedef std::multiset<int, Cmp> C; typedef C::value_type V; @@ -34,5 +35,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp index 83114893a1b2..e495fce1396c 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare<std::less<int> > Cmp; typedef test_allocator<int> A; typedef std::multiset<int, Cmp, A> C; @@ -37,5 +38,4 @@ int main() assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); assert(m.get_allocator() == A(4)); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp index 5a905cf15a08..2adfb5c37a4f 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int V; typedef test_compare<std::less<int> > C; @@ -76,8 +77,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -115,5 +114,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp index 3da3fc09a45f..29797c3ee6be 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare<std::less<MoveOnly> > C; @@ -183,5 +184,4 @@ int main() } assert(Counter_base::gConstructed == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp index b0ec4f39451c..e767ff1a47f5 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare<std::less<MoveOnly> > C; @@ -141,8 +142,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef MoveOnly V; typedef test_compare<std::less<MoveOnly> > C; @@ -182,5 +181,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif } diff --git a/test/std/containers/associative/set/emplace.pass.cpp b/test/std/containers/associative/set/emplace.pass.cpp index 47ef455a996b..5d50a2435fa8 100644 --- a/test/std/containers/associative/set/emplace.pass.cpp +++ b/test/std/containers/associative/set/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set<DefaultOnly> M; typedef std::pair<M::iterator, bool> R; @@ -74,7 +75,6 @@ int main() assert(m.size() == 1); assert(*r.first == 2); } -#if TEST_STD_VER >= 11 { typedef std::set<int, std::less<int>, min_allocator<int>> M; typedef std::pair<M::iterator, bool> R; @@ -85,6 +85,4 @@ int main() assert(m.size() == 1); assert(*r.first == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/emplace_hint.pass.cpp b/test/std/containers/associative/set/emplace_hint.pass.cpp index 036f4d6dfb68..8962c0cbd7ab 100644 --- a/test/std/containers/associative/set/emplace_hint.pass.cpp +++ b/test/std/containers/associative/set/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set<DefaultOnly> M; typedef M::iterator R; @@ -68,7 +69,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#if TEST_STD_VER >= 11 { typedef std::set<int, std::less<int>, min_allocator<int>> M; typedef M::iterator R; @@ -78,6 +78,4 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/test/std/containers/associative/set/insert_initializer_list.pass.cpp index 490d75905adc..3114d48abd40 100644 --- a/test/std/containers/associative/set/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/set/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set<int> C; typedef C::value_type V; @@ -39,7 +40,6 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#if TEST_STD_VER >= 11 { typedef std::set<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -57,6 +57,4 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/insert_iter_rv.pass.cpp b/test/std/containers/associative/set/insert_iter_rv.pass.cpp index be827d644d26..9579988c0899 100644 --- a/test/std/containers/associative/set/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/set/insert_iter_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set<MoveOnly> M; typedef M::iterator R; @@ -46,7 +47,6 @@ int main() assert(m.size() == 3); assert(*r == 3); } -#if TEST_STD_VER >= 11 { typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M; typedef M::iterator R; @@ -71,6 +71,4 @@ int main() assert(m.size() == 3); assert(*r == 3); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/insert_rv.pass.cpp b/test/std/containers/associative/set/insert_rv.pass.cpp index e528ef347b88..25cbfcb882cd 100644 --- a/test/std/containers/associative/set/insert_rv.pass.cpp +++ b/test/std/containers/associative/set/insert_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set<MoveOnly> M; typedef std::pair<M::iterator, bool> R; @@ -50,7 +51,6 @@ int main() assert(m.size() == 3); assert(*r.first == 3); } -#if TEST_STD_VER >= 11 { typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M; typedef std::pair<M::iterator, bool> R; @@ -79,6 +79,4 @@ int main() assert(m.size() == 3); assert(*r.first == 3); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp index 70e174a59612..9906a1c0b64d 100644 --- a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set<int> C; typedef C::value_type V; @@ -36,7 +37,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#if TEST_STD_VER >= 11 { typedef std::set<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -52,6 +52,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp index 5bb5460ddc0d..31521b2f3856 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set<int> C; typedef C::value_type V; @@ -35,7 +36,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#if TEST_STD_VER >= 11 { typedef std::set<int, std::less<int>, min_allocator<int>> C; typedef C::value_type V; @@ -50,6 +50,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp index a0afa02cf749..ea72b6dc0260 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare<std::less<int> > Cmp; typedef std::set<int, Cmp> C; typedef C::value_type V; @@ -34,5 +35,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp index 80d41b0b5df7..f6cb734c3c29 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare<std::less<int> > Cmp; typedef test_allocator<int> A; @@ -41,7 +42,6 @@ int main() assert(m.key_comp() == Cmp(10)); assert(m.get_allocator() == A(4)); } -#if TEST_STD_VER > 11 { typedef test_compare<std::less<int> > Cmp; typedef test_allocator<int> A; @@ -59,6 +59,4 @@ int main() assert(*++i == V(6)); assert(m.get_allocator() == A(4)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/move.pass.cpp b/test/std/containers/associative/set/set.cons/move.pass.cpp index c836d4550203..dd313e4cd5e3 100644 --- a/test/std/containers/associative/set/set.cons/move.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int V; typedef test_compare<std::less<int> > C; @@ -70,7 +71,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -102,6 +102,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp index ba2adf5bb520..9e1cd816b116 100644 --- a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare<std::less<MoveOnly> > C; @@ -184,5 +185,4 @@ int main() assert(Counter_base::gConstructed == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp index 07cb4153fa4a..7862f7bf7ebc 100644 --- a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <set> // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare<std::less<MoveOnly> > C; @@ -141,7 +142,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#if TEST_STD_VER >= 11 { typedef MoveOnly V; typedef test_compare<std::less<MoveOnly> > C; @@ -181,6 +181,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp index b102f117d48f..6210a59c3abe 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp @@ -15,6 +15,7 @@ #include <queue> #include <cassert> +#include "test_macros.h" #include "test_allocator.h" template <class T> @@ -30,11 +31,11 @@ struct test : base(comp, c, a) {} test(const value_compare& comp, const container_type& c, const test_allocator<int>& a) : base(comp, c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(const value_compare& comp, container_type&& c, const test_allocator<int>& a) : base(comp, std::move(c), a) {} test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator<int> get_allocator() {return c.get_allocator();} using base::c; diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp index 4d99fc14728b..b1d13fb8b9f7 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp @@ -15,6 +15,7 @@ #include <queue> #include <cassert> +#include "test_macros.h" #include "test_allocator.h" template <class T> @@ -30,11 +31,11 @@ struct test : base(comp, a) {} test(const value_compare& comp, const container_type& c, const test_allocator<int>& a) : base(comp, c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(const value_compare& comp, container_type&& c, const test_allocator<int>& a) : base(comp, std::move(c), a) {} test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator<int> get_allocator() {return c.get_allocator();} using base::c; diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp index 8bdf7db863e7..df255b4cf12a 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // template <class Alloc> @@ -17,7 +19,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -52,11 +53,9 @@ struct test using base::c; }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5), test_allocator<MoveOnly>(2)); @@ -64,5 +63,4 @@ int main() assert(q.size() == 5); assert(q.c.get_allocator() == test_allocator<MoveOnly>(6)); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp index d43e53819975..4b20b265ff34 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // priority_queue& operator=(priority_queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,15 +29,12 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5)); std::priority_queue<MoveOnly> q; q = std::move(qo); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp index b61fb88a5a36..719f6d98078f 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // explicit priority_queue(const Compare& comp, container_type&& c); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,13 +29,10 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue<MoveOnly> q(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5)); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp index 7abe796e53ef..450dff37c52f 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // template <class InputIterator> @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES int a[] = {3, 5, 2, 0, 6, 8, 1}; const int n = sizeof(a)/sizeof(a[0]); std::priority_queue<MoveOnly> q(a+n/2, a+n, @@ -28,5 +29,4 @@ int main() std::vector<MoveOnly>(a, a+n/2)); assert(q.size() == n); assert(q.top() == MoveOnly(8)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp index aac8403e5922..229ec02fcea1 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // priority_queue(priority_queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,14 +29,11 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5)); std::priority_queue<MoveOnly> q = std::move(qo); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp index 5dec2b910fb7..e0547d64a014 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // priority_queue() @@ -15,7 +17,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 #include <queue> #include <cassert> @@ -30,5 +31,5 @@ int main() typedef std::priority_queue<MoveOnly> C; static_assert(std::is_nothrow_default_constructible<C>::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp index 0218992670f2..9c2058d47877 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // priority_queue(priority_queue&&) @@ -15,8 +17,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 - #include <queue> #include <cassert> diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp index 4f14e93f5f52..be928fc2ea4c 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // priority_queue(); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue<Emplaceable> q; q.emplace(1, 2.5); assert(q.top() == Emplaceable(1, 2.5)); @@ -28,5 +29,4 @@ int main() assert(q.top() == Emplaceable(3, 4.5)); q.emplace(2, 3.5); assert(q.top() == Emplaceable(3, 4.5)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp index 4b20a9bf905f..7f48272679b1 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // priority_queue(); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue<MoveOnly> q; q.push(1); assert(q.top() == 1); @@ -28,5 +29,4 @@ int main() assert(q.top() == 3); q.push(2); assert(q.top() == 3); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp index b3ee758182a5..404db124080b 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp @@ -15,6 +15,7 @@ #include <queue> #include <cassert> +#include "test_macros.h" #include "test_allocator.h" struct test @@ -24,10 +25,10 @@ struct test explicit test(const test_allocator<int>& a) : base(a) {} test(const container_type& c, const test_allocator<int>& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {} test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator<int> get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp index e4fff91f07c7..06a53fe385d9 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp @@ -16,6 +16,7 @@ #include <cassert> #include <cstddef> +#include "test_macros.h" #include "test_allocator.h" template <class C> @@ -37,10 +38,10 @@ struct test explicit test(const test_allocator<int>& a) : base(a) {} test(const container_type& c, const test_allocator<int>& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {} test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator<int> get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp index 0163588efa50..243585693739 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // template <class Alloc> @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -47,13 +48,10 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4)); assert(q.get_allocator() == test_allocator<MoveOnly>(4)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp index 7237bf271b0c..76428e33fb27 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // template <class Alloc> @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -47,14 +48,11 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4)); test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5)); assert(q2.get_allocator() == test_allocator<MoveOnly>(5)); assert(q2.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp index 8dd5d2f64ec3..57e22963e3db 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // queue(queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,14 +29,11 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5)); std::queue<MoveOnly> q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp index f72067b0adcc..1b3f25608660 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // explicit queue(container_type&& c); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,12 +29,9 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp index 781d74016128..7518bcc71c08 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // queue() @@ -14,8 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 - #include <queue> #include <cassert> @@ -29,5 +29,5 @@ int main() typedef std::queue<MoveOnly> C; static_assert(std::is_nothrow_default_constructible<C>::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp index 58c8f9ddfad1..a89fbef8be0d 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // queue(queue&&) @@ -14,7 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 #include <queue> #include <cassert> @@ -29,5 +30,5 @@ int main() typedef std::queue<MoveOnly> C; static_assert(std::is_nothrow_move_constructible<C>::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp index af1b7e20c338..0932b7d99d8e 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // queue& operator=(queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,15 +29,12 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5)); std::queue<MoveOnly> q2; q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp index d8992821f1f2..2e0a19a7fe02 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <queue> // void push(value_type&& v); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue<MoveOnly> q; q.push(MoveOnly(1)); assert(q.size() == 1); @@ -32,5 +33,4 @@ int main() assert(q.size() == 3); assert(q.front() == MoveOnly(1)); assert(q.back() == MoveOnly(3)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp index 94899d4f1b54..bac8378ebbbb 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp @@ -15,6 +15,7 @@ #include <stack> #include <cassert> +#include "test_macros.h" #include "test_allocator.h" struct test @@ -24,10 +25,10 @@ struct test explicit test(const test_allocator<int>& a) : base(a) {} test(const container_type& c, const test_allocator<int>& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {} test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator<int> get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp index b3cf39207203..237870b2c220 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp @@ -16,6 +16,7 @@ #include <cassert> #include <cstddef> +#include "test_macros.h" #include "test_allocator.h" template <class C> @@ -37,10 +38,10 @@ struct test explicit test(const test_allocator<int>& a) : base(a) {} test(const container_type& c, const test_allocator<int>& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {} test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator<int> get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp index 374aa996ffe3..b0da1ef8b375 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // template <class Alloc> @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -47,13 +48,10 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4)); assert(q.get_allocator() == test_allocator<MoveOnly>(4)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp index 5fa5bd2a8bd2..e75a8a267750 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // template <class Alloc> @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -47,14 +48,11 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4)); test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5)); assert(q2.get_allocator() == test_allocator<MoveOnly>(5)); assert(q2.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp index 44fab41a6c55..d837e3d654a1 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // stack(stack&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,14 +29,11 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5)); std::stack<MoveOnly> q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp index ab08da93831e..01d467460a7a 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // explicit stack(container_type&& c); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,12 +29,9 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp index 2e217c545f9c..03c709ef6442 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // stack() @@ -14,7 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 #include <stack> #include <cassert> @@ -29,5 +30,5 @@ int main() typedef std::stack<MoveOnly> C; static_assert(std::is_nothrow_default_constructible<C>::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp index af6793f465a2..92aef08baf0d 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // stack(stack&&) @@ -14,8 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 - #include <stack> #include <cassert> @@ -29,5 +29,5 @@ int main() typedef std::stack<MoveOnly> C; static_assert(std::is_nothrow_move_constructible<C>::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp index 75cbec1c47c8..cbb63462a8d0 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // stack& operator=(stack&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class C> C @@ -28,15 +29,12 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5)); std::stack<MoveOnly> q2; q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp index 67d0ea3385f6..9165f6ecc1bb 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <stack> // void push(value_type&& v); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack<MoveOnly> q; q.push(MoveOnly(1)); assert(q.size() == 1); @@ -29,5 +30,4 @@ int main() q.push(MoveOnly(3)); assert(q.size() == 3); assert(q.top() == MoveOnly(3)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp index dbdccf13b72e..785a5be8b749 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp @@ -18,6 +18,21 @@ #include "min_allocator.h" #include "asan_testing.h" +#ifndef TEST_HAS_NO_EXCEPTIONS +struct Throws { + Throws() : v_(0) {} + Throws(int v) : v_(v) {} + Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; } + Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; } + int v_; + static bool sThrows; + }; + +bool Throws::sThrows = false; +#endif + int main() { { @@ -72,4 +87,17 @@ int main() assert(is_contiguous_container_asan_correct(l1)); } #endif +#ifndef TEST_HAS_NO_EXCEPTIONS +// Test for LWG2853: +// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T. + { + Throws arr[] = {1, 2, 3}; + std::vector<Throws> v(arr, arr+3); + Throws::sThrows = true; + v.erase(v.begin()); + v.erase(--v.end()); + v.erase(v.begin()); + assert(v.size() == 0); + } +#endif } diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp index f7fa0dba27e8..2fc4981b6c9f 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp @@ -18,6 +18,21 @@ #include "min_allocator.h" #include "asan_testing.h" +#ifndef TEST_HAS_NO_EXCEPTIONS +struct Throws { + Throws() : v_(0) {} + Throws(int v) : v_(v) {} + Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; } + Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; } + int v_; + static bool sThrows; + }; + +bool Throws::sThrows = false; +#endif + int main() { int a1[] = {1, 2, 3}; @@ -125,4 +140,17 @@ int main() assert(is_contiguous_container_asan_correct(outer[1])); } #endif +#ifndef TEST_HAS_NO_EXCEPTIONS +// Test for LWG2853: +// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T. + { + Throws arr[] = {1, 2, 3}; + std::vector<Throws> v(arr, arr+3); + Throws::sThrows = true; + v.erase(v.begin(), --v.end()); + assert(v.size() == 1); + v.erase(v.begin(), v.end()); + assert(v.size() == 0); + } +#endif } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp index 4d92b3d4c2c5..9fca1f105928 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -27,7 +29,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::allocator<std::pair<const int, std::string> > A; typedef std::unordered_map<int, std::string, @@ -60,7 +61,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef min_allocator<std::pair<const int, std::string> > A; typedef std::unordered_map<int, std::string, @@ -93,6 +93,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp index e86d35b0ac8b..0d08fae0c3bc 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator<std::pair<const int, std::string> > A; typedef std::unordered_map<int, std::string, @@ -167,7 +168,6 @@ int main() assert(c.max_load_factor() == 1); assert(c0.size() == 0); } -#if TEST_STD_VER >= 11 { typedef min_allocator<std::pair<const int, std::string> > A; typedef std::unordered_map<int, std::string, @@ -214,18 +214,4 @@ int main() assert(c.max_load_factor() == 1); assert(c0.size() == 0); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - std::unordered_map<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}}; - std::unordered_map<int, int>::iterator i = s1.begin(); - std::pair<const int, int> k = *i; - std::unordered_map<int, int> s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp index bebab0375d86..b06e4db1303a 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -61,7 +62,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -158,7 +158,5 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // TEST_STD_VER > 11 } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp index 9055e3dcd166..ca48808f4819 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -64,7 +65,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -98,6 +98,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp index db0010b3401c..02360f8ac1bb 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -65,7 +66,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -100,6 +100,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp index c76ce3968ad3..c6a3976560b7 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -67,7 +68,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -103,6 +103,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp index 6cb57d4ff210..5acc4c34bc1f 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -68,7 +69,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -141,6 +141,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp index 681c0e95b937..296363166618 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair<int, std::string> P; typedef test_allocator<std::pair<const int, std::string>> A; @@ -113,7 +114,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair<int, std::string> P; typedef min_allocator<std::pair<const int, std::string>> A; @@ -196,6 +196,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp index 26f716166464..18c83dd31309 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_map<int, Emplaceable> C; typedef std::pair<C::iterator, bool> R; @@ -49,7 +50,6 @@ int main() assert(r.first->first == 5); assert(r.first->second == Emplaceable(6, 7)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, Emplaceable>>> C; @@ -75,6 +75,4 @@ int main() assert(r.first->first == 5); assert(r.first->second == Emplaceable(6, 7)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp index 477f2cf02e76..ce7fa835ce8b 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -16,9 +18,6 @@ // template <class... Args> // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include <unordered_map> #include <cassert> @@ -28,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_map<int, Emplaceable> C; typedef C::iterator R; @@ -51,7 +49,6 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, Emplaceable>>> C; @@ -75,19 +72,4 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_map<int, Emplaceable> C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - R r = c.emplace_hint(c2.end(), std::piecewise_construct, - std::forward_as_tuple(3), - std::forward_as_tuple()); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp index a4d8b5d410b4..477a229d0a98 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map<int, std::string> C; typedef std::pair<int, std::string> P; @@ -45,7 +46,6 @@ int main() assert(c.at(3) == "three"); assert(c.at(4) == "four"); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, std::string>>> C; @@ -67,6 +67,4 @@ int main() assert(c.at(3) == "three"); assert(c.at(4) == "four"); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp index 6d27dec98eaa..cefbf4596550 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator<std::pair<const int, std::string> > A; typedef std::unordered_multimap<int, std::string, @@ -85,7 +86,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef min_allocator<std::pair<const int, std::string> > A; typedef std::unordered_multimap<int, std::string, @@ -142,6 +142,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp index b9b8723452fe..9bd55ac92e89 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator<std::pair<const int, std::string> > A; typedef std::unordered_multimap<int, std::string, @@ -225,7 +226,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef min_allocator<std::pair<const int, std::string> > A; typedef std::unordered_multimap<int, std::string, @@ -291,18 +291,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - std::unordered_multimap<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}}; - std::unordered_multimap<int, int>::iterator i = s1.begin(); - std::pair<const int, int> k = *i; - std::unordered_multimap<int, int> s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp index 445fd2d82bb2..1a222cef1509 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -83,7 +84,6 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -250,7 +250,5 @@ int main() assert(c.get_allocator() == a); assert(!(c.get_allocator() == A())); } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // TEST_STD_VER > 11 } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp index 92a43b482bdf..ef75b6ce00d3 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -86,7 +87,6 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -142,6 +142,4 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >())); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp index d7afafcaec92..9981253916f1 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -87,7 +88,6 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -144,6 +144,4 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >())); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp index 9842a4bbdaf9..1ca94641cac7 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -89,7 +90,6 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -147,6 +147,4 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >())); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp index 244c3f5c657c..e8efefbee692 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -90,7 +91,6 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10))); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -208,6 +208,4 @@ int main() assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.get_allocator() == A{}); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp index 878ef598f8cb..0e004522c8d5 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -32,7 +34,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair<int, std::string> P; typedef test_allocator<std::pair<const int, std::string>> A; @@ -161,7 +162,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair<int, std::string> P; typedef min_allocator<std::pair<const int, std::string>> A; @@ -290,6 +290,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp index 96678cf33fa5..68e5267a9f56 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multimap<int, Emplaceable> C; typedef C::iterator R; @@ -46,7 +47,6 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, Emplaceable>>> C; @@ -69,6 +69,4 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp index a8095135c1c0..86950e289f3b 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -16,9 +18,6 @@ // template <class... Args> // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include <unordered_map> #include <cassert> @@ -29,7 +28,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multimap<int, Emplaceable> C; typedef C::iterator R; @@ -60,7 +58,6 @@ int main() assert(r->first == 3); LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, Emplaceable>>> C; @@ -92,19 +89,4 @@ int main() assert(r->first == 3); LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_multimap<int, Emplaceable> C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - R r = c.emplace_hint(c2.end(), std::piecewise_construct, - std::forward_as_tuple(3), - std::forward_as_tuple()); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp index e0b1c6941862..ef1577170f87 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, @@ -25,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap<int, std::string> C; typedef std::pair<int, std::string> P; @@ -71,7 +72,6 @@ int main() assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size()); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, std::string>>> C; @@ -118,6 +118,4 @@ int main() assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size()); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/emplace.pass.cpp b/test/std/containers/unord/unord.multiset/emplace.pass.cpp index d8d9e9bc5695..5d925c8d40a7 100644 --- a/test/std/containers/unord/unord.multiset/emplace.pass.cpp +++ b/test/std/containers/unord/unord.multiset/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset<Emplaceable> C; typedef C::iterator R; @@ -41,7 +42,6 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C; @@ -59,6 +59,4 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp index 3756476dc8fc..d9bab1f490e6 100644 --- a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -16,9 +18,6 @@ // template <class... Args> // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include <unordered_set> #include <cassert> @@ -28,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset<Emplaceable> C; typedef C::iterator R; @@ -46,7 +44,6 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C; @@ -65,16 +62,4 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_multiset<Emplaceable> C; - typedef C::iterator R; - C c1; - C c2; - R r = c1.emplace_hint(c2.begin(), 5, 6); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp index f5026e102c42..ffe6534b249a 100644 --- a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp @@ -15,13 +15,10 @@ // iterator insert(const_iterator p, value_type&& x); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - #include <unordered_set> #include <cassert> +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -49,7 +46,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<MoveOnly> C; typedef C::iterator R; @@ -72,8 +69,6 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C; @@ -97,7 +92,6 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C; @@ -121,18 +115,5 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_multiset<double> C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - R r = c.insert(e, P(3.5)); - assert(false); - } -#endif -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp index 9010cac99caf..88661b5699cb 100644 --- a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset<int> C; typedef int P; @@ -44,7 +45,6 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C; @@ -66,6 +66,4 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp index 04f9e34164ab..89394901071f 100644 --- a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp @@ -18,6 +18,7 @@ #include <unordered_set> #include <cassert> +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -44,7 +45,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<MoveOnly> C; typedef C::iterator R; @@ -66,8 +67,6 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C; @@ -90,7 +89,6 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C; @@ -113,6 +111,5 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp index 3e42305309fd..ce664034d1e1 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -27,7 +29,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator<int> A; typedef std::unordered_multiset<int, @@ -60,7 +61,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef min_allocator<int> A; typedef std::unordered_multiset<int, @@ -93,6 +93,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp index 658bb93e2b1a..dfcb63e6e0eb 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator<int> A; typedef std::unordered_multiset<int, @@ -172,7 +173,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef test_allocator<int> A; typedef std::unordered_multiset<int, @@ -263,18 +263,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - std::unordered_multiset<int> s1 = {1, 2, 3}; - std::unordered_multiset<int>::iterator i = s1.begin(); - int k = *i; - std::unordered_multiset<int> s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp index ced52b5e6b46..df49abe077ca 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -59,7 +60,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -159,7 +159,5 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // TEST_STD_VER > 11 } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp index 845139f98d9c..b83507934653 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -62,7 +63,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -95,6 +95,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp index 4dc78bd261cb..92edfc35b9b1 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -64,7 +65,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -98,6 +98,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp index f331208596b7..877306db6620 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -65,7 +66,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -100,6 +100,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp index 17f064f46280..e77be84630ea 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -66,7 +67,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -102,6 +102,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp index bc804b42e22d..fb144d9b1e3f 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int P; typedef test_allocator<int> A; @@ -120,7 +121,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef int P; typedef min_allocator<int> A; @@ -203,6 +203,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/emplace.pass.cpp b/test/std/containers/unord/unord.set/emplace.pass.cpp index 19af8065819c..c09ad1505cd5 100644 --- a/test/std/containers/unord/unord.set/emplace.pass.cpp +++ b/test/std/containers/unord/unord.set/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set<Emplaceable> C; typedef std::pair<C::iterator, bool> R; @@ -44,7 +45,6 @@ int main() assert(*r.first == Emplaceable(5, 6)); assert(!r.second); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C; @@ -65,6 +65,4 @@ int main() assert(*r.first == Emplaceable(5, 6)); assert(!r.second); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp index 97f3591d012b..16f9eff196a6 100644 --- a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -16,9 +18,6 @@ // template <class... Args> // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include <unordered_set> #include <cassert> @@ -28,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set<Emplaceable> C; typedef C::iterator R; @@ -46,7 +44,6 @@ int main() assert(c.size() == 2); assert(*r == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C; @@ -65,16 +62,4 @@ int main() assert(c.size() == 2); assert(*r == Emplaceable(5, 6)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_set<Emplaceable> C; - typedef C::iterator R; - C c1; - C c2; - R r = c1.emplace_hint(c2.begin(), 5, 6); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp index da94bc55382f..676c395270e9 100644 --- a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp @@ -15,13 +15,10 @@ // iterator insert(const_iterator p, value_type&& x); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - #include <unordered_set> #include <cassert> +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -49,7 +46,7 @@ int main() assert(c.size() == 3); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_set<MoveOnly> C; typedef C::iterator R; @@ -72,8 +69,6 @@ int main() assert(c.size() == 3); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_set<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C; @@ -97,7 +92,6 @@ int main() assert(c.size() == 3); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C; @@ -121,18 +115,5 @@ int main() assert(c.size() == 3); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_set<double> C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - R r = c.insert(e, P(3.5)); - assert(false); - } -#endif -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.set/insert_init.pass.cpp b/test/std/containers/unord/unord.set/insert_init.pass.cpp index 27b7290eb341..c106fed107e3 100644 --- a/test/std/containers/unord/unord.set/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set<int> C; typedef int P; @@ -44,7 +45,6 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C; @@ -66,6 +66,4 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp index 5d12f225cc6a..45b168d89a5c 100644 --- a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp @@ -18,6 +18,7 @@ #include <unordered_set> #include <cassert> +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -48,7 +49,7 @@ int main() assert(*r.first == 5.5); assert(r.second); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_set<MoveOnly> C; typedef std::pair<C::iterator, bool> R; @@ -74,8 +75,6 @@ int main() assert(*r.first == 5); assert(r.second); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_set<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C; @@ -102,7 +101,6 @@ int main() assert(*r.first == 5.5); assert(r.second); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C; @@ -129,6 +127,5 @@ int main() assert(*r.first == 5); assert(r.second); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp index 2db01a21eaac..4f7ccfec652e 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -27,7 +29,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator<int> A; typedef std::unordered_set<int, @@ -60,7 +61,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef min_allocator<int> A; typedef std::unordered_set<int, @@ -93,6 +93,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp index 78a376335c3f..bc3658243995 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator<int> A; typedef std::unordered_set<int, @@ -164,7 +165,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef min_allocator<int> A; typedef std::unordered_set<int, @@ -210,18 +210,4 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - std::unordered_set<int> s1 = {1, 2, 3}; - std::unordered_set<int>::iterator i = s1.begin(); - int k = *i; - std::unordered_set<int> s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp index eea61c7ab46c..7ba340bf9c3e 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -28,8 +30,7 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { + { typedef std::unordered_set<int, test_hash<std::hash<int> >, test_compare<std::equal_to<int> >, @@ -59,7 +60,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -160,6 +160,4 @@ int main() assert(c.max_load_factor() == 1); } #endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp index 95baa3df2852..0ca9b48572d9 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -62,7 +63,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -95,6 +95,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp index 108d67b66b22..45ed588a7bac 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -64,7 +65,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -98,6 +98,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp index 5cb4d499a937..8ace22a5877a 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -65,7 +66,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -100,6 +100,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp index 7c1cbc8667de..4fd50a818fb8 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -66,7 +67,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -102,6 +102,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp index 4d2830b3a808..bcd10b0775e4 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <unordered_set> // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int P; typedef test_allocator<int> A; @@ -111,7 +112,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef int P; typedef min_allocator<int> A; @@ -153,6 +153,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp index a92ec872a54b..66409543f447 100644 --- a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::filebuf f; @@ -52,5 +53,4 @@ int main() assert(f2.sgetc() == L'2'); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp index f13ee44700f3..96806fbfeb45 100644 --- a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::filebuf f; @@ -50,5 +51,4 @@ int main() assert(f2.sgetc() == L'2'); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp index b5157e90edcc..b143bd4a55ed 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out @@ -46,5 +47,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp index d2ae3028606c..556cc858a664 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::fstream fso(temp, std::ios_base::in | std::ios_base::out @@ -44,5 +45,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp index 9c2fcad33a3c..36fa29a4e513 100644 --- a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ifstream fso("test.dat"); std::ifstream fs; @@ -36,5 +37,4 @@ int main() fs >> x; assert(x == 3.25); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp index aaac1212262d..eeb06e0e59a6 100644 --- a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ifstream fso("test.dat"); std::ifstream fs = move(fso); @@ -34,5 +35,4 @@ int main() fs >> x; assert(x == 3.25); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp index 0f21eb81d078..094f55073354 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::ofstream fso(temp.c_str()); @@ -48,5 +49,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp index 8645358cbd4d..fe885cf4088e 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <fstream> // template <class charT, class traits = char_traits<charT> > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::ofstream fso(temp.c_str()); @@ -46,5 +47,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp index 2032e935bfac..cf6c8ae68efa 100644 --- a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <istream> // template <class charT, class traits = char_traits<charT> > @@ -17,7 +19,6 @@ #include <istream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class CharT> struct testbuf @@ -37,11 +38,9 @@ struct test_iostream {base::operator=(std::move(s)); return *this;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb1; testbuf<char> sb2; @@ -88,5 +87,4 @@ int main() assert(is2.precision() == 6); assert(is2.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp index c0592e927c8f..e8fd00c7ac07 100644 --- a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <istream> // template <class charT, class traits = char_traits<charT> > @@ -17,7 +19,6 @@ #include <istream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class CharT> struct testbuf @@ -37,11 +38,9 @@ struct test_iostream : base(std::move(s)) {} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb; test_iostream<char> is1(&sb); @@ -74,5 +73,4 @@ int main() assert(is.precision() == 6); assert(is.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp index 2876d76c1984..18887b75de29 100644 --- a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <istream> // template <class charT, class traits = char_traits<charT> > @@ -17,7 +19,6 @@ #include <istream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class CharT> struct testbuf @@ -37,11 +38,9 @@ struct test_istream {base::operator=(std::move(s)); return *this;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb1; testbuf<char> sb2; @@ -88,5 +87,4 @@ int main() assert(is2.precision() == 6); assert(is2.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp index 40fe0795de53..1b58a9a524e9 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <ostream> // template <class charT, class traits = char_traits<charT> > @@ -17,7 +19,6 @@ #include <ostream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class CharT> struct testbuf @@ -37,11 +38,9 @@ struct test_ostream {base::operator=(std::move(s)); return *this;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb1; testbuf<char> sb2; @@ -88,5 +87,4 @@ int main() assert(os2.precision() == 6); assert(os2.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp index b3045b3232e6..7d225d49546d 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <ostream> // template <class charT, class traits = char_traits<charT> > @@ -17,7 +19,6 @@ #include <ostream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class CharT> struct testbuf @@ -37,11 +38,9 @@ struct test_ostream : base(std::move(s)) {} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb; test_ostream<char> os1(&sb); @@ -70,5 +69,4 @@ int main() assert(os.precision() == 6); assert(os.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp index 8be0b51d9fdf..83210c08767a 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <ostream> // template <class charT, class traits = char_traits<charT> > @@ -19,7 +21,6 @@ #include <ostream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class CharT> class testbuf @@ -53,11 +54,9 @@ protected: } }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb; std::ostream(&sb) << "testing..."; @@ -68,5 +67,4 @@ int main() std::wostream(&sb) << L"123"; assert(sb.str() == L"123"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp index e57ad55c9078..2a428c5d92d8 100644 --- a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::istringstream ss0(" 123 456"); std::istringstream ss; @@ -82,5 +83,4 @@ int main() s1 >> s; assert(s == L"Dddddddddddddddddd"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp index adc46ab65f5e..0a45b796be09 100644 --- a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::istringstream ss0(" 123 456"); std::istringstream ss(std::move(ss0)); @@ -44,5 +45,4 @@ int main() ss >> i; assert(i == 456); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp index a52068595178..8801001f41a3 100644 --- a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ostringstream ss0(" 123 456"); std::ostringstream ss; @@ -42,5 +43,4 @@ int main() ss << i << ' ' << 567; assert(ss.str() == L"234 5676"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp index 3d9e305e0408..67bfc50cd87a 100644 --- a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ostringstream ss0(" 123 456"); std::ostringstream ss(std::move(ss0)); @@ -40,5 +41,4 @@ int main() ss << i << ' ' << 567; assert(ss.str() == L"234 5676"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp index 4ae3aa6e84db..436c76c5bfde 100644 --- a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::stringstream ss0(" 123 456 "); std::stringstream ss(std::move(ss0)); @@ -48,5 +49,4 @@ int main() ss << i << ' ' << 123; assert(ss.str() == L"456 1236 "); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp index 78d682fc44f6..94de616108f1 100644 --- a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::vector<std::istringstream> vecis; vecis.push_back(std::istringstream()); vecis.back().str("hub started at [00 6b 8b 45 69]"); @@ -34,5 +35,4 @@ int main() vecis[n].seekg(0, std::ios_base::beg); assert(vecis[n].str().size() == 31); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp index ccaf72d7e550..3cce695c49da 100644 --- a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <sstream> // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::stringstream ss0(" 123 456 "); std::stringstream ss; @@ -50,5 +51,4 @@ int main() ss << i << ' ' << 123; assert(ss.str() == L"456 1236 "); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp index 26be4db38fba..6a9f25cd0855 100644 --- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp @@ -113,7 +113,7 @@ int main() std::throw_with_nested("String literal"); assert(false); } - catch (const char * s) + catch (const char *) { } } diff --git a/test/std/language.support/support.initlist/include_cxx03.pass.cpp b/test/std/language.support/support.initlist/include_cxx03.pass.cpp new file mode 100644 index 000000000000..8710ddcdde72 --- /dev/null +++ b/test/std/language.support/support.initlist/include_cxx03.pass.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <initializer_list> + +// Test that the file can be included in C++03 + +#include <initializer_list> + +int main() +{ +} diff --git a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp index e51ef7bd9230..f6fd5564f55f 100644 --- a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template<class E> class initializer_list; // const E* begin() const; @@ -19,8 +21,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list<int> il) @@ -52,13 +52,9 @@ struct B #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp index e091834340aa..2d831c9e1d1e 100644 --- a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template<class E> class initializer_list; // initializer_list(); @@ -20,10 +22,9 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::initializer_list<A> il; assert(il.size() == 0); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + #if TEST_STD_VER > 11 constexpr std::initializer_list<A> il2; static_assert(il2.size() == 0, ""); diff --git a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp index 938025d385fa..102ed64fef9b 100644 --- a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <initializer_list> // template<class E> const E* begin(initializer_list<E> il); @@ -17,8 +19,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list<int> il) @@ -49,13 +49,10 @@ struct B }; #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/test/std/language.support/support.initlist/types.pass.cpp b/test/std/language.support/support.initlist/types.pass.cpp index 835830055ff4..a301ef924614 100644 --- a/test/std/language.support/support.initlist/types.pass.cpp +++ b/test/std/language.support/support.initlist/types.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template<class E> // class initializer_list // { @@ -26,12 +28,10 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS static_assert((std::is_same<std::initializer_list<A>::value_type, A>::value), ""); static_assert((std::is_same<std::initializer_list<A>::reference, const A&>::value), ""); static_assert((std::is_same<std::initializer_list<A>::const_reference, const A&>::value), ""); static_assert((std::is_same<std::initializer_list<A>::size_type, std::size_t>::value), ""); static_assert((std::is_same<std::initializer_list<A>::iterator, const A*>::value), ""); static_assert((std::is_same<std::initializer_list<A>::const_iterator, const A*>::value), ""); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp index a2e53629f97d..8831ca1d6ee1 100644 --- a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp +++ b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp @@ -14,6 +14,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + int main() { using namespace std::literals::complex_literals; diff --git a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp index 67e0fa131fd0..6cc911d4e5e6 100644 --- a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp +++ b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp @@ -12,6 +12,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { std::complex<float> foo = 1.0if; // should fail w/conversion operator not found diff --git a/test/std/numerics/complex.number/complex.members/construct.pass.cpp b/test/std/numerics/complex.number/complex.members/construct.pass.cpp index b4d870fad11e..25b9ce62cc1d 100644 --- a/test/std/numerics/complex.number/complex.members/construct.pass.cpp +++ b/test/std/numerics/complex.number/complex.members/construct.pass.cpp @@ -14,6 +14,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + template <class T> void test() @@ -38,7 +40,7 @@ test() assert(c.real() == 10.5); assert(c.imag() == -9.5); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<T> c; static_assert(c.real() == 0, ""); diff --git a/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp index e8d07ce287d0..ac26e3c9eeda 100644 --- a/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<float> cd(2.5, 3.5); constexpr std::complex<double> cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp index 298aaa3a7a8a..3bb01ac46500 100644 --- a/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<float> cd(2.5, 3.5); constexpr std::complex<double> cf = cd; diff --git a/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp index 6ff74a2cdef3..97c2580249ca 100644 --- a/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<long double> cd(2.5, 3.5); constexpr std::complex<double> cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp index 77ca9d7f2aac..3027d4cdcc0c 100644 --- a/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<double> cd(2.5, 3.5); constexpr std::complex<float> cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp index 4fb11b4ca27c..515e83dfc46e 100644 --- a/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<long double> cd(2.5, 3.5); constexpr std::complex<float> cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp index dd10c808b90a..4f24a1c6575d 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<double> cd(2.5, 3.5); constexpr std::complex<long double> cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp index aab539407d0f..8cbd7a8a12cd 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<double> cd(2.5, 3.5); constexpr std::complex<long double> cf = cd; diff --git a/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp index a5f5101c4dc8..7930548f9f38 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<float> cd(2.5, 3.5); constexpr std::complex<long double> cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp index 25b93823f6ed..22b9fd08ac25 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp @@ -18,6 +18,8 @@ #include <complex> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex<float> cd(2.5, 3.5); constexpr std::complex<long double> cf = cd; diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp index 7a671a73eee6..5122f44c3d80 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <valarray> // template<class T> class valarray; @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -54,5 +55,4 @@ int main() assert(v2[i][j] == a[i][j]); } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp index 4dfbe11bde9c..ce385e65c2ad 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <valarray> // template<class T> class valarray; @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -37,5 +38,4 @@ int main() for (unsigned i = 0; i < N; ++i) assert(v[i] == a[i]); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp index f819f48b1975..8cc523e2fc07 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp @@ -26,6 +26,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class _Tp> void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp index 187a71edcd7e..6076f934ff71 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp @@ -24,6 +24,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + void test1() { diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp index be5b4a9786af..c592b6df2d6e 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp @@ -25,6 +25,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class _Tp> void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp index bc4494b9848e..031839317093 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class IntType = int> @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; D d = {}; @@ -77,5 +78,4 @@ int main() assert(p[1] == 0); assert(p[2] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp index 1071305f4db7..bd2a8c83d8ec 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class IntType = int> @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; typedef D::param_type P; @@ -28,5 +29,4 @@ int main() assert(p.size() == 1); assert(p[0] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp index 79d8a0b71a92..1144bfed33fd 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class IntType = int> @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; typedef D::param_type P; @@ -84,5 +85,4 @@ int main() assert(p[1] == 0); assert(p[2] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp index d4f339fe7f3b..e901afc39742 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class RealType = double> @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; D d; @@ -31,5 +32,4 @@ int main() assert(dn.size() == 1); assert(dn[0] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp index 5708e45093cb..ecc3c892236a 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class RealType = double> @@ -27,7 +29,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; D d({}, f); @@ -74,5 +75,4 @@ int main() assert(dn[0] == 0.203125); assert(dn[1] == 0.1484375); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp index fa6530979ed8..c037338cdea0 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class RealType = double> @@ -24,7 +26,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; typedef D::param_type P; @@ -75,5 +76,4 @@ int main() assert(dn[0] == 0.203125); assert(dn[1] == 0.1484375); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp index 745bd6b97ec8..99b0f5f4b27f 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class RealType = double> @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; D d; @@ -32,5 +33,4 @@ int main() assert(dn[0] == 1); assert(dn[1] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp index 44c76f0cf6cb..77371de453d0 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class RealType = double> @@ -27,7 +29,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; D d({}, f); @@ -78,5 +79,4 @@ int main() assert(dn[1] == 0.125); assert(dn[2] == 0.175); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp index cfa416434a29..518a4f265acf 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // template<class RealType = double> @@ -24,7 +26,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; typedef D::param_type P; @@ -79,5 +80,4 @@ int main() assert(dn[1] == 0.125); assert(dn[2] == 0.175); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp index cd496fdbc5e0..2080ac5f41de 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp @@ -25,6 +25,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class _Tp> void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp index 3a16d62d728d..f7834afd4454 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp @@ -40,6 +40,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class _Tp> void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp index b3f12e72383b..6b8b4eed97a9 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp @@ -28,6 +28,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class _Tp> void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp index d4ee9c14d528..c0921d913665 100644 --- a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp +++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <random> // class seed_seq; @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::seed_seq s= {5, 4, 3, 2, 1}; assert(s.size() == 5); unsigned b[5] = {0}; @@ -29,5 +30,4 @@ int main() assert(b[2] == 3); assert(b[3] == 2); assert(b[4] == 1); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp index 6cffc0da9a52..849ec4ae51f6 100644 --- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp +++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <regex> // class regex_token_iterator<BidirectionalIterator, charT, traits> @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::regex phone_numbers("\\d{3}-(\\d{4})"); const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end"; @@ -61,5 +62,4 @@ int main() ++i; assert(i == std::cregex_token_iterator()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp index 39c3a22ef725..fcaee8c3d686 100644 --- a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp +++ b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <regex> // template <class charT, class traits = regex_traits<charT>> class basic_regex; @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::regex r2; r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}); assert(r2.flags() == std::regex::ECMAScript); @@ -30,5 +31,4 @@ int main() r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex::extended); assert(r2.flags() == std::regex::extended); assert(r2.mark_count() == 2); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.assign/il.pass.cpp b/test/std/re/re.regex/re.regex.assign/il.pass.cpp index 022170f2d136..a74d9cf6ed11 100644 --- a/test/std/re/re.regex/re.regex.assign/il.pass.cpp +++ b/test/std/re/re.regex/re.regex.assign/il.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <regex> // template <class charT, class traits = regex_traits<charT>> class basic_regex; @@ -19,10 +21,8 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::regex r2; r2 = {'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}; assert(r2.flags() == std::regex::ECMAScript); assert(r2.mark_count() == 2); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp index c1554d6c3ebb..87dcc856940b 100644 --- a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp +++ b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <regex> // template <class charT, class traits = regex_traits<charT>> class basic_regex; @@ -18,7 +20,6 @@ #include <cassert> #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS void test(std::initializer_list<char> il, std::regex_constants::syntax_option_type f, unsigned mc) @@ -28,11 +29,9 @@ test(std::initializer_list<char> il, std::regex_constants::syntax_option_type f, assert(r.mark_count() == mc); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::string s1("\\(a\\)"); std::string s2("\\(a[bc]\\)"); std::string s3("\\(a\\([bc]\\)\\)"); @@ -67,5 +66,4 @@ int main() test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::egrep, 0); test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::egrep, 0); test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::egrep, 2); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp index 2adf846c1e36..c5b7cbf9d97e 100644 --- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp @@ -7,13 +7,12 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <string> // iterator insert(const_iterator p, initializer_list<charT> il); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include <string> #include <cassert> @@ -22,14 +21,12 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::string s("123456"); std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); assert(i - s.begin() == 3); assert(s == "123abc456"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; S s("123456"); @@ -37,14 +34,4 @@ int main() assert(i - s.begin() == 3); assert(s == "123abc456"); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - std::string s; - std::string s2; - s.insert(s2.begin(), {'a', 'b', 'c'}); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp index b60a58c55e0e..2a705ebf442f 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <string> // basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il); @@ -18,19 +20,15 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::string s("123def456"); s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; S s("123def456"); s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp index 48d1854808c0..5dbfe9d4dbe1 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <string> // template<class charT, class traits, class Allocator> @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::string s("initial text"); getline(std::istringstream(" abc* def* ghij"), s, '*'); @@ -33,7 +34,6 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; S s("initial text"); @@ -46,6 +46,4 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp index 18c22f915ca0..0c1fa8203415 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <string> // template<class charT, class traits, class Allocator> @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::string s("initial text"); getline(std::istringstream(" abc\n def\n ghij"), s); @@ -33,7 +34,6 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; S s("initial text"); @@ -46,6 +46,4 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp index 9a8213e230fb..7bf7da8900f5 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp @@ -21,60 +21,50 @@ #include <utility> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> -void -test0(typename S::value_type lhs, const S& rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(typename S::value_type lhs, const S& rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class S> -void -test1(typename S::value_type lhs, S&& rhs, const S& x) -{ - assert(lhs + move(rhs) == x); +void test1(typename S::value_type lhs, S&& rhs, const S& x) { + assert(lhs + move(rhs) == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1('a', S(""), S("a")); test1('a', S("12345"), S("a12345")); test1('a', S("1234567890"), S("a1234567890")); test1('a', S("12345678901234567890"), S("a12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + } + { + typedef std::basic_string<char, std::char_traits<char>, + min_allocator<char> > + S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - test1('a', S(""), S("a")); test1('a', S("12345"), S("a12345")); test1('a', S("1234567890"), S("a1234567890")); test1('a', S("12345678901234567890"), S("a12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp index 88fa678ec44f..090707fd8695 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp @@ -21,29 +21,23 @@ #include <utility> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> -void -test0(const typename S::value_type* lhs, const S& rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const typename S::value_type* lhs, const S& rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class S> -void -test1(const typename S::value_type* lhs, S&& rhs, const S& x) -{ - assert(lhs + move(rhs) == x); +void test1(const typename S::value_type* lhs, S&& rhs, const S& x) { + assert(lhs + move(rhs) == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); @@ -56,14 +50,19 @@ int main() test0("abcdefghij", S(""), S("abcdefghij")); test0("abcdefghij", S("12345"), S("abcdefghij12345")); test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1("", S(""), S("")); test1("", S("12345"), S("12345")); test1("", S("1234567890"), S("1234567890")); @@ -75,17 +74,19 @@ int main() test1("abcdefghij", S(""), S("abcdefghij")); test1("abcdefghij", S("12345"), S("abcdefghij12345")); test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test1("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } + { + typedef std::basic_string<char, std::char_traits<char>, + min_allocator<char> > + S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); test0("", S("1234567890"), S("1234567890")); @@ -97,13 +98,14 @@ int main() test0("abcdefghij", S(""), S("abcdefghij")); test0("abcdefghij", S("12345"), S("abcdefghij12345")); test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test1("", S(""), S("")); test1("", S("12345"), S("12345")); @@ -116,13 +118,14 @@ int main() test1("abcdefghij", S(""), S("abcdefghij")); test1("abcdefghij", S("12345"), S("abcdefghij12345")); test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + test1("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp index b4c2c97043cc..9bc3a4d41b32 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp @@ -21,60 +21,50 @@ #include <utility> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> -void -test0(const S& lhs, typename S::value_type rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const S& lhs, typename S::value_type rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class S> -void -test1(S&& lhs, typename S::value_type rhs, const S& x) -{ - assert(move(lhs) + rhs == x); +void test1(S&& lhs, typename S::value_type rhs, const S& x) { + assert(move(lhs) + rhs == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1(S(""), '1', S("1")); test1(S("abcde"), '1', S("abcde1")); test1(S("abcdefghij"), '1', S("abcdefghij1")); test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + } + { + typedef std::basic_string<char, std::char_traits<char>, + min_allocator<char> > + S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - test1(S(""), '1', S("1")); test1(S("abcde"), '1', S("abcde1")); test1(S("abcdefghij"), '1', S("abcdefghij1")); test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp index 3b669e7d9869..a9aa92f37e4e 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp @@ -21,29 +21,23 @@ #include <utility> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> -void -test0(const S& lhs, const typename S::value_type* rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const S& lhs, const typename S::value_type* rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class S> -void -test1(S&& lhs, const typename S::value_type* rhs, const S& x) -{ - assert(move(lhs) + rhs == x); +void test1(S&& lhs, const typename S::value_type* rhs, const S& x) { + assert(move(lhs) + rhs == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); @@ -56,14 +50,18 @@ int main() test0(S("abcdefghij"), "", S("abcdefghij")); test0(S("abcdefghij"), "12345", S("abcdefghij12345")); test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + test0(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1(S(""), "", S("")); test1(S(""), "12345", S("12345")); test1(S(""), "1234567890", S("1234567890")); @@ -75,17 +73,19 @@ int main() test1(S("abcdefghij"), "", S("abcdefghij")); test1(S("abcdefghij"), "12345", S("abcdefghij12345")); test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test1(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); + } + { + typedef std::basic_string<char, std::char_traits<char>, + min_allocator<char> > + S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); test0(S(""), "1234567890", S("1234567890")); @@ -97,13 +97,14 @@ int main() test0(S("abcdefghij"), "", S("abcdefghij")); test0(S("abcdefghij"), "12345", S("abcdefghij12345")); test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); test1(S(""), "", S("")); test1(S(""), "12345", S("12345")); @@ -116,13 +117,14 @@ int main() test1(S("abcdefghij"), "", S("abcdefghij")); test1(S("abcdefghij"), "12345", S("abcdefghij12345")); test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + test1(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp index 1977b6f517ba..fbef64627341 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp @@ -33,43 +33,34 @@ #include <utility> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> -void -test0(const S& lhs, const S& rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const S& lhs, const S& rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template <class S> -void -test1(S&& lhs, const S& rhs, const S& x) -{ - assert(move(lhs) + rhs == x); +void test1(S&& lhs, const S& rhs, const S& x) { + assert(move(lhs) + rhs == x); } template <class S> -void -test2(const S& lhs, S&& rhs, const S& x) -{ - assert(lhs + move(rhs) == x); +void test2(const S& lhs, S&& rhs, const S& x) { + assert(lhs + move(rhs) == x); } template <class S> -void -test3(S&& lhs, S&& rhs, const S& x) -{ - assert(move(lhs) + move(rhs) == x); +void test3(S&& lhs, S&& rhs, const S& x) { + assert(move(lhs) + move(rhs) == x); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif -int main() -{ - { +int main() { + { typedef std::string S; test0(S(""), S(""), S("")); test0(S(""), S("12345"), S("12345")); @@ -78,18 +69,24 @@ int main() test0(S("abcde"), S(""), S("abcde")); test0(S("abcde"), S("12345"), S("abcde12345")); test0(S("abcde"), S("1234567890"), S("abcde1234567890")); - test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test0(S("abcdefghij"), S(""), S("abcdefghij")); test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + test0(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1(S(""), S(""), S("")); test1(S(""), S("12345"), S("12345")); test1(S(""), S("1234567890"), S("1234567890")); @@ -97,15 +94,20 @@ int main() test1(S("abcde"), S(""), S("abcde")); test1(S("abcde"), S("12345"), S("abcde12345")); test1(S("abcde"), S("1234567890"), S("abcde1234567890")); - test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test1(S("abcdefghij"), S(""), S("abcdefghij")); test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test2(S(""), S(""), S("")); test2(S(""), S("12345"), S("12345")); @@ -114,15 +116,20 @@ int main() test2(S("abcde"), S(""), S("abcde")); test2(S("abcde"), S("12345"), S("abcde12345")); test2(S("abcde"), S("1234567890"), S("abcde1234567890")); - test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test2(S("abcdefghij"), S(""), S("abcdefghij")); test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test3(S(""), S(""), S("")); test3(S(""), S("12345"), S("12345")); @@ -131,21 +138,25 @@ int main() test3(S("abcde"), S(""), S("abcde")); test3(S("abcde"), S("12345"), S("abcde12345")); test3(S("abcde"), S("1234567890"), S("abcde1234567890")); - test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test3(S("abcdefghij"), S(""), S("abcdefghij")); test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test3(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } + { + typedef std::basic_string<char, std::char_traits<char>, + min_allocator<char> > + S; test0(S(""), S(""), S("")); test0(S(""), S("12345"), S("12345")); test0(S(""), S("1234567890"), S("1234567890")); @@ -153,17 +164,20 @@ int main() test0(S("abcde"), S(""), S("abcde")); test0(S("abcde"), S("12345"), S("abcde12345")); test0(S("abcde"), S("1234567890"), S("abcde1234567890")); - test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test0(S("abcdefghij"), S(""), S("abcdefghij")); test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test1(S(""), S(""), S("")); test1(S(""), S("12345"), S("12345")); @@ -172,15 +186,20 @@ int main() test1(S("abcde"), S(""), S("abcde")); test1(S("abcde"), S("12345"), S("abcde12345")); test1(S("abcde"), S("1234567890"), S("abcde1234567890")); - test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test1(S("abcdefghij"), S(""), S("abcdefghij")); test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test2(S(""), S(""), S("")); test2(S(""), S("12345"), S("12345")); @@ -189,15 +208,20 @@ int main() test2(S("abcde"), S(""), S("abcde")); test2(S("abcde"), S("12345"), S("abcde12345")); test2(S("abcde"), S("1234567890"), S("abcde1234567890")); - test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test2(S("abcdefghij"), S(""), S("abcdefghij")); test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test3(S(""), S(""), S("")); test3(S(""), S("12345"), S("12345")); @@ -206,17 +230,20 @@ int main() test3(S("abcde"), S(""), S("abcde")); test3(S("abcde"), S("12345"), S("abcde12345")); test3(S("abcde"), S("1234567890"), S("abcde1234567890")); - test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test3(S("abcdefghij"), S(""), S("abcdefghij")); test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#endif + test3(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp index 245c480885b8..a0071cd6594e 100644 --- a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp @@ -188,7 +188,7 @@ int main() } } #endif -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { L0 l0; L0 l1; @@ -518,5 +518,5 @@ int main() } } #endif // TEST_HAS_NO_EXCEPTIONS -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp index fb563cbe0b14..4ad7a3ac2853 100644 --- a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp @@ -126,7 +126,7 @@ int main() } } #endif -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { L0 l0; L0 l1; @@ -522,5 +522,5 @@ int main() assert(!l2.locked()); assert(!l3.locked()); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp index 138b657196da..dfd2f10b79e2 100644 --- a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp +++ b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp @@ -66,7 +66,7 @@ void f3() #endif } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 struct init1 { @@ -101,7 +101,7 @@ void f2() std::call_once(flg2, init2(), 4, 5); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 std::once_flag flg41; std::once_flag flg42; @@ -135,7 +135,7 @@ void f42() std::call_once(flg41, init41); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 class MoveOnly { @@ -174,7 +174,6 @@ public: void operator()(int&) {} }; -#if TEST_STD_VER >= 11 // reference qualifiers on functions are a C++11 extension struct RefQual { @@ -185,8 +184,8 @@ struct RefQual void operator()() & { ++lv_called; } void operator()() && { ++rv_called; } }; -#endif -#endif + +#endif // TEST_STD_VER >= 11 int main() { @@ -218,7 +217,7 @@ int main() assert(init41_called == 1); assert(init42_called == 1); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 // check functors with 1 arg { std::thread t0(f1); @@ -245,7 +244,6 @@ int main() int i = 0; std::call_once(f, NonCopyable(), i); } -#if TEST_STD_VER >= 11 // reference qualifiers on functions are a C++11 extension { std::once_flag f1, f2; @@ -255,6 +253,5 @@ int main() std::call_once(f2, std::move(rq)); assert(rq.rv_called == 1); } -#endif -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp index 6995f0648335..21011ed17cd9 100644 --- a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp +++ b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp @@ -14,13 +14,14 @@ // constexpr once_flag() noexcept; #include <mutex> +#include "test_macros.h" int main() { { std::once_flag f; } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::once_flag f; } diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp index fc346d4dce7d..78b04d8615b3 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp @@ -50,7 +50,7 @@ namespace std { template <class T> struct hash<::min_pointer<T, std::integral_constant<size_t, 1>>> { - size_t operator()(::min_pointer<T, std::integral_constant<size_t, 1>> p) const noexcept(false) { + size_t operator()(::min_pointer<T, std::integral_constant<size_t, 1>> p) const TEST_NOEXCEPT_FALSE { if (!p) return 0; return std::hash<T*>{}(std::addressof(*p)); } @@ -67,12 +67,16 @@ int main() int* ptr = new int; std::unique_ptr<int> p(ptr); std::hash<std::unique_ptr<int> > f; - ASSERT_NOT_NOEXCEPT(f(p)); std::size_t h = f(p); assert(h == std::hash<int*>()(ptr)); } #if TEST_STD_VER >= 11 { + std::unique_ptr<int, PointerDeleter<int, 1>> pThrowingHash; + std::hash<std::unique_ptr<int, PointerDeleter<int, 1>>> fThrowingHash; + ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash)); + } + { test_enabled_with_deleter<int, Deleter<int>>(); test_enabled_with_deleter<int[], Deleter<int[]>>(); test_enabled_with_deleter<int, CopyDeleter<int>>(); diff --git a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp index 51a837e4e032..bf8aa0453e97 100644 --- a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp +++ b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp @@ -22,11 +22,11 @@ int main() static_assert(_5::value == 5, ""); static_assert((std::is_same<_5::value_type, int>::value), ""); static_assert((std::is_same<_5::type, _5>::value), ""); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 static_assert((_5() == 5), ""); -#else - assert(_5() == 5); #endif + assert(_5() == 5); + #if TEST_STD_VER > 11 static_assert ( _5{}() == 5, "" ); diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp index 43f23f5ccc80..883548270469 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // type_traits // aligned_union<size_t Len, class ...Types> @@ -17,7 +19,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS { typedef std::aligned_union<10, char >::type T1; #if TEST_STD_VER > 11 @@ -90,5 +91,4 @@ int main() static_assert(std::alignment_of<T1>::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } -#endif } diff --git a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp index 29fb7a8431f1..dc69739271b5 100644 --- a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp @@ -10,8 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator==(const optional<T>& x, const T& v); -// template <class T> constexpr bool operator==(const T& v, const optional<T>& x); +// template <class T, class U> constexpr bool operator==(const optional<T>& x, const U& v); +// template <class T, class U> constexpr bool operator==(const U& v, const optional<T>& x); #include <optional> diff --git a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp index ae34eb20517e..e1bad12e3f69 100644 --- a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp @@ -10,8 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator>(const optional<T>& x, const T& v); -// template <class T> constexpr bool operator>(const T& v, const optional<T>& x); +// template <class T, class U> constexpr bool operator>(const optional<T>& x, const U& v); +// template <class T, class U> constexpr bool operator>(const U& v, const optional<T>& x); #include <optional> diff --git a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp index dac94002661f..342ddffc2c79 100644 --- a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp @@ -10,8 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator>=(const optional<T>& x, const T& v); -// template <class T> constexpr bool operator>=(const T& v, const optional<T>& x); +// template <class T, class U> constexpr bool operator>=(const optional<T>& x, const U& v); +// template <class T, class U> constexpr bool operator>=(const U& v, const optional<T>& x); #include <optional> diff --git a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp index b71f8363b0a6..bcf6afcc6bfb 100644 --- a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp @@ -10,8 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator<=(const optional<T>& x, const T& v); -// template <class T> constexpr bool operator<=(const T& v, const optional<T>& x); +// template <class T, class U> constexpr bool operator<=(const optional<T>& x, const U& v); +// template <class T, class U> constexpr bool operator<=(const U& v, const optional<T>& x); #include <optional> diff --git a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp index 84456b3baa6e..3d5e2144a967 100644 --- a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp @@ -10,8 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator<(const optional<T>& x, const T& v); -// template <class T> constexpr bool operator<(const T& v, const optional<T>& x); +// template <class T, class U> constexpr bool operator<(const optional<T>& x, const U& v); +// template <class T, class U> constexpr bool operator<(const U& v, const optional<T>& x); #include <optional> diff --git a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp index a4ffdc25e721..7da9b7ba7a03 100644 --- a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp @@ -10,8 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator!=(const optional<T>& x, const T& v); -// template <class T> constexpr bool operator!=(const T& v, const optional<T>& x); +// template <class T, class U> constexpr bool operator!=(const optional<T>& x, const U& v); +// template <class T, class U> constexpr bool operator!=(const U& v, const optional<T>& x); #include <optional> diff --git a/test/std/utilities/optional/optional.hash/hash.pass.cpp b/test/std/utilities/optional/optional.hash/hash.pass.cpp index 8c91d6da761e..b4a1832cdc0a 100644 --- a/test/std/utilities/optional/optional.hash/hash.pass.cpp +++ b/test/std/utilities/optional/optional.hash/hash.pass.cpp @@ -26,7 +26,7 @@ namespace std { template <> struct hash<B> { - size_t operator()(B const&) noexcept(false) { return 0; } + size_t operator()(B const&) TEST_NOEXCEPT_FALSE { return 0; } }; } @@ -37,10 +37,16 @@ int main() const std::size_t nullopt_hash = std::hash<optional<double>>{}(optional<double>{}); + + { + optional<B> opt; + ASSERT_NOT_NOEXCEPT(std::hash<optional<B>>()(opt)); + ASSERT_NOT_NOEXCEPT(std::hash<optional<const B>>()(opt)); + } + { typedef int T; optional<T> opt; - ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt)); assert(std::hash<optional<T>>{}(opt) == nullopt_hash); opt = 2; assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); @@ -48,7 +54,6 @@ int main() { typedef std::string T; optional<T> opt; - ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt)); assert(std::hash<optional<T>>{}(opt) == nullopt_hash); opt = std::string("123"); assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); @@ -56,7 +61,6 @@ int main() { typedef std::unique_ptr<int> T; optional<T> opt; - ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt)); assert(std::hash<optional<T>>{}(opt) == nullopt_hash); opt = std::unique_ptr<int>(new int(3)); assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); diff --git a/test/std/utilities/optional/optional.relops/equal.pass.cpp b/test/std/utilities/optional/optional.relops/equal.pass.cpp index 7667540f9760..0752841d3668 100644 --- a/test/std/utilities/optional/optional.relops/equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y); +// template <class T, class U> constexpr bool operator==(const optional<T>& x, const optional<U>& y); #include <optional> #include <type_traits> diff --git a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp index 0e05834c147a..f475f3796916 100644 --- a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator>= (const optional<T>& x, const optional<T>& y); +// template <class T, class U> constexpr bool operator>= (const optional<T>& x, const optional<U>& y); #include <optional> diff --git a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp index 3946a6102ba9..c3f2af9323ab 100644 --- a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator> (const optional<T>& x, const optional<T>& y); +// template <class T, class U> constexpr bool operator> (const optional<T>& x, const optional<U>& y); #include <optional> diff --git a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp index 5a1954154f44..35e80d3d4e50 100644 --- a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator<= (const optional<T>& x, const optional<T>& y); +// template <class T, class U> constexpr bool operator<= (const optional<T>& x, const optional<U>& y); #include <optional> diff --git a/test/std/utilities/optional/optional.relops/less_than.pass.cpp b/test/std/utilities/optional/optional.relops/less_than.pass.cpp index 35956e6f4a70..1dbffbd92352 100644 --- a/test/std/utilities/optional/optional.relops/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_than.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator< (const optional<T>& x, const optional<T>& y); +// template <class T, class U> constexpr bool operator< (const optional<T>& x, const optional<U>& y); #include <optional> diff --git a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp index 1256537d6a86..12d9922a9592 100644 --- a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y); +// template <class T, class U> constexpr bool operator!=(const optional<T>& x, const optional<U>& y); #include <optional> #include <type_traits> diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp index 9b946a733fea..716a2b92a96c 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp +++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp @@ -78,14 +78,11 @@ void test_sfinae() { using DA = NCConvertingDeleter<A[]>; // non-copyable deleters using DAC = NCConvertingDeleter<const A[]>; // non-copyable deleters - using DB = NCConvertingDeleter<B[]>; using UA = std::unique_ptr<A[]>; using UAC = std::unique_ptr<const A[]>; - using UB = std::unique_ptr<B[]>; using UAD = std::unique_ptr<A[], DA>; using UACD = std::unique_ptr<const A[], DAC>; - using UBD = std::unique_ptr<B[], DB>; { // cannot move from an lvalue static_assert(std::is_assignable<UAC, UA&&>::value, ""); static_assert(!std::is_assignable<UAC, UA&>::value, ""); diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp index 51d9aa708c40..2a7949f6420a 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp +++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp @@ -46,7 +46,7 @@ struct NonDefaultDeleter { template <class ElemType> void test_sfinae() { #if TEST_STD_VER >= 11 - { // the constructor does not participate in overload resultion when + { // the constructor does not participate in overload resolution when // the deleter is a pointer type using U = std::unique_ptr<ElemType, void (*)(void*)>; static_assert(!std::is_default_constructible<U>::value, ""); diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp index 6e5db86c97fc..769deea92c85 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp +++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp @@ -19,6 +19,7 @@ #include <cassert> #include "test_macros.h" +#include "type_id.h" #include "unique_ptr_test_helper.h" template <int ID = 0> @@ -33,9 +34,71 @@ struct GenericConvertingDeleter { void operator()(void*) const {} }; +template <class Templ, class Other> +struct is_specialization; + +template <template <int> class Templ, int ID1, class Other> +struct is_specialization<Templ<ID1>, Other> : std::false_type {}; + +template <template <int> class Templ, int ID1, int ID2> +struct is_specialization<Templ<ID1>, Templ<ID2> > : std::true_type {}; + +template <class Templ, class Other> +using EnableIfSpecialization = typename std::enable_if< + is_specialization<Templ, typename std::decay<Other>::type >::value + >::type; + + +template <int ID> +struct TrackingDeleter { + TrackingDeleter() : arg_type(&makeArgumentID<>()) {} + + TrackingDeleter(TrackingDeleter const&) + : arg_type(&makeArgumentID<TrackingDeleter const&>()) {} + + TrackingDeleter(TrackingDeleter&&) + : arg_type(&makeArgumentID<TrackingDeleter &&>()) {} + + template <class T, class = EnableIfSpecialization<TrackingDeleter, T> > + TrackingDeleter(T&&) : arg_type(&makeArgumentID<T&&>()) {} + + TrackingDeleter& operator=(TrackingDeleter const&) { + arg_type = &makeArgumentID<TrackingDeleter const&>(); + return *this; + } + + TrackingDeleter& operator=(TrackingDeleter &&) { + arg_type = &makeArgumentID<TrackingDeleter &&>(); + return *this; + } + + template <class T, class = EnableIfSpecialization<TrackingDeleter, T> > + TrackingDeleter& operator=(T&&) { + arg_type = &makeArgumentID<T&&>(); + return *this; + } + + void operator()(void*) const {} + +public: + TypeID const* reset() const { + TypeID const* tmp = arg_type; + arg_type = nullptr; + return tmp; + } + + mutable TypeID const* arg_type; +}; + + +template <class ExpectT, int ID> +bool checkArg(TrackingDeleter<ID> const& d) { + return d.arg_type && *d.arg_type == makeArgumentID<ExpectT>(); +} + + template <bool IsArray> void test_sfinae() { -#if TEST_STD_VER >= 11 typedef typename std::conditional<IsArray, A[], A>::type VT; { // Test that different non-reference deleter types are allowed so long @@ -80,13 +143,11 @@ void test_sfinae() { static_assert(std::is_constructible<U1, U5&&>::value, ""); static_assert(std::is_constructible<U1, U6&&>::value, ""); } -#endif } template <bool IsArray> void test_noexcept() { -#if TEST_STD_VER >= 11 typedef typename std::conditional<IsArray, A[], A>::type VT; { typedef std::unique_ptr<const VT> APtr; @@ -108,7 +169,39 @@ void test_noexcept() { typedef std::unique_ptr<VT, const NCConstDeleter<const VT>&> BPtr; static_assert(std::is_nothrow_constructible<APtr, BPtr>::value, ""); } -#endif +} + + +template <bool IsArray> +void test_deleter_value_category() { + typedef typename std::conditional<IsArray, A[], A>::type VT; + using TD1 = TrackingDeleter<1>; + using TD2 = TrackingDeleter<2>; + TD1 d1; + TD2 d2; + + { // Test non-reference deleter conversions + using U1 = std::unique_ptr<VT, TD1 >; + using U2 = std::unique_ptr<VT, TD2 >; + U2 u2; + u2.get_deleter().reset(); + U1 u1(std::move(u2)); + assert(checkArg<TD2&&>(u1.get_deleter())); + } + { // Test assignment from non-const ref + using U1 = std::unique_ptr<VT, TD1 >; + using U2 = std::unique_ptr<VT, TD2& >; + U2 u2(nullptr, d2); + U1 u1(std::move(u2)); + assert(checkArg<TD2&>(u1.get_deleter())); + } + { // Test assignment from const ref + using U1 = std::unique_ptr<VT, TD1 >; + using U2 = std::unique_ptr<VT, TD2 const& >; + U2 u2(nullptr, d2); + U1 u1(std::move(u2)); + assert(checkArg<TD2 const&>(u1.get_deleter())); + } } @@ -116,9 +209,11 @@ int main() { { test_sfinae</*IsArray*/false>(); test_noexcept<false>(); + test_deleter_value_category<false>(); } { test_sfinae</*IsArray*/true>(); test_noexcept<true>(); + test_deleter_value_category<true>(); } } diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp index b85f039526a4..37753bcad0d1 100644 --- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp @@ -16,7 +16,7 @@ #include <chrono> #include <cassert> -#include <test_macros.h> +#include "test_macros.h" int main() { diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp index 347cc1980e81..f932eb51c0d5 100644 --- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp @@ -16,7 +16,7 @@ #include <chrono> #include <cassert> -#include <test_macros.h> +#include "test_macros.h" int main() { diff --git a/test/std/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp index 1c87fcd909ef..9ecdfc750ab0 100644 --- a/test/std/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp @@ -20,6 +20,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class ToDuration, class FromDuration> void test(const FromDuration& f, const ToDuration& d) @@ -43,7 +45,7 @@ int main() std::chrono::duration<double, std::ratio<3600> >(7265./3600)); test(std::chrono::duration<int, std::ratio<2, 3> >(9), std::chrono::duration<int, std::ratio<3, 5> >(10)); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::hours h = std::chrono::duration_cast<std::chrono::hours>(std::chrono::milliseconds(7265000)); static_assert(h.count() == 2, ""); diff --git a/test/std/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp b/test/std/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp index 2d0dd94d4cf6..5adc62ff1c5f 100644 --- a/test/std/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp @@ -24,6 +24,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -68,7 +70,7 @@ int main() assert(s1 == s2); assert(!(s1 != s2)); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::seconds s1(3); constexpr std::chrono::seconds s2(3); diff --git a/test/std/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp b/test/std/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp index 9d875579f326..42e798254208 100644 --- a/test/std/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp @@ -34,6 +34,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -92,7 +94,7 @@ int main() assert( (s1 <= s2)); assert( (s1 >= s2)); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::seconds s1(3); constexpr std::chrono::seconds s2(3); diff --git a/test/std/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp index 152227d82a82..c237fd7716f3 100644 --- a/test/std/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() std::chrono::microseconds us = ms; assert(us.count() == 1000); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::milliseconds ms(1); constexpr std::chrono::microseconds us = ms; diff --git a/test/std/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp index 519b2b141c29..4b5042df2ce2 100644 --- a/test/std/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() std::chrono::duration<double, std::milli> ms = us; assert(ms.count() == 1./1000); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::duration<double, std::micro> us(1); constexpr std::chrono::duration<double, std::milli> ms = us; diff --git a/test/std/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp index 59fefe2e002d..8e5938b9e4b3 100644 --- a/test/std/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() std::chrono::duration<double, std::milli> d = i; assert(d.count() == 3000); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::duration<int> i(3); constexpr std::chrono::duration<double, std::milli> d = i; diff --git a/test/std/utilities/time/time.duration/time.duration.cons/default.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cons/default.pass.cpp index c52990961c25..4f7d67bb630c 100644 --- a/test/std/utilities/time/time.duration/time.duration.cons/default.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cons/default.pass.cpp @@ -18,6 +18,7 @@ #include <chrono> #include <cassert> +#include "test_macros.h" #include "../../rep.h" template <class D> @@ -26,7 +27,7 @@ test() { D d; assert(d.count() == typename D::rep()); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 constexpr D d2 = D(); static_assert(d2.count() == typename D::rep(), ""); #endif diff --git a/test/std/utilities/time/time.duration/time.duration.cons/rep.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cons/rep.pass.cpp index 20f81619bd12..6ad743e714c2 100644 --- a/test/std/utilities/time/time.duration/time.duration.cons/rep.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cons/rep.pass.cpp @@ -17,6 +17,7 @@ #include <chrono> #include <cassert> +#include "test_macros.h" #include "../../rep.h" template <class D, class R> @@ -25,7 +26,7 @@ test(R r) { D d(r); assert(d.count() == r); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 constexpr D d2(R(2)); static_assert(d2.count() == 2, ""); #endif diff --git a/test/std/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp index b3ba9f7081e4..ae745a76f431 100644 --- a/test/std/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp @@ -19,11 +19,13 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { std::chrono::duration<double> d(5); assert(d.count() == 5); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 constexpr std::chrono::duration<double> d2(5); static_assert(d2.count() == 5, ""); #endif diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp index 6585351cb4c8..6859ffcb208a 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp @@ -18,6 +18,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -44,7 +46,7 @@ int main() std::chrono::duration<double, std::ratio<1, 15> > r = s1 + s2; assert(r.count() == 75); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::seconds s1(3); constexpr std::chrono::seconds s2(5); diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp index fac58b9716d3..4bf26e4288b7 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -45,7 +47,7 @@ int main() std::chrono::duration<double, std::ratio<1, 15> > r = s1 - s2; assert(r.count() == -15); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::seconds s1(3); constexpr std::chrono::seconds s2(5); diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp index 6b24676f100c..561516b66511 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -41,7 +43,7 @@ int main() std::chrono::duration<double, std::ratio<3, 5> > s2(5); assert(s1 / s2 == 20./3); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::nanoseconds ns1(15); constexpr std::chrono::nanoseconds ns2(5); diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp index 3036cde5bf67..8b667e84d4d7 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() ns = ns / 5; assert(ns.count() == 3); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::nanoseconds ns(15); constexpr std::chrono::nanoseconds ns2 = ns / 5; diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp index e69f3205d14f..441b053dc521 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -39,7 +41,7 @@ int main() std::chrono::duration<int, std::ratio<1, 15> > r = s1 % s2; assert(r.count() == 24); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::nanoseconds ns1(15); constexpr std::chrono::nanoseconds ns2(6); diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.pass.cpp index 1acbe34ea5eb..537fae373930 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.pass.cpp @@ -19,6 +19,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() ns = ns % 6; assert(ns.count() == 3); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::nanoseconds ns(15); constexpr std::chrono::nanoseconds ns2 = ns % 6; diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp index 190e74b1dc32..6b8c83732127 100644 --- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp @@ -24,6 +24,8 @@ #include <chrono> #include <cassert> +#include "test_macros.h" + int main() { { @@ -33,7 +35,7 @@ int main() ns = 6 * ns; assert(ns.count() == 90); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::chrono::nanoseconds ns(3); constexpr std::chrono::nanoseconds ns2 = ns * 5; diff --git a/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp b/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp index 405461e88ae9..48c3e86e8101 100644 --- a/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp @@ -17,6 +17,7 @@ #include <limits> #include <cassert> +#include "test_macros.h" #include "../../rep.h" template <class D> @@ -27,7 +28,7 @@ void test() Rep max_rep = std::chrono::duration_values<Rep>::max(); assert(D::max().count() == max_rep); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { typedef typename D::rep Rep; constexpr Rep max_rep = std::chrono::duration_values<Rep>::max(); diff --git a/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp b/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp index 44cd64eff3d3..0d94aaa5869c 100644 --- a/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp @@ -17,6 +17,7 @@ #include <limits> #include <cassert> +#include "test_macros.h" #include "../../rep.h" template <class D> @@ -27,7 +28,7 @@ void test() Rep min_rep = std::chrono::duration_values<Rep>::min(); assert(D::min().count() == min_rep); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { typedef typename D::rep Rep; constexpr Rep min_rep = std::chrono::duration_values<Rep>::min(); diff --git a/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp b/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp index 18350fe2ff47..7b312c5acb50 100644 --- a/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp @@ -16,6 +16,7 @@ #include <chrono> #include <cassert> +#include "test_macros.h" #include "../../rep.h" template <class D> @@ -26,7 +27,7 @@ void test() Rep zero_rep = std::chrono::duration_values<Rep>::zero(); assert(D::zero().count() == zero_rep); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { typedef typename D::rep Rep; constexpr Rep zero_rep = std::chrono::duration_values<Rep>::zero(); diff --git a/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp b/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp index 89dc1dcc1a59..e3754c1f6475 100644 --- a/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp +++ b/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp @@ -15,6 +15,7 @@ #include <limits> #include <cassert> +#include "test_macros.h" #include "../../rep.h" int main() @@ -25,7 +26,7 @@ int main() std::numeric_limits<double>::max()); assert(std::chrono::duration_values<Rep>::max() == std::numeric_limits<Rep>::max()); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 static_assert(std::chrono::duration_values<int>::max() == std::numeric_limits<int>::max(), ""); static_assert(std::chrono::duration_values<double>::max() == diff --git a/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp b/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp index 69812bba006a..508837375b87 100644 --- a/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp +++ b/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp @@ -15,6 +15,7 @@ #include <limits> #include <cassert> +#include "test_macros.h" #include "../../rep.h" int main() @@ -25,7 +26,7 @@ int main() std::numeric_limits<double>::lowest()); assert(std::chrono::duration_values<Rep>::min() == std::numeric_limits<Rep>::lowest()); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 static_assert(std::chrono::duration_values<int>::min() == std::numeric_limits<int>::lowest(), ""); static_assert(std::chrono::duration_values<double>::min() == diff --git a/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp b/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp index 234b4bc31c9d..b84a676738a8 100644 --- a/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp +++ b/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp @@ -14,13 +14,14 @@ #include <chrono> #include <cassert> +#include "test_macros.h" #include "../../rep.h" int main() { assert(std::chrono::duration_values<int>::zero() == 0); assert(std::chrono::duration_values<Rep>::zero() == 0); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 static_assert(std::chrono::duration_values<int>::zero() == 0, ""); static_assert(std::chrono::duration_values<Rep>::zero() == 0, ""); #endif diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp index eeaa8a24ee68..fa2f116f7718 100644 --- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp +++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp @@ -86,7 +86,6 @@ int main() static_assert(!noexcept(std::tuple<NoExceptDefault, ThrowingDefault>()), ""); static_assert(!noexcept(std::tuple<ThrowingDefault, ThrowingDefault>()), ""); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::tuple<> t; } @@ -106,5 +105,4 @@ int main() IllFormedDefault v(0); std::tuple<IllFormedDefault> t(v); } -#endif } diff --git a/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp b/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp index 90476bcde28c..12968de2dd47 100644 --- a/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp +++ b/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <utility> // template <class T1, class T2> struct pair @@ -42,7 +44,6 @@ public: int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS std::pair<A, B> p(std::piecewise_construct, std::make_tuple(4, 'a'), std::make_tuple(3.5, 6u, 2u)); @@ -51,5 +52,4 @@ int main() assert(p.second.get_d() == 3.5); assert(p.second.get_u1() == 6u); assert(p.second.get_u2() == 2u); -#endif } diff --git a/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp index 42a2666dd04b..c738adad7d79 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <utility> // template <class T1, class T2> struct pair @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS { typedef std::pair<int, int*> P1; typedef std::pair<int*, int> P2; @@ -31,5 +32,4 @@ int main() assert(p3.first == P1(3, nullptr)); assert(p3.second == P2(nullptr, 4)); } -#endif // _LIBCPP_HAS_NO_VARIADICS } diff --git a/test/support/Counter.h b/test/support/Counter.h index eb6e04e72ef6..602f35f70671 100644 --- a/test/support/Counter.h +++ b/test/support/Counter.h @@ -12,6 +12,8 @@ #include <functional> // for std::hash +#include "test_macros.h" + struct Counter_base { static int gConstructed; }; template <typename T> @@ -22,7 +24,7 @@ public: Counter(const T &data) : data_(data) { ++gConstructed; } Counter(const Counter& rhs) : data_(rhs.data_) { ++gConstructed; } Counter& operator=(const Counter& rhs) { ++gConstructed; data_ = rhs.data_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 Counter(Counter&& rhs) : data_(std::move(rhs.data_)) { ++gConstructed; } Counter& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; } #endif diff --git a/test/support/MoveOnly.h b/test/support/MoveOnly.h index 0ffb4ffe3b2f..4afa8aef7104 100644 --- a/test/support/MoveOnly.h +++ b/test/support/MoveOnly.h @@ -12,7 +12,7 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 #include <cstddef> #include <functional> @@ -49,6 +49,6 @@ struct hash<MoveOnly> } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 #endif // MOVEONLY_H diff --git a/test/support/allocators.h b/test/support/allocators.h index 4aa467f824aa..b1eea8d0b683 100644 --- a/test/support/allocators.h +++ b/test/support/allocators.h @@ -15,7 +15,7 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 template <class T> class A1 @@ -186,6 +186,6 @@ bool operator!=(const A3<T>& x, const A3<U>& y) return !(x == y); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 #endif // ALLOCATORS_H diff --git a/test/support/nasty_containers.hpp b/test/support/nasty_containers.hpp index dcad6c259ff6..99e91d617f6d 100644 --- a/test/support/nasty_containers.hpp +++ b/test/support/nasty_containers.hpp @@ -39,7 +39,7 @@ public: explicit nasty_vector(size_type n) : v_(n) {} nasty_vector(size_type n, const value_type& value) : v_(n, value) {} template <class InputIterator> nasty_vector(InputIterator first, InputIterator last) : v_(first, last) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 nasty_vector(std::initializer_list<value_type> il) : v_(il) {} #endif ~nasty_vector() {} @@ -47,7 +47,7 @@ public: template <class InputIterator> void assign(InputIterator first, InputIterator last) { v_.assign(first, last); } void assign(size_type n, const value_type& u) { v_.assign(n, u); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 void assign(std::initializer_list<value_type> il) { v_.assign(il); } #endif @@ -87,24 +87,20 @@ public: const value_type* data() const TEST_NOEXCEPT { return v_.data(); } void push_back(const value_type& x) { v_.push_back(x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 void push_back(value_type&& x) { v_.push_back(std::forward<value_type&&>(x)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS template <class... Args> void emplace_back(Args&&... args) { v_.emplace_back(std::forward<Args>(args)...); } #endif -#endif void pop_back() { v_.pop_back(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class... Args> iterator emplace(const_iterator pos, Args&&... args) { return v_.emplace(pos, std::forward<Args>(args)...); } #endif -#endif iterator insert(const_iterator pos, const value_type& x) { return v_.insert(pos, x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, value_type&& x) { return v_.insert(pos, std::forward<value_type>(x)); } #endif iterator insert(const_iterator pos, size_type n, const value_type& x) { return v_.insert(pos, n, x); } @@ -112,7 +108,7 @@ public: iterator insert(const_iterator pos, InputIterator first, InputIterator last) { return v_.insert(pos, first, last); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return v_.insert(pos, il); } #endif @@ -166,19 +162,19 @@ public: nasty_list(size_type n, const value_type& value) : l_(n,value) {} template <class Iter> nasty_list(Iter first, Iter last) : l_(first, last) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 nasty_list(std::initializer_list<value_type> il) : l_(il) {} #endif ~nasty_list() {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 nasty_list& operator=(std::initializer_list<value_type> il) { l_ = il; return *this; } #endif template <class Iter> void assign(Iter first, Iter last) { l_.assign(first, last); } void assign(size_type n, const value_type& t) { l_.assign(n, t); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 void assign(std::initializer_list<value_type> il) { l_.assign(il); } #endif @@ -209,28 +205,24 @@ public: void push_front(const value_type& x) { l_.push_front(x); } void push_back(const value_type& x) { l_.push_back(x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 void push_back(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); } void push_front(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS template <class... Args> void emplace_back(Args&&... args) { l_.emplace_back(std::forward<Args>(args)...); } template <class... Args> void emplace_front(Args&&... args) { l_.emplace_front(std::forward<Args>(args)...); } #endif -#endif void pop_front() { l_.pop_front(); } void pop_back() { l_.pop_back(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class... Args> iterator emplace(const_iterator pos, Args&&... args) { return l_.emplace(pos, std::forward<Args>(args)...); } #endif -#endif iterator insert(const_iterator pos, const value_type& x) { return l_.insert(pos, x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, value_type&& x) { return l_.insert(pos, std::forward<value_type>(x)); } #endif iterator insert(const_iterator pos, size_type n, const value_type& x) { return l_.insert(pos, n, x); } @@ -238,7 +230,7 @@ public: iterator insert(const_iterator pos, InputIterator first, InputIterator last) { return l_.insert(pos, first, last); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return l_.insert(pos, il); } #endif diff --git a/test/support/tracked_value.h b/test/support/tracked_value.h index 14d96b88368e..6b75516e627b 100644 --- a/test/support/tracked_value.h +++ b/test/support/tracked_value.h @@ -11,6 +11,8 @@ #include <cassert> +#include "test_macros.h" + struct TrackedValue { enum State { CONSTRUCTED, MOVED_FROM, DESTROYED }; State state; @@ -22,7 +24,7 @@ struct TrackedValue { assert(t.state != State::DESTROYED && "copying a destroyed object"); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 TrackedValue(TrackedValue&& t) : state(State::CONSTRUCTED) { assert(t.state != State::MOVED_FROM && "double moving from an object"); assert(t.state != State::DESTROYED && "moving from a destroyed object"); @@ -38,7 +40,7 @@ struct TrackedValue { return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 TrackedValue& operator=(TrackedValue&& t) { assert(state != State::DESTROYED && "move assigning into destroyed object"); assert(t.state != State::MOVED_FROM && "double moving from an object"); diff --git a/utils/google-benchmark/AUTHORS b/utils/google-benchmark/AUTHORS index 5a545fa5bec2..c4b059df2581 100644 --- a/utils/google-benchmark/AUTHORS +++ b/utils/google-benchmark/AUTHORS @@ -18,12 +18,15 @@ Eugene Zhuk <eugene.zhuk@gmail.com> Evgeny Safronov <division494@gmail.com> Felix Homann <linuxaudio@showlabor.de> Google Inc. +International Business Machines Corporation Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com> +Joao Paulo Magalhaes <joaoppmagalhaes@gmail.com> JianXiong Zhou <zhoujianxiong2@gmail.com> Jussi Knuuttila <jussi.knuuttila@gmail.com> Kaito Udagawa <umireon@gmail.com> Lei Xu <eddyxu@gmail.com> Matt Clarkson <mattyclarkson@gmail.com> +Maxim Vafin <maxvafin@gmail.com> Nick Hutchinson <nshutchinson@gmail.com> Oleksandr Sochka <sasha.sochka@gmail.com> Paul Redmond <paul.redmond@gmail.com> diff --git a/utils/google-benchmark/CMakeLists.txt b/utils/google-benchmark/CMakeLists.txt index 8bfd21b190ab..1ba313319441 100644 --- a/utils/google-benchmark/CMakeLists.txt +++ b/utils/google-benchmark/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 2.8.12) project (benchmark) foreach(p @@ -11,8 +11,11 @@ foreach(p endforeach() option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON) +option(BENCHMARK_ENABLE_EXCEPTIONS "Enable the use of exceptions in the benchmark library." ON) option(BENCHMARK_ENABLE_LTO "Enable link time optimisation of the benchmark library." OFF) option(BENCHMARK_USE_LIBCXX "Build and test using libc++ as the standard library." OFF) +option(BENCHMARK_BUILD_32_BITS "Build a 32 bit version of the library" OFF) + # Make sure we can import out CMake functions list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -33,12 +36,20 @@ include(CheckCXXCompilerFlag) include(AddCXXCompilerFlag) include(CXXFeatureCheck) +if (BENCHMARK_BUILD_32_BITS) + add_required_cxx_compiler_flag(-m32) +endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Turn compiler warnings up to 11 string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") add_definitions(-D_CRT_SECURE_NO_WARNINGS) + if (NOT BENCHMARK_ENABLE_EXCEPTIONS) + add_cxx_compiler_flag(-EHs-) + add_cxx_compiler_flag(-EHa-) + endif() # Link time optimisation if (BENCHMARK_ENABLE_LTO) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") @@ -80,12 +91,20 @@ else() add_cxx_compiler_flag(-Wshorten-64-to-32) add_cxx_compiler_flag(-Wfloat-equal) add_cxx_compiler_flag(-fstrict-aliasing) + if (NOT BENCHMARK_ENABLE_EXCEPTIONS) + add_cxx_compiler_flag(-fno-exceptions) + endif() if (NOT BENCHMARK_USE_LIBCXX) add_cxx_compiler_flag(-Wzero-as-null-pointer-constant) endif() if (HAVE_CXX_FLAG_FSTRICT_ALIASING) - add_cxx_compiler_flag(-Wstrict-aliasing) + if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") #ICC17u2: Many false positives for Wstrict-aliasing + add_cxx_compiler_flag(-Wstrict-aliasing) + endif() endif() + # ICC17u2: overloaded virtual function "benchmark::Fixture::SetUp" is only partially overridden + # (because of deprecated overload) + add_cxx_compiler_flag(-wd654) add_cxx_compiler_flag(-Wthread-safety) if (HAVE_CXX_FLAG_WTHREAD_SAFETY) cxx_feature_check(THREAD_SAFETY_ATTRIBUTES) @@ -162,7 +181,10 @@ cxx_feature_check(POSIX_REGEX) if(NOT HAVE_STD_REGEX AND NOT HAVE_GNU_POSIX_REGEX AND NOT HAVE_POSIX_REGEX) message(FATAL_ERROR "Failed to determine the source files for the regular expression backend") endif() - +if (NOT BENCHMARK_ENABLE_EXCEPTIONS AND HAVE_STD_REGEX + AND NOT HAVE_GNU_POSIX_REGEX AND NOT HAVE_POSIX_REGEX) + message(WARNING "Using std::regex with exceptions disabled is not fully supported") +endif() cxx_feature_check(STEADY_CLOCK) # Ensure we have pthreads find_package(Threads REQUIRED) diff --git a/utils/google-benchmark/CONTRIBUTORS b/utils/google-benchmark/CONTRIBUTORS index 33cd941ffed7..8ca4565aa74b 100644 --- a/utils/google-benchmark/CONTRIBUTORS +++ b/utils/google-benchmark/CONTRIBUTORS @@ -34,18 +34,21 @@ Eugene Zhuk <eugene.zhuk@gmail.com> Evgeny Safronov <division494@gmail.com> Felix Homann <linuxaudio@showlabor.de> Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com> +Joao Paulo Magalhaes <joaoppmagalhaes@gmail.com> JianXiong Zhou <zhoujianxiong2@gmail.com> Jussi Knuuttila <jussi.knuuttila@gmail.com> Kaito Udagawa <umireon@gmail.com> Kai Wolf <kai.wolf@gmail.com> Lei Xu <eddyxu@gmail.com> Matt Clarkson <mattyclarkson@gmail.com> +Maxim Vafin <maxvafin@gmail.com> Nick Hutchinson <nshutchinson@gmail.com> Oleksandr Sochka <sasha.sochka@gmail.com> Pascal Leroy <phl@google.com> Paul Redmond <paul.redmond@gmail.com> Pierre Phaneuf <pphaneuf@google.com> Radoslav Yovchev <radoslav.tm@gmail.com> +Ray Glover <ray.glover@uk.ibm.com> Shuo Chen <chenshuo@chenshuo.com> Yusuke Suzuki <utatane.tea@gmail.com> Tobias Ulvgård <tobias.ulvgard@dirac.se> diff --git a/utils/google-benchmark/README.md b/utils/google-benchmark/README.md index 9109430984ce..f16a9d7906a8 100644 --- a/utils/google-benchmark/README.md +++ b/utils/google-benchmark/README.md @@ -11,6 +11,8 @@ IRC channel: https://freenode.net #googlebenchmark [Known issues and common problems](#known-issues) +[Additional Tooling Documentation](docs/tools.md) + ## Example usage ### Basic usage Define a function that executes the code to be measured. @@ -363,7 +365,7 @@ static void BM_vector_push_back(benchmark::State& state) { } ``` -Note that `ClobberMemory()` is only available for GNU based compilers. +Note that `ClobberMemory()` is only available for GNU or MSVC based compilers. ### Set time unit manually If a benchmark runs a few milliseconds it may be hard to visually compare the @@ -430,6 +432,65 @@ BENCHMARK_REGISTER_F(MyFixture, BarTest)->Threads(2); /* BarTest is now registered */ ``` + +## User-defined counters + +You can add your own counters with user-defined names. The example below +will add columns "Foo", "Bar" and "Baz" in its output: + +```c++ +static void UserCountersExample1(benchmark::State& state) { + double numFoos = 0, numBars = 0, numBazs = 0; + while (state.KeepRunning()) { + // ... count Foo,Bar,Baz events + } + state.counters["Foo"] = numFoos; + state.counters["Bar"] = numBars; + state.counters["Baz"] = numBazs; +} +``` + +The `state.counters` object is a `std::map` with `std::string` keys +and `Counter` values. The latter is a `double`-like class, via an implicit +conversion to `double&`. Thus you can use all of the standard arithmetic +assignment operators (`=,+=,-=,*=,/=`) to change the value of each counter. + +In multithreaded benchmarks, each counter is set on the calling thread only. +When the benchmark finishes, the counters from each thread will be summed; +the resulting sum is the value which will be shown for the benchmark. + +The `Counter` constructor accepts two parameters: the value as a `double` +and a bit flag which allows you to show counters as rates and/or as +per-thread averages: + +```c++ + // sets a simple counter + state.counters["Foo"] = numFoos; + + // Set the counter as a rate. It will be presented divided + // by the duration of the benchmark. + state.counters["FooRate"] = Counter(numFoos, benchmark::Counter::kIsRate); + + // Set the counter as a thread-average quantity. It will + // be presented divided by the number of threads. + state.counters["FooAvg"] = Counter(numFoos, benchmark::Counter::kAvgThreads); + + // There's also a combined flag: + state.counters["FooAvgRate"] = Counter(numFoos,benchmark::Counter::kAvgThreadsRate); +``` + +When you're compiling in C++11 mode or later you can use `insert()` with +`std::initializer_list`: + +```c++ + // With C++11, this can be done: + state.counters.insert({{"Foo", numFoos}, {"Bar", numBars}, {"Baz", numBazs}}); + // ... instead of: + state.counters["Foo"] = numFoos; + state.counters["Bar"] = numBars; + state.counters["Baz"] = numBazs; +``` + ## Exiting Benchmarks in Error When errors caused by external influences, such as file I/O and network @@ -501,7 +562,7 @@ The `context` attribute contains information about the run in general, including information about the CPU and the date. The `benchmarks` attribute contains a list of ever benchmark run. Example json output looks like: -``` json +```json { "context": { "date": "2015/03/17-18:40:25", @@ -582,6 +643,7 @@ The following minimum versions are strongly recommended build the library: * GCC 4.8 * Clang 3.4 * Visual Studio 2013 +* Intel 2015 Update 1 Anything older *may* work. diff --git a/utils/google-benchmark/cmake/AddCXXCompilerFlag.cmake b/utils/google-benchmark/cmake/AddCXXCompilerFlag.cmake index 9afde84be11e..0b176ba27f1f 100644 --- a/utils/google-benchmark/cmake/AddCXXCompilerFlag.cmake +++ b/utils/google-benchmark/cmake/AddCXXCompilerFlag.cmake @@ -19,14 +19,21 @@ set(__add_cxx_compiler_flag INCLUDED) include(CheckCXXCompilerFlag) -function(add_cxx_compiler_flag FLAG) +function(mangle_compiler_flag FLAG OUTPUT) string(TOUPPER "HAVE_CXX_FLAG_${FLAG}" SANITIZED_FLAG) string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG}) string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG}) string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG}) - set(CMAKE_REQUIRED_FLAGS "${FLAG}") - check_cxx_compiler_flag("${FLAG}" ${SANITIZED_FLAG}) - if(${SANITIZED_FLAG}) + set(${OUTPUT} "${SANITIZED_FLAG}" PARENT_SCOPE) +endfunction(mangle_compiler_flag) + +function(add_cxx_compiler_flag FLAG) + mangle_compiler_flag("${FLAG}" MANGLED_FLAG) + set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") + check_cxx_compiler_flag("${FLAG}" ${MANGLED_FLAG}) + set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") + if(${MANGLED_FLAG}) set(VARIANT ${ARGV1}) if(ARGV1) string(TOUPPER "_${VARIANT}" VARIANT) @@ -35,3 +42,23 @@ function(add_cxx_compiler_flag FLAG) endif() endfunction() +function(add_required_cxx_compiler_flag FLAG) + mangle_compiler_flag("${FLAG}" MANGLED_FLAG) + set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") + check_cxx_compiler_flag("${FLAG}" ${MANGLED_FLAG}) + set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") + if(${MANGLED_FLAG}) + set(VARIANT ${ARGV1}) + if(ARGV1) + string(TOUPPER "_${VARIANT}" VARIANT) + endif() + set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAG}" PARENT_SCOPE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLAG}" PARENT_SCOPE) + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FLAG}" PARENT_SCOPE) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Required flag '${FLAG}' is not supported by the compiler") + endif() +endfunction() diff --git a/utils/google-benchmark/cmake/CXXFeatureCheck.cmake b/utils/google-benchmark/cmake/CXXFeatureCheck.cmake index b106f32b6393..6efe6a84ee49 100644 --- a/utils/google-benchmark/cmake/CXXFeatureCheck.cmake +++ b/utils/google-benchmark/cmake/CXXFeatureCheck.cmake @@ -10,7 +10,7 @@ # # include(CXXFeatureCheck) # cxx_feature_check(STD_REGEX) -# Requires CMake 2.6+ +# Requires CMake 2.8.12+ if(__cxx_feature_check) return() diff --git a/utils/google-benchmark/cmake/Config.cmake.in b/utils/google-benchmark/cmake/Config.cmake.in new file mode 100644 index 000000000000..6e9256eea8a2 --- /dev/null +++ b/utils/google-benchmark/cmake/Config.cmake.in @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") diff --git a/utils/google-benchmark/docs/tools.md b/utils/google-benchmark/docs/tools.md new file mode 100644 index 000000000000..f176f74a48f8 --- /dev/null +++ b/utils/google-benchmark/docs/tools.md @@ -0,0 +1,59 @@ +# Benchmark Tools + +## compare_bench.py + +The `compare_bench.py` utility which can be used to compare the result of benchmarks. +The program is invoked like: + +``` bash +$ compare_bench.py <old-benchmark> <new-benchmark> [benchmark options]... +``` + +Where `<old-benchmark>` and `<new-benchmark>` either specify a benchmark executable file, or a JSON output file. The type of the input file is automatically detected. If a benchmark executable is specified then the benchmark is run to obtain the results. Otherwise the results are simply loaded from the output file. + +The sample output using the JSON test files under `Inputs/` gives: + +``` bash +$ ./compare_bench.py ./gbench/Inputs/test1_run1.json ./gbench/Inputs/test1_run2.json +Comparing ./gbench/Inputs/test1_run1.json to ./gbench/Inputs/test1_run2.json +Benchmark Time CPU +---------------------------------------------- +BM_SameTimes +0.00 +0.00 +BM_2xFaster -0.50 -0.50 +BM_2xSlower +1.00 +1.00 +BM_10PercentFaster -0.10 -0.10 +BM_10PercentSlower +0.10 +0.10 +``` + +When a benchmark executable is run, the raw output from the benchmark is printed in real time to stdout. The sample output using `benchmark/basic_test` for both arguments looks like: + +``` +./compare_bench.py test/basic_test test/basic_test --benchmark_filter=BM_empty.* +RUNNING: test/basic_test --benchmark_filter=BM_empty.* +Run on (4 X 4228.32 MHz CPU s) +2016-08-02 19:21:33 +Benchmark Time CPU Iterations +-------------------------------------------------------------------- +BM_empty 9 ns 9 ns 79545455 +BM_empty/threads:4 4 ns 9 ns 75268816 +BM_empty_stop_start 8 ns 8 ns 83333333 +BM_empty_stop_start/threads:4 3 ns 8 ns 83333332 +RUNNING: test/basic_test --benchmark_filter=BM_empty.* +Run on (4 X 4228.32 MHz CPU s) +2016-08-02 19:21:35 +Benchmark Time CPU Iterations +-------------------------------------------------------------------- +BM_empty 9 ns 9 ns 76086957 +BM_empty/threads:4 4 ns 9 ns 76086956 +BM_empty_stop_start 8 ns 8 ns 87500000 +BM_empty_stop_start/threads:4 3 ns 8 ns 88607596 +Comparing test/basic_test to test/basic_test +Benchmark Time CPU +--------------------------------------------------------- +BM_empty +0.00 +0.00 +BM_empty/threads:4 +0.00 +0.00 +BM_empty_stop_start +0.00 +0.00 +BM_empty_stop_start/threads:4 +0.00 +0.00 +``` + +Obviously this example doesn't give any useful output, but it's intended to show the output format when 'compare_bench.py' needs to run benchmarks. diff --git a/utils/google-benchmark/include/benchmark/benchmark_api.h b/utils/google-benchmark/include/benchmark/benchmark_api.h index 28baa587a9e1..1e853e2cd4e0 100644 --- a/utils/google-benchmark/include/benchmark/benchmark_api.h +++ b/utils/google-benchmark/include/benchmark/benchmark_api.h @@ -155,19 +155,29 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond); #include <string> #include <vector> +#include <map> #include "macros.h" #if defined(BENCHMARK_HAS_CXX11) #include <type_traits> +#include <initializer_list> #include <utility> #endif +#if defined(_MSC_VER) +#include <intrin.h> // for _ReadWriteBarrier +#endif + namespace benchmark { class BenchmarkReporter; void Initialize(int* argc, char** argv); +// Report to stdout all arguments in 'argv' as unrecognized except the first. +// Returns true there is at least on unrecognized argument (i.e. 'argc' > 1). +bool ReportUnrecognizedArguments(int argc, char** argv); + // Generate a list of benchmarks matching the specified --benchmark_filter flag // and if --benchmark_list_tests is specified return after printing the name // of each matching benchmark. Otherwise run each matching benchmark and @@ -197,19 +207,6 @@ class Benchmark; class BenchmarkImp; class BenchmarkFamilies; -template <class T> -struct Voider { - typedef void type; -}; - -template <class T, class = void> -struct EnableIfString {}; - -template <class T> -struct EnableIfString<T, typename Voider<typename T::basic_string>::type> { - typedef int type; -}; - void UseCharPointer(char const volatile*); // Take ownership of the pointer and register the benchmark. Return the @@ -222,11 +219,16 @@ BENCHMARK_UNUSED static int stream_init_anchor = InitializeStreams(); } // end namespace internal + +#if !defined(__GNUC__) || defined(__pnacl__) || defined(EMSCRIPTN) +# define BENCHMARK_HAS_NO_INLINE_ASSEMBLY +#endif + // The DoNotOptimize(...) function can be used to prevent a value or // expression from being optimized away by the compiler. This function is // intended to add little to no overhead. // See: https://youtu.be/nXaxk27zwlk?t=2441 -#if defined(__GNUC__) +#ifndef BENCHMARK_HAS_NO_INLINE_ASSEMBLY template <class Tp> inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { asm volatile("" : : "g"(value) : "memory"); @@ -236,14 +238,57 @@ inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() { asm volatile("" : : : "memory"); } +#elif defined(_MSC_VER) +template <class Tp> +inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { + internal::UseCharPointer(&reinterpret_cast<char const volatile&>(value)); + _ReadWriteBarrier(); +} + +inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() { + _ReadWriteBarrier(); +} #else template <class Tp> inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { internal::UseCharPointer(&reinterpret_cast<char const volatile&>(value)); } -// FIXME Add ClobberMemory() for non-gnu compilers +// FIXME Add ClobberMemory() for non-gnu and non-msvc compilers #endif + + +// This class is used for user-defined counters. +class Counter { +public: + + enum Flags { + kDefaults = 0, + // Mark the counter as a rate. It will be presented divided + // by the duration of the benchmark. + kIsRate = 1, + // Mark the counter as a thread-average quantity. It will be + // presented divided by the number of threads. + kAvgThreads = 2, + // Mark the counter as a thread-average rate. See above. + kAvgThreadsRate = kIsRate|kAvgThreads + }; + + double value; + Flags flags; + + BENCHMARK_ALWAYS_INLINE + Counter(double v = 0., Flags f = kDefaults) : value(v), flags(f) {} + + BENCHMARK_ALWAYS_INLINE operator double const& () const { return value; } + BENCHMARK_ALWAYS_INLINE operator double & () { return value; } + +}; + +// This is the container for the user-defined counters. +typedef std::map<std::string, Counter> UserCounters; + + // TimeUnit is passed to a benchmark in order to specify the order of magnitude // for the measured time. enum TimeUnit { kNanosecond, kMicrosecond, kMillisecond }; @@ -393,13 +438,7 @@ class State { // REQUIRES: a benchmark has exited its KeepRunning loop. void SetLabel(const char* label); - // Allow the use of std::string without actually including <string>. - // This function does not participate in overload resolution unless StringType - // has the nested typename `basic_string`. This typename should be provided - // as an injected class name in the case of std::string. - template <class StringType> - void SetLabel(StringType const& str, - typename internal::EnableIfString<StringType>::type = 1) { + void BENCHMARK_ALWAYS_INLINE SetLabel(const std::string& str) { this->SetLabel(str.c_str()); } @@ -434,6 +473,8 @@ class State { bool error_occurred_; public: + // Container for user-defined counters. + UserCounters counters; // Index of the executing thread. Values from [0, threads). const int thread_index; // Number of threads concurrently executing the benchmark. @@ -536,9 +577,17 @@ class Benchmark { // Set the minimum amount of time to use when running this benchmark. This // option overrides the `benchmark_min_time` flag. - // REQUIRES: `t > 0` + // REQUIRES: `t > 0` and `Iterations` has not been called on this benchmark. Benchmark* MinTime(double t); + // Specify the amount of iterations that should be run by this benchmark. + // REQUIRES: 'n > 0' and `MinTime` has not been called on this benchmark. + // + // NOTE: This function should only be used when *exact* iteration control is + // needed and never to control or limit how long a benchmark runs, where + // `--benchmark_min_time=N` or `MinTime(...)` should be used instead. + Benchmark* Iterations(size_t n); + // Specify the amount of times to repeat this benchmark. This option overrides // the `benchmark_repetitions` flag. // REQUIRES: `n > 0` @@ -627,6 +676,7 @@ class Benchmark { TimeUnit time_unit_; int range_multiplier_; double min_time_; + size_t iterations_; int repetitions_; bool use_real_time_; bool use_manual_time_; @@ -858,6 +908,7 @@ class Fixture : public internal::Benchmark { #define BENCHMARK_MAIN() \ int main(int argc, char** argv) { \ ::benchmark::Initialize(&argc, argv); \ + if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; \ ::benchmark::RunSpecifiedBenchmarks(); \ } diff --git a/utils/google-benchmark/include/benchmark/reporter.h b/utils/google-benchmark/include/benchmark/reporter.h index 8c39e7f7fa6b..789124ba8138 100644 --- a/utils/google-benchmark/include/benchmark/reporter.h +++ b/utils/google-benchmark/include/benchmark/reporter.h @@ -19,6 +19,7 @@ #include <string> #include <utility> #include <vector> +#include <set> #include "benchmark_api.h" // For forward declaration of BenchmarkReporter @@ -54,7 +55,8 @@ class BenchmarkReporter { complexity_lambda(), complexity_n(0), report_big_o(false), - report_rms(false) {} + report_rms(false), + counters() {} std::string benchmark_name; std::string report_label; // Empty if not set by benchmark. @@ -93,6 +95,8 @@ class BenchmarkReporter { // Inform print function whether the current run is a complexity report bool report_big_o; bool report_rms; + + UserCounters counters; }; // Construct a BenchmarkReporter with the output stream set to 'std::cout' @@ -163,7 +167,10 @@ class ConsoleReporter : public BenchmarkReporter { protected: virtual void PrintRunData(const Run& report); + virtual void PrintHeader(const Run& report); + size_t name_field_width_; + bool printed_header_; private: bool color_output_; @@ -184,11 +191,15 @@ class JSONReporter : public BenchmarkReporter { class CSVReporter : public BenchmarkReporter { public: + CSVReporter() : printed_header_(false) {} virtual bool ReportContext(const Context& context); virtual void ReportRuns(const std::vector<Run>& reports); private: void PrintRunData(const Run& report); + + bool printed_header_; + std::set< std::string > user_counter_names_; }; inline const char* GetTimeUnitString(TimeUnit unit) { diff --git a/utils/google-benchmark/mingw.py b/utils/google-benchmark/mingw.py new file mode 100644 index 000000000000..706ad559db9c --- /dev/null +++ b/utils/google-benchmark/mingw.py @@ -0,0 +1,320 @@ +#! /usr/bin/env python +# encoding: utf-8 + +import argparse +import errno +import logging +import os +import platform +import re +import sys +import subprocess +import tempfile + +try: + import winreg +except ImportError: + import _winreg as winreg +try: + import urllib.request as request +except ImportError: + import urllib as request +try: + import urllib.parse as parse +except ImportError: + import urlparse as parse + +class EmptyLogger(object): + ''' + Provides an implementation that performs no logging + ''' + def debug(self, *k, **kw): + pass + def info(self, *k, **kw): + pass + def warn(self, *k, **kw): + pass + def error(self, *k, **kw): + pass + def critical(self, *k, **kw): + pass + def setLevel(self, *k, **kw): + pass + +urls = ( + 'http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20' + 'targetting%20Win32/Personal%20Builds/mingw-builds/installer/' + 'repository.txt', + 'http://downloads.sourceforge.net/project/mingwbuilds/host-windows/' + 'repository.txt' +) +''' +A list of mingw-build repositories +''' + +def repository(urls = urls, log = EmptyLogger()): + ''' + Downloads and parse mingw-build repository files and parses them + ''' + log.info('getting mingw-builds repository') + versions = {} + re_sourceforge = re.compile(r'http://sourceforge.net/projects/([^/]+)/files') + re_sub = r'http://downloads.sourceforge.net/project/\1' + for url in urls: + log.debug(' - requesting: %s', url) + socket = request.urlopen(url) + repo = socket.read() + if not isinstance(repo, str): + repo = repo.decode(); + socket.close() + for entry in repo.split('\n')[:-1]: + value = entry.split('|') + version = tuple([int(n) for n in value[0].strip().split('.')]) + version = versions.setdefault(version, {}) + arch = value[1].strip() + if arch == 'x32': + arch = 'i686' + elif arch == 'x64': + arch = 'x86_64' + arch = version.setdefault(arch, {}) + threading = arch.setdefault(value[2].strip(), {}) + exceptions = threading.setdefault(value[3].strip(), {}) + revision = exceptions.setdefault(int(value[4].strip()[3:]), + re_sourceforge.sub(re_sub, value[5].strip())) + return versions + +def find_in_path(file, path=None): + ''' + Attempts to find an executable in the path + ''' + if platform.system() == 'Windows': + file += '.exe' + if path is None: + path = os.environ.get('PATH', '') + if type(path) is type(''): + path = path.split(os.pathsep) + return list(filter(os.path.exists, + map(lambda dir, file=file: os.path.join(dir, file), path))) + +def find_7zip(log = EmptyLogger()): + ''' + Attempts to find 7zip for unpacking the mingw-build archives + ''' + log.info('finding 7zip') + path = find_in_path('7z') + if not path: + key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\7-Zip') + path, _ = winreg.QueryValueEx(key, 'Path') + path = [os.path.join(path, '7z.exe')] + log.debug('found \'%s\'', path[0]) + return path[0] + +find_7zip() + +def unpack(archive, location, log = EmptyLogger()): + ''' + Unpacks a mingw-builds archive + ''' + sevenzip = find_7zip(log) + log.info('unpacking %s', os.path.basename(archive)) + cmd = [sevenzip, 'x', archive, '-o' + location, '-y'] + log.debug(' - %r', cmd) + with open(os.devnull, 'w') as devnull: + subprocess.check_call(cmd, stdout = devnull) + +def download(url, location, log = EmptyLogger()): + ''' + Downloads and unpacks a mingw-builds archive + ''' + log.info('downloading MinGW') + log.debug(' - url: %s', url) + log.debug(' - location: %s', location) + + re_content = re.compile(r'attachment;[ \t]*filename=(")?([^"]*)(")?[\r\n]*') + + stream = request.urlopen(url) + try: + content = stream.getheader('Content-Disposition') or '' + except AttributeError: + content = stream.headers.getheader('Content-Disposition') or '' + matches = re_content.match(content) + if matches: + filename = matches.group(2) + else: + parsed = parse.urlparse(stream.geturl()) + filename = os.path.basename(parsed.path) + + try: + os.makedirs(location) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(location): + pass + else: + raise + + archive = os.path.join(location, filename) + with open(archive, 'wb') as out: + while True: + buf = stream.read(1024) + if not buf: + break + out.write(buf) + unpack(archive, location, log = log) + os.remove(archive) + + possible = os.path.join(location, 'mingw64') + if not os.path.exists(possible): + possible = os.path.join(location, 'mingw32') + if not os.path.exists(possible): + raise ValueError('Failed to find unpacked MinGW: ' + possible) + return possible + +def root(location = None, arch = None, version = None, threading = None, + exceptions = None, revision = None, log = EmptyLogger()): + ''' + Returns the root folder of a specific version of the mingw-builds variant + of gcc. Will download the compiler if needed + ''' + + # Get the repository if we don't have all the information + if not (arch and version and threading and exceptions and revision): + versions = repository(log = log) + + # Determine some defaults + version = version or max(versions.keys()) + if not arch: + arch = platform.machine().lower() + if arch == 'x86': + arch = 'i686' + elif arch == 'amd64': + arch = 'x86_64' + if not threading: + keys = versions[version][arch].keys() + if 'posix' in keys: + threading = 'posix' + elif 'win32' in keys: + threading = 'win32' + else: + threading = keys[0] + if not exceptions: + keys = versions[version][arch][threading].keys() + if 'seh' in keys: + exceptions = 'seh' + elif 'sjlj' in keys: + exceptions = 'sjlj' + else: + exceptions = keys[0] + if revision == None: + revision = max(versions[version][arch][threading][exceptions].keys()) + if not location: + location = os.path.join(tempfile.gettempdir(), 'mingw-builds') + + # Get the download url + url = versions[version][arch][threading][exceptions][revision] + + # Tell the user whatzzup + log.info('finding MinGW %s', '.'.join(str(v) for v in version)) + log.debug(' - arch: %s', arch) + log.debug(' - threading: %s', threading) + log.debug(' - exceptions: %s', exceptions) + log.debug(' - revision: %s', revision) + log.debug(' - url: %s', url) + + # Store each specific revision differently + slug = '{version}-{arch}-{threading}-{exceptions}-rev{revision}' + slug = slug.format( + version = '.'.join(str(v) for v in version), + arch = arch, + threading = threading, + exceptions = exceptions, + revision = revision + ) + if arch == 'x86_64': + root_dir = os.path.join(location, slug, 'mingw64') + elif arch == 'i686': + root_dir = os.path.join(location, slug, 'mingw32') + else: + raise ValueError('Unknown MinGW arch: ' + arch) + + # Download if needed + if not os.path.exists(root_dir): + downloaded = download(url, os.path.join(location, slug), log = log) + if downloaded != root_dir: + raise ValueError('The location of mingw did not match\n%s\n%s' + % (downloaded, root_dir)) + + return root_dir + +def str2ver(string): + ''' + Converts a version string into a tuple + ''' + try: + version = tuple(int(v) for v in string.split('.')) + if len(version) is not 3: + raise ValueError() + except ValueError: + raise argparse.ArgumentTypeError( + 'please provide a three digit version string') + return version + +def main(): + ''' + Invoked when the script is run directly by the python interpreter + ''' + parser = argparse.ArgumentParser( + description = 'Downloads a specific version of MinGW', + formatter_class = argparse.ArgumentDefaultsHelpFormatter + ) + parser.add_argument('--location', + help = 'the location to download the compiler to', + default = os.path.join(tempfile.gettempdir(), 'mingw-builds')) + parser.add_argument('--arch', required = True, choices = ['i686', 'x86_64'], + help = 'the target MinGW architecture string') + parser.add_argument('--version', type = str2ver, + help = 'the version of GCC to download') + parser.add_argument('--threading', choices = ['posix', 'win32'], + help = 'the threading type of the compiler') + parser.add_argument('--exceptions', choices = ['sjlj', 'seh', 'dwarf'], + help = 'the method to throw exceptions') + parser.add_argument('--revision', type=int, + help = 'the revision of the MinGW release') + group = parser.add_mutually_exclusive_group() + group.add_argument('-v', '--verbose', action='store_true', + help='increase the script output verbosity') + group.add_argument('-q', '--quiet', action='store_true', + help='only print errors and warning') + args = parser.parse_args() + + # Create the logger + logger = logging.getLogger('mingw') + handler = logging.StreamHandler() + formatter = logging.Formatter('%(message)s') + handler.setFormatter(formatter) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + if args.quiet: + logger.setLevel(logging.WARN) + if args.verbose: + logger.setLevel(logging.DEBUG) + + # Get MinGW + root_dir = root(location = args.location, arch = args.arch, + version = args.version, threading = args.threading, + exceptions = args.exceptions, revision = args.revision, + log = logger) + + sys.stdout.write('%s\n' % os.path.join(root_dir, 'bin')) + +if __name__ == '__main__': + try: + main() + except IOError as e: + sys.stderr.write('IO error: %s\n' % e) + sys.exit(1) + except OSError as e: + sys.stderr.write('OS error: %s\n' % e) + sys.exit(1) + except KeyboardInterrupt as e: + sys.stderr.write('Killed\n') + sys.exit(1) diff --git a/utils/google-benchmark/src/CMakeLists.txt b/utils/google-benchmark/src/CMakeLists.txt index 403887517797..7707773930c5 100644 --- a/utils/google-benchmark/src/CMakeLists.txt +++ b/utils/google-benchmark/src/CMakeLists.txt @@ -21,24 +21,55 @@ set_target_properties(benchmark PROPERTIES # Link threads. target_link_libraries(benchmark ${BENCHMARK_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +find_library(LIBRT rt) +if(LIBRT) + target_link_libraries(benchmark ${LIBRT}) +endif() # We need extra libraries on Windows if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(benchmark Shlwapi) endif() -# Expose public API -target_include_directories(benchmark PUBLIC ${PROJECT_SOURCE_DIR}/include) +set(include_install_dir "include") +set(lib_install_dir "lib/") +set(bin_install_dir "bin/") +set(config_install_dir "lib/cmake/${PROJECT_NAME}") + +set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") + +set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") +set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") +set(targets_export_name "${PROJECT_NAME}Targets") + +set(namespace "${PROJECT_NAME}::") + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${version_config}" VERSION ${GIT_VERSION} COMPATIBILITY SameMajorVersion +) + +configure_file("${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in" "${project_config}" @ONLY) # Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable) install( TARGETS benchmark - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - COMPONENT library) + EXPORT ${targets_export_name} + ARCHIVE DESTINATION ${lib_install_dir} + LIBRARY DESTINATION ${lib_install_dir} + RUNTIME DESTINATION ${bin_install_dir} + INCLUDES DESTINATION ${include_install_dir}) install( DIRECTORY "${PROJECT_SOURCE_DIR}/include/benchmark" - DESTINATION include + DESTINATION ${include_install_dir} FILES_MATCHING PATTERN "*.*h") + +install( + FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}") + +install( + EXPORT "${targets_export_name}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}") diff --git a/utils/google-benchmark/src/benchmark.cc b/utils/google-benchmark/src/benchmark.cc index 95f6a25b7563..00ffa07ff56e 100644 --- a/utils/google-benchmark/src/benchmark.cc +++ b/utils/google-benchmark/src/benchmark.cc @@ -37,6 +37,7 @@ #include "colorprint.h" #include "commandlineflags.h" #include "complexity.h" +#include "counter.h" #include "log.h" #include "mutex.h" #include "re.h" @@ -145,6 +146,7 @@ class ThreadManager { std::string report_label_; std::string error_message_; bool has_error_ = false; + UserCounters counters; }; GUARDED_BY(GetBenchmarkMutex()) Result results; @@ -249,6 +251,7 @@ BenchmarkReporter::Run CreateRunReport( report.complexity_n = results.complexity_n; report.complexity = b.complexity; report.complexity_lambda = b.complexity_lambda; + report.counters = results.counters; } return report; } @@ -272,6 +275,7 @@ void RunInThread(const benchmark::internal::Benchmark::Instance* b, results.bytes_processed += st.bytes_processed(); results.items_processed += st.items_processed(); results.complexity_n += st.complexity_length_n(); + internal::Increment(&results.counters, st.counters); } manager->NotifyThreadComplete(); } @@ -281,7 +285,8 @@ std::vector<BenchmarkReporter::Run> RunBenchmark( std::vector<BenchmarkReporter::Run>* complexity_reports) { std::vector<BenchmarkReporter::Run> reports; // return value - size_t iters = 1; + const bool has_explicit_iteration_count = b.iterations != 0; + size_t iters = has_explicit_iteration_count ? b.iterations : 1; std::unique_ptr<internal::ThreadManager> manager; std::vector<std::thread> pool(b.threads - 1); const int repeats = @@ -291,7 +296,7 @@ std::vector<BenchmarkReporter::Run> RunBenchmark( (b.report_mode == internal::RM_Unspecified ? FLAGS_benchmark_report_aggregates_only : b.report_mode == internal::RM_ReportAggregatesOnly); - for (int i = 0; i < repeats; i++) { + for (int repetition_num = 0; repetition_num < repeats; repetition_num++) { for (;;) { // Try benchmark VLOG(2) << "Running " << b.name << " for " << iters << "\n"; @@ -327,10 +332,20 @@ std::vector<BenchmarkReporter::Run> RunBenchmark( const double min_time = !IsZero(b.min_time) ? b.min_time : FLAGS_benchmark_min_time; - // If this was the first run, was elapsed time or cpu time large enough? - // If this is not the first run, go with the current value of iter. - if ((i > 0) || results.has_error_ || (iters >= kMaxIterations) || - (seconds >= min_time) || (results.real_time_used >= 5 * min_time)) { + + // Determine if this run should be reported; Either it has + // run for a sufficient amount of time or because an error was reported. + const bool should_report = repetition_num > 0 + || has_explicit_iteration_count // An exact iteration count was requested + || results.has_error_ + || iters >= kMaxIterations + || seconds >= min_time // the elapsed time is large enough + // CPU time is specified but the elapsed real time greatly exceeds the + // minimum time. Note that user provided timers are except from this + // sanity check. + || ((results.real_time_used >= 5 * min_time) && !b.use_manual_time); + + if (should_report) { BenchmarkReporter::Run report = CreateRunReport(b, results, iters, seconds); if (!report.error_occurred && b.complexity != oNone) @@ -386,6 +401,7 @@ State::State(size_t max_iters, const std::vector<int>& ranges, int thread_i, items_processed_(0), complexity_n_(0), error_occurred_(false), + counters(), thread_index(thread_i), threads(n_threads), max_iterations(max_iters), @@ -634,7 +650,7 @@ void ParseCommandLineFlags(int* argc, char** argv) { // TODO: Remove this. ParseStringFlag(argv[i], "color_print", &FLAGS_benchmark_color) || ParseInt32Flag(argv[i], "v", &FLAGS_v)) { - for (int j = i; j != *argc; ++j) argv[j] = argv[j + 1]; + for (int j = i; j != *argc - 1; ++j) argv[j] = argv[j + 1]; --(*argc); --i; @@ -664,4 +680,11 @@ void Initialize(int* argc, char** argv) { internal::LogLevel() = FLAGS_v; } +bool ReportUnrecognizedArguments(int argc, char** argv) { + for (int i = 1; i < argc; ++i) { + fprintf(stderr, "%s: error: unrecognized command-line flag: %s\n", argv[0], argv[i]); + } + return argc > 1; +} + } // end namespace benchmark diff --git a/utils/google-benchmark/src/benchmark_api_internal.h b/utils/google-benchmark/src/benchmark_api_internal.h index 8b97ce600873..828ed12165ff 100644 --- a/utils/google-benchmark/src/benchmark_api_internal.h +++ b/utils/google-benchmark/src/benchmark_api_internal.h @@ -24,9 +24,11 @@ struct Benchmark::Instance { bool use_manual_time; BigO complexity; BigOFunc* complexity_lambda; + UserCounters counters; bool last_benchmark_instance; int repetitions; double min_time; + size_t iterations; int threads; // Number of concurrent threads to us }; diff --git a/utils/google-benchmark/src/benchmark_register.cc b/utils/google-benchmark/src/benchmark_register.cc index 4e580d8ea383..fe373204189f 100644 --- a/utils/google-benchmark/src/benchmark_register.cc +++ b/utils/google-benchmark/src/benchmark_register.cc @@ -143,6 +143,7 @@ bool BenchmarkFamilies::FindBenchmarks( instance.time_unit = family->time_unit_; instance.range_multiplier = family->range_multiplier_; instance.min_time = family->min_time_; + instance.iterations = family->iterations_; instance.repetitions = family->repetitions_; instance.use_real_time = family->use_real_time_; instance.use_manual_time = family->use_manual_time_; @@ -163,16 +164,17 @@ bool BenchmarkFamilies::FindBenchmarks( } } - AppendHumanReadable(arg, &instance.name); + instance.name += std::to_string(arg); ++arg_i; } - if (!IsZero(family->min_time_)) { + if (!IsZero(family->min_time_)) instance.name += StringPrintF("/min_time:%0.3f", family->min_time_); - } - if (family->repetitions_ != 0) { + if (family->iterations_ != 0) + instance.name += StringPrintF("/iterations:%d", family->iterations_); + if (family->repetitions_ != 0) instance.name += StringPrintF("/repeats:%d", family->repetitions_); - } + if (family->use_manual_time_) { instance.name += "/manual_time"; } else if (family->use_real_time_) { @@ -219,6 +221,7 @@ Benchmark::Benchmark(const char* name) time_unit_(kNanosecond), range_multiplier_(kRangeMultiplier), min_time_(0), + iterations_(0), repetitions_(0), use_real_time_(false), use_manual_time_(false), @@ -344,6 +347,22 @@ Benchmark* Benchmark::RangeMultiplier(int multiplier) { return this; } + +Benchmark* Benchmark::MinTime(double t) { + CHECK(t > 0.0); + CHECK(iterations_ == 0); + min_time_ = t; + return this; +} + + +Benchmark* Benchmark::Iterations(size_t n) { + CHECK(n > 0); + CHECK(IsZero(min_time_)); + iterations_ = n; + return this; +} + Benchmark* Benchmark::Repetitions(int n) { CHECK(n > 0); repetitions_ = n; @@ -355,12 +374,6 @@ Benchmark* Benchmark::ReportAggregatesOnly(bool value) { return this; } -Benchmark* Benchmark::MinTime(double t) { - CHECK(t > 0.0); - min_time_ = t; - return this; -} - Benchmark* Benchmark::UseRealTime() { CHECK(!use_manual_time_) << "Cannot set UseRealTime and UseManualTime simultaneously."; diff --git a/utils/google-benchmark/src/complexity.cc b/utils/google-benchmark/src/complexity.cc index dfab791a3293..02adbef62926 100644 --- a/utils/google-benchmark/src/complexity.cc +++ b/utils/google-benchmark/src/complexity.cc @@ -171,6 +171,22 @@ std::vector<BenchmarkReporter::Run> ComputeStats( // All repetitions should be run with the same number of iterations so we // can take this information from the first benchmark. int64_t const run_iterations = reports.front().iterations; + // create stats for user counters + struct CounterStat { + Counter c; + Stat1_d s; + }; + std::map< std::string, CounterStat > counter_stats; + for(Run const& r : reports) { + for(auto const& cnt : r.counters) { + auto it = counter_stats.find(cnt.first); + if(it == counter_stats.end()) { + counter_stats.insert({cnt.first, {cnt.second, Stat1_d{}}}); + } else { + CHECK_EQ(counter_stats[cnt.first].c.flags, cnt.second.flags); + } + } + } // Populate the accumulators. for (Run const& run : reports) { @@ -183,6 +199,12 @@ std::vector<BenchmarkReporter::Run> ComputeStats( Stat1_d(run.cpu_accumulated_time / run.iterations, run.iterations); items_per_second_stat += Stat1_d(run.items_per_second, run.iterations); bytes_per_second_stat += Stat1_d(run.bytes_per_second, run.iterations); + // user counters + for(auto const& cnt : run.counters) { + auto it = counter_stats.find(cnt.first); + CHECK_NE(it, counter_stats.end()); + it->second.s += Stat1_d(cnt.second, run.iterations); + } } // Get the data from the accumulator to BenchmarkReporter::Run's. @@ -196,6 +218,11 @@ std::vector<BenchmarkReporter::Run> ComputeStats( mean_data.bytes_per_second = bytes_per_second_stat.Mean(); mean_data.items_per_second = items_per_second_stat.Mean(); mean_data.time_unit = reports[0].time_unit; + // user counters + for(auto const& kv : counter_stats) { + auto c = Counter(kv.second.s.Mean(), counter_stats[kv.first].c.flags); + mean_data.counters[kv.first] = c; + } // Only add label to mean/stddev if it is same for all runs mean_data.report_label = reports[0].report_label; @@ -215,6 +242,11 @@ std::vector<BenchmarkReporter::Run> ComputeStats( stddev_data.bytes_per_second = bytes_per_second_stat.StdDev(); stddev_data.items_per_second = items_per_second_stat.StdDev(); stddev_data.time_unit = reports[0].time_unit; + // user counters + for(auto const& kv : counter_stats) { + auto c = Counter(kv.second.s.StdDev(), counter_stats[kv.first].c.flags); + stddev_data.counters[kv.first] = c; + } results.push_back(mean_data); results.push_back(stddev_data); @@ -263,6 +295,11 @@ std::vector<BenchmarkReporter::Run> ComputeBigO( big_o.report_big_o = true; big_o.complexity = result_cpu.complexity; + // All the time results are reported after being multiplied by the + // time unit multiplier. But since RMS is a relative quantity it + // should not be multiplied at all. So, here, we _divide_ it by the + // multiplier so that when it is multiplied later the result is the + // correct one. double multiplier = GetTimeUnitMultiplier(reports[0].time_unit); // Only add label to mean/stddev if it is same for all runs @@ -275,6 +312,9 @@ std::vector<BenchmarkReporter::Run> ComputeBigO( rms.cpu_accumulated_time = result_cpu.rms / multiplier; rms.report_rms = true; rms.complexity = result_cpu.complexity; + // don't forget to keep the time unit, or we won't be able to + // recover the correct value. + rms.time_unit = reports[0].time_unit; results.push_back(big_o); results.push_back(rms); diff --git a/utils/google-benchmark/src/console_reporter.cc b/utils/google-benchmark/src/console_reporter.cc index 7e0cca3e3a0b..3f3de02945a3 100644 --- a/utils/google-benchmark/src/console_reporter.cc +++ b/utils/google-benchmark/src/console_reporter.cc @@ -14,6 +14,7 @@ #include "benchmark/reporter.h" #include "complexity.h" +#include "counter.h" #include <algorithm> #include <cstdint> @@ -34,6 +35,7 @@ namespace benchmark { bool ConsoleReporter::ReportContext(const Context& context) { name_field_width_ = context.name_field_width; + printed_header_ = false; PrintBasicContext(&GetErrorStream(), context); @@ -45,16 +47,32 @@ bool ConsoleReporter::ReportContext(const Context& context) { color_output_ = false; } #endif + + return true; +} + +void ConsoleReporter::PrintHeader(const Run& run) { std::string str = FormatString("%-*s %13s %13s %10s\n", static_cast<int>(name_field_width_), "Benchmark", "Time", "CPU", "Iterations"); - GetOutputStream() << str << std::string(str.length() - 1, '-') << "\n"; - - return true; + if(!run.counters.empty()) { + str += " UserCounters..."; + } + std::string line = std::string(str.length(), '-'); + GetOutputStream() << line << "\n" << str << line << "\n"; } void ConsoleReporter::ReportRuns(const std::vector<Run>& reports) { - for (const auto& run : reports) PrintRunData(run); + for (const auto& run : reports) { + // print the header if none was printed yet + if (!printed_header_) { + printed_header_ = true; + PrintHeader(run); + } + // As an alternative to printing the headers like this, we could sort + // the benchmarks by header and then print like that. + PrintRunData(run); + } } static void IgnoreColorPrint(std::ostream& out, LogColor, const char* fmt, @@ -114,6 +132,11 @@ void ConsoleReporter::PrintRunData(const Run& result) { printer(Out, COLOR_CYAN, "%10lld", result.iterations); } + for (auto& c : result.counters) { + auto const& s = HumanReadableNumber(c.second.value); + printer(Out, COLOR_DEFAULT, " %s=%s", c.first.c_str(), s.c_str()); + } + if (!rate.empty()) { printer(Out, COLOR_DEFAULT, " %*s", 13, rate.c_str()); } diff --git a/utils/google-benchmark/src/counter.cc b/utils/google-benchmark/src/counter.cc new file mode 100644 index 000000000000..307863d3c4d6 --- /dev/null +++ b/utils/google-benchmark/src/counter.cc @@ -0,0 +1,68 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "counter.h" + +namespace benchmark { +namespace internal { + +double Finish(Counter const& c, double cpu_time, double num_threads) { + double v = c.value; + if (c.flags & Counter::kIsRate) { + v /= cpu_time; + } + if (c.flags & Counter::kAvgThreads) { + v /= num_threads; + } + return v; +} + +void Finish(UserCounters *l, double cpu_time, double num_threads) { + for (auto &c : *l) { + c.second = Finish(c.second, cpu_time, num_threads); + } +} + +void Increment(UserCounters *l, UserCounters const& r) { + // add counters present in both or just in *l + for (auto &c : *l) { + auto it = r.find(c.first); + if (it != r.end()) { + c.second = c.second + it->second; + } + } + // add counters present in r, but not in *l + for (auto const &tc : r) { + auto it = l->find(tc.first); + if (it == l->end()) { + (*l)[tc.first] = tc.second; + } + } +} + +bool SameNames(UserCounters const& l, UserCounters const& r) { + if (&l == &r) return true; + if (l.size() != r.size()) { + return false; + } + for (auto const& c : l) { + if ( r.find(c.first) == r.end()) { + return false; + } + } + return true; +} + +} // end namespace internal +} // end namespace benchmark diff --git a/utils/google-benchmark/src/counter.h b/utils/google-benchmark/src/counter.h new file mode 100644 index 000000000000..bbb92d9a2983 --- /dev/null +++ b/utils/google-benchmark/src/counter.h @@ -0,0 +1,26 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/benchmark_api.h" + +namespace benchmark { + +// these counter-related functions are hidden to reduce API surface. +namespace internal { +void Finish(UserCounters *l, double time, double num_threads); +void Increment(UserCounters *l, UserCounters const& r); +bool SameNames(UserCounters const& l, UserCounters const& r); +} // end namespace internal + +} //end namespace benchmark diff --git a/utils/google-benchmark/src/csv_reporter.cc b/utils/google-benchmark/src/csv_reporter.cc index 18ab3b668951..6779815b3c37 100644 --- a/utils/google-benchmark/src/csv_reporter.cc +++ b/utils/google-benchmark/src/csv_reporter.cc @@ -24,6 +24,7 @@ #include "string_util.h" #include "timers.h" +#include "check.h" // File format reference: http://edoceo.com/utilitas/csv-file-format. @@ -38,21 +39,51 @@ std::vector<std::string> elements = { bool CSVReporter::ReportContext(const Context& context) { PrintBasicContext(&GetErrorStream(), context); + return true; +} +void CSVReporter::ReportRuns(const std::vector<Run> & reports) { std::ostream& Out = GetOutputStream(); - for (auto B = elements.begin(); B != elements.end();) { - Out << *B++; - if (B != elements.end()) Out << ","; + + if (!printed_header_) { + // save the names of all the user counters + for (const auto& run : reports) { + for (const auto& cnt : run.counters) { + user_counter_names_.insert(cnt.first); + } + } + + // print the header + for (auto B = elements.begin(); B != elements.end();) { + Out << *B++; + if (B != elements.end()) Out << ","; + } + for (auto B = user_counter_names_.begin(); B != user_counter_names_.end();) { + Out << ",\"" << *B++ << "\""; + } + Out << "\n"; + + printed_header_ = true; + } else { + // check that all the current counters are saved in the name set + for (const auto& run : reports) { + for (const auto& cnt : run.counters) { + CHECK(user_counter_names_.find(cnt.first) != user_counter_names_.end()) + << "All counters must be present in each run. " + << "Counter named \"" << cnt.first + << "\" was not in a run after being added to the header"; + } + } + } + + // print results for each run + for (const auto& run : reports) { + PrintRunData(run); } - Out << "\n"; - return true; -} -void CSVReporter::ReportRuns(const std::vector<Run>& reports) { - for (const auto& run : reports) PrintRunData(run); } -void CSVReporter::PrintRunData(const Run& run) { +void CSVReporter::PrintRunData(const Run & run) { std::ostream& Out = GetOutputStream(); // Field with embedded double-quote characters must be doubled and the field @@ -102,6 +133,13 @@ void CSVReporter::PrintRunData(const Run& run) { Out << "\"" << label << "\""; } Out << ",,"; // for error_occurred and error_message + + // Print user counters + for (const auto &ucn : user_counter_names_) { + auto it = run.counters.find(ucn); + CHECK(it != run.counters.end()); + Out << "," << it->second; + } Out << '\n'; } diff --git a/utils/google-benchmark/src/cycleclock.h b/utils/google-benchmark/src/cycleclock.h index e4825d4ba244..e0f9b01f9d39 100644 --- a/utils/google-benchmark/src/cycleclock.h +++ b/utils/google-benchmark/src/cycleclock.h @@ -43,6 +43,11 @@ extern "C" uint64_t __rdtsc(); #ifndef BENCHMARK_OS_WINDOWS #include <sys/time.h> +#include <time.h> +#endif + +#ifdef BENCHMARK_OS_EMSCRIPTEN +#include <emscripten.h> #endif namespace benchmark { @@ -65,6 +70,10 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { // counter pauses; it does not continue counting, nor does it // reset to zero. return mach_absolute_time(); +#elif defined(BENCHMARK_OS_EMSCRIPTEN) + // this goes above x86-specific code because old versions of Emscripten + // define __x86_64__, although they have nothing to do with it. + return static_cast<int64_t>(emscripten_get_now() * 1e+6); #elif defined(__i386__) int64_t ret; __asm__ volatile("rdtsc" : "=A"(ret)); @@ -79,7 +88,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { asm("mftbu %0" : "=r"(tbu0)); asm("mftb %0" : "=r"(tbl)); asm("mftbu %0" : "=r"(tbu1)); - tbl &= -static_cast<int64>(tbu0 == tbu1); + tbl &= -static_cast<int64_t>(tbu0 == tbu1); // high 32 bits in tbu1; low 32 bits in tbl (tbu0 is garbage) return (tbu1 << 32) | tbl; #elif defined(__sparc__) @@ -99,6 +108,22 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { _asm rdtsc #elif defined(COMPILER_MSVC) return __rdtsc(); +#elif defined(BENCHMARK_OS_NACL) + // Native Client validator on x86/x86-64 allows RDTSC instructions, + // and this case is handled above. Native Client validator on ARM + // rejects MRC instructions (used in the ARM-specific sequence below), + // so we handle it here. Portable Native Client compiles to + // architecture-agnostic bytecode, which doesn't provide any + // cycle counter access mnemonics. + + // Native Client does not provide any API to access cycle counter. + // Use clock_gettime(CLOCK_MONOTONIC, ...) instead of gettimeofday + // because is provides nanosecond resolution (which is noticable at + // least for PNaCl modules running on x86 Mac & Linux). + // Initialize to always return 0 if clock_gettime fails. + struct timespec ts = { 0, 0 }; + clock_gettime(CLOCK_MONOTONIC, &ts); + return static_cast<int64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec; #elif defined(__aarch64__) // System timer of ARMv8 runs at a different frequency than the CPU's. // The frequency is fixed, typically in the range 1-50MHz. It can be @@ -108,7 +133,9 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value)); return virtual_timer_value; #elif defined(__ARM_ARCH) -#if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount + // V6 is the earliest arch that has a standard cyclecount + // Native Client validator doesn't allow MRC instructions. +#if (__ARM_ARCH >= 6) uint32_t pmccntr; uint32_t pmuseren; uint32_t pmcntenset; diff --git a/utils/google-benchmark/src/internal_macros.h b/utils/google-benchmark/src/internal_macros.h index e8efcbb39c18..ab9dd85c1023 100644 --- a/utils/google-benchmark/src/internal_macros.h +++ b/utils/google-benchmark/src/internal_macros.h @@ -30,13 +30,26 @@ #elif defined(_WIN32) #define BENCHMARK_OS_WINDOWS 1 #elif defined(__APPLE__) -// TODO(ericwf) This doesn't actually check that it is a Mac OSX system. Just -// that it is an apple system. -#define BENCHMARK_OS_MACOSX 1 +#include "TargetConditionals.h" + #if defined(TARGET_OS_MAC) + #define BENCHMARK_OS_MACOSX 1 + #if defined(TARGET_OS_IPHONE) + #define BENCHMARK_OS_IOS 1 + #endif + #endif #elif defined(__FreeBSD__) #define BENCHMARK_OS_FREEBSD 1 #elif defined(__linux__) #define BENCHMARK_OS_LINUX 1 +#elif defined(__native_client__) +#define BENCHMARK_OS_NACL 1 +#elif defined(EMSCRIPTEN) +#define BENCHMARK_OS_EMSCRIPTEN 1 +#endif + +#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \ + && !defined(__EXCEPTIONS) +#define BENCHMARK_HAS_NO_EXCEPTIONS #endif #endif // BENCHMARK_INTERNAL_MACROS_H_ diff --git a/utils/google-benchmark/src/json_reporter.cc b/utils/google-benchmark/src/json_reporter.cc index cea5f9bfa1c9..5a653088e5bf 100644 --- a/utils/google-benchmark/src/json_reporter.cc +++ b/utils/google-benchmark/src/json_reporter.cc @@ -154,10 +154,15 @@ void JSONReporter::PrintRunData(Run const& run) { << indent << FormatKV("items_per_second", RoundDouble(run.items_per_second)); } + for(auto &c : run.counters) { + out << ",\n" + << indent + << FormatKV(c.first, RoundDouble(c.second)); + } if (!run.report_label.empty()) { out << ",\n" << indent << FormatKV("label", run.report_label); } out << '\n'; } -} // end namespace benchmark +} // end namespace benchmark diff --git a/utils/google-benchmark/src/re.h b/utils/google-benchmark/src/re.h index af4a498c9f7a..01e9736505e5 100644 --- a/utils/google-benchmark/src/re.h +++ b/utils/google-benchmark/src/re.h @@ -15,6 +15,15 @@ #ifndef BENCHMARK_RE_H_ #define BENCHMARK_RE_H_ +#include "internal_macros.h" + +// Prefer C regex libraries when compiling w/o exceptions so that we can +// correctly report errors. +#if defined(BENCHMARK_HAS_NO_EXCEPTIONS) && defined(HAVE_STD_REGEX) && \ + (defined(HAVE_GNU_POSIX_REGEX) || defined(HAVE_POSIX_REGEX)) +#undef HAVE_STD_REGEX +#endif + #if defined(HAVE_STD_REGEX) #include <regex> #elif defined(HAVE_GNU_POSIX_REGEX) @@ -62,15 +71,20 @@ class Regex { #if defined(HAVE_STD_REGEX) inline bool Regex::Init(const std::string& spec, std::string* error) { +#ifdef BENCHMARK_HAS_NO_EXCEPTIONS + ((void)error); // suppress unused warning +#else try { +#endif re_ = std::regex(spec, std::regex_constants::extended); - init_ = true; +#ifndef BENCHMARK_HAS_NO_EXCEPTIONS } catch (const std::regex_error& e) { if (error) { *error = e.what(); } } +#endif return init_; } diff --git a/utils/google-benchmark/src/sleep.cc b/utils/google-benchmark/src/sleep.cc index 918abc485dc3..54aa04a42247 100644 --- a/utils/google-benchmark/src/sleep.cc +++ b/utils/google-benchmark/src/sleep.cc @@ -15,6 +15,7 @@ #include "sleep.h" #include <cerrno> +#include <cstdlib> #include <ctime> #include "internal_macros.h" @@ -40,7 +41,7 @@ void SleepForMicroseconds(int microseconds) { } void SleepForMilliseconds(int milliseconds) { - SleepForMicroseconds(static_cast<int>(milliseconds) * kNumMicrosPerMilli); + SleepForMicroseconds(milliseconds * kNumMicrosPerMilli); } void SleepForSeconds(double seconds) { diff --git a/utils/google-benchmark/src/sleep.h b/utils/google-benchmark/src/sleep.h index f1e515ca4f3a..f98551afe284 100644 --- a/utils/google-benchmark/src/sleep.h +++ b/utils/google-benchmark/src/sleep.h @@ -1,14 +1,12 @@ #ifndef BENCHMARK_SLEEP_H_ #define BENCHMARK_SLEEP_H_ -#include <cstdint> - namespace benchmark { -const int64_t kNumMillisPerSecond = 1000LL; -const int64_t kNumMicrosPerMilli = 1000LL; -const int64_t kNumMicrosPerSecond = kNumMillisPerSecond * 1000LL; -const int64_t kNumNanosPerMicro = 1000LL; -const int64_t kNumNanosPerSecond = kNumNanosPerMicro * kNumMicrosPerSecond; +const int kNumMillisPerSecond = 1000; +const int kNumMicrosPerMilli = 1000; +const int kNumMicrosPerSecond = kNumMillisPerSecond * 1000; +const int kNumNanosPerMicro = 1000; +const int kNumNanosPerSecond = kNumNanosPerMicro * kNumMicrosPerSecond; void SleepForMilliseconds(int milliseconds); void SleepForSeconds(double seconds); diff --git a/utils/google-benchmark/src/string_util.cc b/utils/google-benchmark/src/string_util.cc index 4cefbfba6c27..cd4e7cfde57c 100644 --- a/utils/google-benchmark/src/string_util.cc +++ b/utils/google-benchmark/src/string_util.cc @@ -45,6 +45,8 @@ void ToExponentAndMantissa(double val, double thresh, int precision, std::max(thresh, 1.0 / std::pow(10.0, precision)); const double big_threshold = adjusted_threshold * one_k; const double small_threshold = adjusted_threshold; + // Values in ]simple_threshold,small_threshold[ will be printed as-is + const double simple_threshold = 0.01; if (val > big_threshold) { // Positive powers @@ -62,14 +64,16 @@ void ToExponentAndMantissa(double val, double thresh, int precision, *exponent = 0; } else if (val < small_threshold) { // Negative powers - double scaled = val; - for (size_t i = 0; i < arraysize(kSmallSIUnits); ++i) { - scaled *= one_k; - if (scaled >= small_threshold) { - mantissa_stream << scaled; - *exponent = -static_cast<int64_t>(i + 1); - *mantissa = mantissa_stream.str(); - return; + if (val < simple_threshold) { + double scaled = val; + for (size_t i = 0; i < arraysize(kSmallSIUnits); ++i) { + scaled *= one_k; + if (scaled >= small_threshold) { + mantissa_stream << scaled; + *exponent = -static_cast<int64_t>(i + 1); + *mantissa = mantissa_stream.str(); + return; + } } } mantissa_stream << val; diff --git a/utils/google-benchmark/src/sysinfo.cc b/utils/google-benchmark/src/sysinfo.cc index dd1e66306e18..7feb79e65f20 100644 --- a/utils/google-benchmark/src/sysinfo.cc +++ b/utils/google-benchmark/src/sysinfo.cc @@ -75,7 +75,9 @@ bool ReadIntFromFile(const char* file, long* value) { char line[1024]; char* err; memset(line, '\0', sizeof(line)); - CHECK(read(fd, line, sizeof(line) - 1)); + ssize_t read_err = read(fd, line, sizeof(line) - 1); + ((void)read_err); // prevent unused warning + CHECK(read_err >= 0); const long temp_value = strtol(line, &err, 10); if (line[0] != '\0' && (*err == '\n' || *err == '\0')) { *value = temp_value; @@ -295,8 +297,13 @@ void InitializeSystemInfo() { (size == sizeof(cpu_freq))) { cpuinfo_cycles_per_second = cpu_freq; } else { + #if defined BENCHMARK_OS_IOS + fprintf(stderr, "CPU frequency cannot be detected. \n"); + cpuinfo_cycles_per_second = 0; + #else fprintf(stderr, "%s\n", strerror(errno)); std::exit(EXIT_FAILURE); + #endif } #else // Generic cycles per second counter diff --git a/utils/google-benchmark/src/timers.cc b/utils/google-benchmark/src/timers.cc index fadc08f791e7..8d56e8adf8d4 100644 --- a/utils/google-benchmark/src/timers.cc +++ b/utils/google-benchmark/src/timers.cc @@ -35,6 +35,10 @@ #endif #endif +#ifdef BENCHMARK_OS_EMSCRIPTEN +#include <emscripten.h> +#endif + #include <cerrno> #include <cstdint> #include <cstdio> @@ -100,14 +104,7 @@ BENCHMARK_NORETURN static void DiagnoseAndExit(const char* msg) { } // end namespace double ProcessCPUUsage() { -// FIXME We want to use clock_gettime, but its not available in MacOS 10.11. See -// https://github.com/google/benchmark/pull/292 -#if defined(CLOCK_PROCESS_CPUTIME_ID) && !defined(BENCHMARK_OS_MACOSX) - struct timespec spec; - if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0) - return MakeTime(spec); - DiagnoseAndExit("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) failed"); -#elif defined(BENCHMARK_OS_WINDOWS) +#if defined(BENCHMARK_OS_WINDOWS) HANDLE proc = GetCurrentProcess(); FILETIME creation_time; FILETIME exit_time; @@ -117,21 +114,28 @@ double ProcessCPUUsage() { &user_time)) return MakeTime(kernel_time, user_time); DiagnoseAndExit("GetProccessTimes() failed"); +#elif defined(BENCHMARK_OS_EMSCRIPTEN) + // clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) returns 0 on Emscripten. + // Use Emscripten-specific API. Reported CPU time would be exactly the + // same as total time, but this is ok because there aren't long-latency + // syncronous system calls in Emscripten. + return emscripten_get_now() * 1e-3; +#elif defined(CLOCK_PROCESS_CPUTIME_ID) && !defined(BENCHMARK_OS_MACOSX) + // FIXME We want to use clock_gettime, but its not available in MacOS 10.11. See + // https://github.com/google/benchmark/pull/292 + struct timespec spec; + if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0) + return MakeTime(spec); + DiagnoseAndExit("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) failed"); #else struct rusage ru; if (getrusage(RUSAGE_SELF, &ru) == 0) return MakeTime(ru); - DiagnoseAndExit("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) failed"); + DiagnoseAndExit("getrusage(RUSAGE_SELF, ...) failed"); #endif } double ThreadCPUUsage() { -// FIXME We want to use clock_gettime, but its not available in MacOS 10.11. See -// https://github.com/google/benchmark/pull/292 -#if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BENCHMARK_OS_MACOSX) - struct timespec ts; - if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) == 0) return MakeTime(ts); - DiagnoseAndExit("clock_gettime(CLOCK_THREAD_CPUTIME_ID, ...) failed"); -#elif defined(BENCHMARK_OS_WINDOWS) +#if defined(BENCHMARK_OS_WINDOWS) HANDLE this_thread = GetCurrentThread(); FILETIME creation_time; FILETIME exit_time; @@ -141,6 +145,8 @@ double ThreadCPUUsage() { &user_time); return MakeTime(kernel_time, user_time); #elif defined(BENCHMARK_OS_MACOSX) + // FIXME We want to use clock_gettime, but its not available in MacOS 10.11. See + // https://github.com/google/benchmark/pull/292 mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT; thread_basic_info_data_t info; mach_port_t thread = pthread_mach_thread_np(pthread_self()); @@ -149,6 +155,13 @@ double ThreadCPUUsage() { return MakeTime(info); } DiagnoseAndExit("ThreadCPUUsage() failed when evaluating thread_info"); +#elif defined(BENCHMARK_OS_EMSCRIPTEN) + // Emscripten doesn't support traditional threads + return ProcessCPUUsage(); +#elif defined(CLOCK_THREAD_CPUTIME_ID) + struct timespec ts; + if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) == 0) return MakeTime(ts); + DiagnoseAndExit("clock_gettime(CLOCK_THREAD_CPUTIME_ID, ...) failed"); #else #error Per-thread timing is not available on your system. #endif diff --git a/utils/google-benchmark/test/CMakeLists.txt b/utils/google-benchmark/test/CMakeLists.txt index 87245984dd4c..14ba7a6e2da7 100644 --- a/utils/google-benchmark/test/CMakeLists.txt +++ b/utils/google-benchmark/test/CMakeLists.txt @@ -2,6 +2,25 @@ find_package(Threads REQUIRED) +# NOTE: Some tests use `<cassert>` to perform the test. Therefore we must +# strip -DNDEBUG from the default CMake flags in DEBUG mode. +string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) +if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) + add_definitions( -UNDEBUG ) + add_definitions(-DTEST_BENCHMARK_LIBRARY_HAS_NO_ASSERTIONS) + # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines. + foreach (flags_var_to_scrub + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_MINSIZEREL) + string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " + "${flags_var_to_scrub}" "${${flags_var_to_scrub}}") + endforeach() +endif() + # NOTE: These flags must be added after find_package(Threads REQUIRED) otherwise # they will break the configuration check. if (DEFINED BENCHMARK_CXX_LINKER_FLAGS) diff --git a/utils/google-benchmark/test/benchmark_test.cc b/utils/google-benchmark/test/benchmark_test.cc index d832f81ae433..57731331e6d0 100644 --- a/utils/google-benchmark/test/benchmark_test.cc +++ b/utils/google-benchmark/test/benchmark_test.cc @@ -150,7 +150,7 @@ static void BM_LongTest(benchmark::State& state) { BENCHMARK(BM_LongTest)->Range(1 << 16, 1 << 28); static void BM_ParallelMemset(benchmark::State& state) { - int size = state.range(0) / sizeof(int); + int size = state.range(0) / static_cast<int>(sizeof(int)); int thread_size = size / state.threads; int from = thread_size * state.thread_index; int to = from + thread_size; @@ -209,10 +209,26 @@ BENCHMARK_CAPTURE(BM_with_args, string_and_pair_test, std::string("abc"), std::pair<int, double>(42, 3.8)); void BM_non_template_args(benchmark::State& state, int, double) { + while(state.KeepRunning()) {} +} +BENCHMARK_CAPTURE(BM_non_template_args, basic_test, 0, 0); + +static void BM_UserCounter(benchmark::State& state) { + static const int depth = 1024; while (state.KeepRunning()) { + benchmark::DoNotOptimize(CalculatePi(depth)); } + state.counters["Foo"] = 1; + state.counters["Bar"] = 2; + state.counters["Baz"] = 3; + state.counters["Bat"] = 5; +#ifdef BENCHMARK_HAS_CXX11 + state.counters.insert({{"Foo", 2}, {"Bar", 3}, {"Baz", 5}, {"Bat", 6}}); +#endif } -BENCHMARK_CAPTURE(BM_non_template_args, basic_test, 0, 0); +BENCHMARK(BM_UserCounter)->Threads(8); +BENCHMARK(BM_UserCounter)->ThreadRange(1, 32); +BENCHMARK(BM_UserCounter)->ThreadPerCpu(); #endif // __cplusplus >= 201103L diff --git a/utils/google-benchmark/test/cxx03_test.cc b/utils/google-benchmark/test/cxx03_test.cc index 4f3d0fb6f49c..a79d964e17bd 100644 --- a/utils/google-benchmark/test/cxx03_test.cc +++ b/utils/google-benchmark/test/cxx03_test.cc @@ -39,4 +39,10 @@ void BM_template1(benchmark::State& state) { BENCHMARK_TEMPLATE(BM_template1, long); BENCHMARK_TEMPLATE1(BM_template1, int); +void BM_counters(benchmark::State& state) { + BM_empty(state); + state.counters["Foo"] = 2; +} +BENCHMARK(BM_counters); + BENCHMARK_MAIN() diff --git a/utils/google-benchmark/test/diagnostics_test.cc b/utils/google-benchmark/test/diagnostics_test.cc index c6c235d0c265..1046730b0fc1 100644 --- a/utils/google-benchmark/test/diagnostics_test.cc +++ b/utils/google-benchmark/test/diagnostics_test.cc @@ -26,7 +26,7 @@ void TestHandler() { } void try_invalid_pause_resume(benchmark::State& state) { -#if !defined(NDEBUG) && !defined(TEST_HAS_NO_EXCEPTIONS) +#if !defined(TEST_BENCHMARK_LIBRARY_HAS_NO_ASSERTIONS) && !defined(TEST_HAS_NO_EXCEPTIONS) try { state.PauseTiming(); std::abort(); diff --git a/utils/google-benchmark/test/options_test.cc b/utils/google-benchmark/test/options_test.cc index bedb1cc3ee99..bbbed2883988 100644 --- a/utils/google-benchmark/test/options_test.cc +++ b/utils/google-benchmark/test/options_test.cc @@ -1,8 +1,12 @@ #include "benchmark/benchmark_api.h" - #include <chrono> #include <thread> +#if defined(NDEBUG) +#undef NDEBUG +#endif +#include <cassert> + void BM_basic(benchmark::State& state) { while (state.KeepRunning()) { } @@ -40,4 +44,22 @@ void CustomArgs(benchmark::internal::Benchmark* b) { BENCHMARK(BM_basic)->Apply(CustomArgs); +void BM_explicit_iteration_count(benchmark::State& st) { + // Test that benchmarks specified with an explicit iteration count are + // only run once. + static bool invoked_before = false; + assert(!invoked_before); + invoked_before = true; + + // Test that the requested iteration count is respected. + assert(st.max_iterations == 42); + size_t actual_iterations = 0; + while (st.KeepRunning()) + ++actual_iterations; + assert(st.iterations() == st.max_iterations); + assert(st.iterations() == 42); + +} +BENCHMARK(BM_explicit_iteration_count)->Iterations(42); + BENCHMARK_MAIN() diff --git a/utils/google-benchmark/test/output_test_helper.cc b/utils/google-benchmark/test/output_test_helper.cc index 721d39f92706..54c028a67ba3 100644 --- a/utils/google-benchmark/test/output_test_helper.cc +++ b/utils/google-benchmark/test/output_test_helper.cc @@ -31,7 +31,7 @@ TestCaseList& GetTestCaseList(TestCaseID ID) { SubMap& GetSubstitutions() { // Don't use 'dec_re' from header because it may not yet be initialized. - static std::string dec_re = "[0-9]*[.]?[0-9]+([eE][-+][0-9]+)?"; + static std::string safe_dec_re = "[0-9]*[.]?[0-9]+([eE][-+][0-9]+)?"; static SubMap map = { {"%float", "[0-9]*[.]?[0-9]+([eE][-+][0-9]+)?"}, {"%int", "[ ]*[0-9]+"}, @@ -39,13 +39,13 @@ SubMap& GetSubstitutions() { {"%time", "[ ]*[0-9]{1,5} ns"}, {"%console_report", "[ ]*[0-9]{1,5} ns [ ]*[0-9]{1,5} ns [ ]*[0-9]+"}, {"%console_us_report", "[ ]*[0-9] us [ ]*[0-9] us [ ]*[0-9]+"}, - {"%csv_report", "[0-9]+," + dec_re + "," + dec_re + ",ns,,,,,"}, - {"%csv_us_report", "[0-9]+," + dec_re + "," + dec_re + ",us,,,,,"}, + {"%csv_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns,,,,,"}, + {"%csv_us_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",us,,,,,"}, {"%csv_bytes_report", - "[0-9]+," + dec_re + "," + dec_re + ",ns," + dec_re + ",,,,"}, + "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns," + safe_dec_re + ",,,,"}, {"%csv_items_report", - "[0-9]+," + dec_re + "," + dec_re + ",ns,," + dec_re + ",,,"}, - {"%csv_label_report_begin", "[0-9]+," + dec_re + "," + dec_re + ",ns,,,"}, + "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns,," + safe_dec_re + ",,,"}, + {"%csv_label_report_begin", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns,,,"}, {"%csv_label_report_end", ",,"}}; return map; } diff --git a/utils/google-benchmark/test/reporter_output_test.cc b/utils/google-benchmark/test/reporter_output_test.cc index 2e6d2b2a0e0f..cb52aec0c082 100644 --- a/utils/google-benchmark/test/reporter_output_test.cc +++ b/utils/google-benchmark/test/reporter_output_test.cc @@ -9,8 +9,10 @@ // ---------------------- Testing Prologue Output -------------------------- // // ========================================================================= // -ADD_CASES(TC_ConsoleOut, {{"^Benchmark %s Time %s CPU %s Iterations$", MR_Next}, - {"^[-]+$", MR_Next}}); +ADD_CASES(TC_ConsoleOut, + {{"^[-]+$", MR_Next}, + {"^Benchmark %s Time %s CPU %s Iterations$", MR_Next}, + {"^[-]+$", MR_Next}}); ADD_CASES(TC_CSVOut, {{"name,iterations,real_time,cpu_time,time_unit,bytes_per_second," "items_per_second,label,error_occurred,error_message"}}); diff --git a/utils/google-benchmark/tools/compare_bench.py b/utils/google-benchmark/tools/compare_bench.py index ed0f133e0dc9..d54baaa0e8f8 100644 --- a/utils/google-benchmark/tools/compare_bench.py +++ b/utils/google-benchmark/tools/compare_bench.py @@ -3,25 +3,63 @@ compare_bench.py - Compare two benchmarks or their results and report the difference. """ +import argparse +from argparse import ArgumentParser import sys import gbench from gbench import util, report +from gbench.util import * + +def check_inputs(in1, in2, flags): + """ + Perform checking on the user provided inputs and diagnose any abnormalities + """ + in1_kind, in1_err = classify_input_file(in1) + in2_kind, in2_err = classify_input_file(in2) + output_file = find_benchmark_flag('--benchmark_out=', flags) + output_type = find_benchmark_flag('--benchmark_out_format=', flags) + if in1_kind == IT_Executable and in2_kind == IT_Executable and output_file: + print(("WARNING: '--benchmark_out=%s' will be passed to both " + "benchmarks causing it to be overwritten") % output_file) + if in1_kind == IT_JSON and in2_kind == IT_JSON and len(flags) > 0: + print("WARNING: passing --benchmark flags has no effect since both " + "inputs are JSON") + if output_type is not None and output_type != 'json': + print(("ERROR: passing '--benchmark_out_format=%s' to 'compare_bench.py`" + " is not supported.") % output_type) + sys.exit(1) + def main(): + parser = ArgumentParser( + description='compare the results of two benchmarks') + parser.add_argument( + 'test1', metavar='test1', type=str, nargs=1, + help='A benchmark executable or JSON output file') + parser.add_argument( + 'test2', metavar='test2', type=str, nargs=1, + help='A benchmark executable or JSON output file') + # FIXME this is a dummy argument which will never actually match + # any --benchmark flags but it helps generate a better usage message + parser.add_argument( + 'benchmark_options', metavar='benchmark_option', nargs='*', + help='Arguments to pass when running benchmark executables' + ) + args, unknown_args = parser.parse_known_args() # Parse the command line flags - def usage(): - print('compare_bench.py <test1> <test2> [benchmark options]...') + test1 = args.test1[0] + test2 = args.test2[0] + if args.benchmark_options: + print("Unrecognized positional argument arguments: '%s'" + % args.benchmark_options) exit(1) - if '--help' in sys.argv or len(sys.argv) < 3: - usage() - tests = sys.argv[1:3] - bench_opts = sys.argv[3:] - bench_opts = list(bench_opts) + benchmark_options = unknown_args + check_inputs(test1, test2, benchmark_options) # Run the benchmarks and report the results - json1 = gbench.util.run_or_load_benchmark(tests[0], bench_opts) - json2 = gbench.util.run_or_load_benchmark(tests[1], bench_opts) + json1 = gbench.util.run_or_load_benchmark(test1, benchmark_options) + json2 = gbench.util.run_or_load_benchmark(test2, benchmark_options) output_lines = gbench.report.generate_difference_report(json1, json2) - print 'Comparing %s to %s' % (tests[0], tests[1]) + print('Comparing %s to %s' % (test1, test2)) for ln in output_lines: print(ln) diff --git a/utils/google-benchmark/tools/gbench/Inputs/test1_run1.json b/utils/google-benchmark/tools/gbench/Inputs/test1_run1.json index da9425e466c5..37faed46d134 100644 --- a/utils/google-benchmark/tools/gbench/Inputs/test1_run1.json +++ b/utils/google-benchmark/tools/gbench/Inputs/test1_run1.json @@ -41,6 +41,20 @@ "real_time": 100, "cpu_time": 100, "time_unit": "ns" + }, + { + "name": "BM_100xSlower", + "iterations": 1000, + "real_time": 100, + "cpu_time": 100, + "time_unit": "ns" + }, + { + "name": "BM_100xFaster", + "iterations": 1000, + "real_time": 10000, + "cpu_time": 10000, + "time_unit": "ns" } ] }
\ No newline at end of file diff --git a/utils/google-benchmark/tools/gbench/Inputs/test1_run2.json b/utils/google-benchmark/tools/gbench/Inputs/test1_run2.json index d8bc72d29564..aed5151d3921 100644 --- a/utils/google-benchmark/tools/gbench/Inputs/test1_run2.json +++ b/utils/google-benchmark/tools/gbench/Inputs/test1_run2.json @@ -41,6 +41,20 @@ "real_time": 110, "cpu_time": 110, "time_unit": "ns" + }, + { + "name": "BM_100xSlower", + "iterations": 1000, + "real_time": 10000, + "cpu_time": 10000, + "time_unit": "ns" + }, + { + "name": "BM_100xFaster", + "iterations": 1000, + "real_time": 100, + "cpu_time": 100, + "time_unit": "ns" } ] }
\ No newline at end of file diff --git a/utils/google-benchmark/tools/gbench/report.py b/utils/google-benchmark/tools/gbench/report.py index ac69b9bef664..8f1b0fa8604e 100644 --- a/utils/google-benchmark/tools/gbench/report.py +++ b/utils/google-benchmark/tools/gbench/report.py @@ -92,7 +92,7 @@ def generate_difference_report(json1, json2, use_color=True): return BC_WHITE else: return BC_CYAN - fmt_str = "{}{:<{}s}{endc} {}{:+.2f}{endc} {}{:+.2f}{endc} {:4d} {:4d}" + fmt_str = "{}{:<{}s}{endc}{}{:+9.2f}{endc}{}{:+14.2f}{endc}{:14d}{:14d}" tres = calculate_change(bn['real_time'], other_bench['real_time']) cpures = calculate_change(bn['cpu_time'], other_bench['cpu_time']) output_strs += [color_format(use_color, fmt_str, @@ -121,19 +121,22 @@ class TestReportDifference(unittest.TestCase): def test_basic(self): expect_lines = [ - ['BM_SameTimes', '+0.00', '+0.00'], - ['BM_2xFaster', '-0.50', '-0.50'], - ['BM_2xSlower', '+1.00', '+1.00'], - ['BM_10PercentFaster', '-0.10', '-0.10'], - ['BM_10PercentSlower', '+0.10', '+0.10'] + ['BM_SameTimes', '+0.00', '+0.00', '10', '10'], + ['BM_2xFaster', '-0.50', '-0.50', '50', '25'], + ['BM_2xSlower', '+1.00', '+1.00', '50', '100'], + ['BM_10PercentFaster', '-0.10', '-0.10', '100', '90'], + ['BM_10PercentSlower', '+0.10', '+0.10', '100', '110'], + ['BM_100xSlower', '+99.00', '+99.00', '100', '10000'], + ['BM_100xFaster', '-0.99', '-0.99', '10000', '100'], ] json1, json2 = self.load_results() - output_lines = generate_difference_report(json1, json2, use_color=False) - print output_lines + output_lines_with_header = generate_difference_report(json1, json2, use_color=False) + output_lines = output_lines_with_header[2:] + print("\n".join(output_lines_with_header)) self.assertEqual(len(output_lines), len(expect_lines)) for i in xrange(0, len(output_lines)): parts = [x for x in output_lines[i].split(' ') if x] - self.assertEqual(len(parts), 3) + self.assertEqual(len(parts), 5) self.assertEqual(parts, expect_lines[i]) diff --git a/utils/google-benchmark/tools/gbench/util.py b/utils/google-benchmark/tools/gbench/util.py index 169b71c2c315..07c237727549 100644 --- a/utils/google-benchmark/tools/gbench/util.py +++ b/utils/google-benchmark/tools/gbench/util.py @@ -20,21 +20,21 @@ def is_executable_file(filename): """ if not os.path.isfile(filename): return False - with open(filename, 'r') as f: + with open(filename, mode='rb') as f: magic_bytes = f.read(_num_magic_bytes) if sys.platform == 'darwin': return magic_bytes in [ - '\xfe\xed\xfa\xce', # MH_MAGIC - '\xce\xfa\xed\xfe', # MH_CIGAM - '\xfe\xed\xfa\xcf', # MH_MAGIC_64 - '\xcf\xfa\xed\xfe', # MH_CIGAM_64 - '\xca\xfe\xba\xbe', # FAT_MAGIC - '\xbe\xba\xfe\xca' # FAT_CIGAM + b'\xfe\xed\xfa\xce', # MH_MAGIC + b'\xce\xfa\xed\xfe', # MH_CIGAM + b'\xfe\xed\xfa\xcf', # MH_MAGIC_64 + b'\xcf\xfa\xed\xfe', # MH_CIGAM_64 + b'\xca\xfe\xba\xbe', # FAT_MAGIC + b'\xbe\xba\xfe\xca' # FAT_CIGAM ] elif sys.platform.startswith('win'): - return magic_bytes == 'MZ' + return magic_bytes == b'MZ' else: - return magic_bytes == '\x7FELF' + return magic_bytes == b'\x7FELF' def is_json_file(filename): @@ -68,7 +68,7 @@ def classify_input_file(filename): elif is_json_file(filename): ftype = IT_JSON else: - err_msg = "'%s' does not name a valid benchmark executable or JSON file" + err_msg = "'%s' does not name a valid benchmark executable or JSON file" % filename return ftype, err_msg @@ -80,10 +80,30 @@ def check_input_file(filename): """ ftype, msg = classify_input_file(filename) if ftype == IT_Invalid: - print "Invalid input file: %s" % msg + print("Invalid input file: %s" % msg) sys.exit(1) return ftype +def find_benchmark_flag(prefix, benchmark_flags): + """ + Search the specified list of flags for a flag matching `<prefix><arg>` and + if it is found return the arg it specifies. If specified more than once the + last value is returned. If the flag is not found None is returned. + """ + assert prefix.startswith('--') and prefix.endswith('=') + result = None + for f in benchmark_flags: + if f.startswith(prefix): + result = f[len(prefix):] + return result + +def remove_benchmark_flags(prefix, benchmark_flags): + """ + Return a new list containing the specified benchmark_flags except those + with the specified prefix. + """ + assert prefix.startswith('--') and prefix.endswith('=') + return [f for f in benchmark_flags if not f.startswith(prefix)] def load_benchmark_results(fname): """ @@ -101,16 +121,25 @@ def run_benchmark(exe_name, benchmark_flags): real time console output. RETURNS: A JSON object representing the benchmark output """ - thandle, tname = tempfile.mkstemp() - os.close(thandle) + output_name = find_benchmark_flag('--benchmark_out=', + benchmark_flags) + is_temp_output = False + if output_name is None: + is_temp_output = True + thandle, output_name = tempfile.mkstemp() + os.close(thandle) + benchmark_flags = list(benchmark_flags) + \ + ['--benchmark_out=%s' % output_name] + cmd = [exe_name] + benchmark_flags print("RUNNING: %s" % ' '.join(cmd)) - exitCode = subprocess.call(cmd + ['--benchmark_out=%s' % tname]) + exitCode = subprocess.call(cmd) if exitCode != 0: print('TEST FAILED...') sys.exit(exitCode) - json_res = load_benchmark_results(tname) - os.unlink(tname) + json_res = load_benchmark_results(output_name) + if is_temp_output: + os.unlink(output_name) return json_res diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index c941f65b2c57..bd99e8ddd978 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -111,7 +111,8 @@ class Configuration(object): def make_static_lib_name(self, name): """Return the full filename for the specified library name""" if self.is_windows: - return name + '.lib' + assert name == 'c++' # Only allow libc++ to use this function for now. + return 'lib' + name + '.lib' else: return 'lib' + name + '.a' @@ -241,7 +242,7 @@ class Configuration(object): flags = [] compile_flags = _prefixed_env_list('INCLUDE', '-isystem') link_flags = _prefixed_env_list('LIB', '-L') - for path in _list_env_var('LIB'): + for path in _split_env_var('LIB'): self.add_path(self.exec_env, path) return CXXCompiler(clang_path, flags=flags, compile_flags=compile_flags, @@ -412,6 +413,13 @@ class Configuration(object): if self.is_windows: self.config.available_features.add('windows') + if self.cxx_stdlib_under_test == 'libc++': + # LIBCXX-WINDOWS-FIXME is the feature name used to XFAIL the + # initial Windows failures until they can be properly diagnosed + # and fixed. This allows easier detection of new test failures + # and regressions. Note: New failures should not be suppressed + # using this feature. + self.config.available_features.add('LIBCXX-WINDOWS-FIXME') # Attempt to detect the glibc version by querying for __GLIBC__ # in 'features.h'. diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 01ca3ee5096f..867a6c41f9ad 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -442,7 +442,7 @@ <tr><td><a href="http://wg21.link/LWG2785">2785</a></td><td>quoted should work with basic_string_view</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2786">2786</a></td><td>Annex C should mention shared_ptr changes for array support</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2787">2787</a></td><td>§[file_status.cons] doesn't match class definition</td><td>Kona</td><td>Complete</td></tr> - <tr><td><a href="http://wg21.link/LWG2788">2788</a></td><td>basic_string range mutators unintentionally require a default constructible allocator</td><td>Kona</td><td></td></tr> + <tr><td><a href="http://wg21.link/LWG2788">2788</a></td><td>basic_string range mutators unintentionally require a default constructible allocator</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2789">2789</a></td><td>Equivalence of contained objects</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2790">2790</a></td><td>Missing specification of istreambuf_iterator::operator-></td><td>Kona</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2794">2794</a></td><td>Missing requirements for allocator pointers</td><td>Kona</td><td></td></tr> @@ -462,7 +462,7 @@ <tr><td><a href="http://wg21.link/LWG2838">2838</a></td><td>is_literal_type specification needs a little cleanup</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2842">2842</a></td><td>in_place_t check for optional::optional(U&&) should decay U</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2850">2850</a></td><td>std::function move constructor does unnecessary work</td><td>Kona</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td></td></tr> + <tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2855">2855</a></td><td>std::throw_with_nested("string_literal")</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2857">2857</a></td><td>{variant,optional,any}::emplace should return the constructed value</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2861">2861</a></td><td>basic_string should require that charT match traits::char_type</td><td>Kona</td><td>Complete</td></tr> @@ -489,7 +489,7 @@ <!-- <tr><td></td><td></td><td></td><td></td></tr> --> </table> - <p>Last Updated: 13-Apr-2017</p> + <p>Last Updated: 17-Apr-2017</p> </div> </body> </html> |