diff options
21 files changed, 4 insertions, 1152 deletions
diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst index 4cf5182a7f3..b7ad2e2a82c 100644 --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -48,3 +48,7 @@ API Changes linking translation units built with different versions of libc++'s headers together may lead to ODR violations and ABI issues. On the flipside, code size improvements should be expected for everyone not defining the macro. +- Starting with LLVM 8.0.0, std::dynarray has been removed from the library. + std::dynarray was a feature proposed for C++14 that was pulled from the + Standard at the last minute and was never standardized. Since there are no + plans to standardize this facility it is being removed. diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 0ccf977b6c1..73f7cfc4d8e 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -69,7 +69,6 @@ set(files experimental/chrono experimental/coroutine experimental/deque - experimental/dynarray experimental/filesystem experimental/forward_list experimental/functional diff --git a/libcxx/include/__config b/libcxx/include/__config index d9259bae057..e343ad53427 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1350,13 +1350,11 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. #ifdef _LIBCPP_NO_EXCEPTIONS -# define _LIBCPP_AVAILABILITY_DYNARRAY # define _LIBCPP_AVAILABILITY_FUTURE # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS #else -# define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH # define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS diff --git a/libcxx/include/experimental/dynarray b/libcxx/include/experimental/dynarray deleted file mode 100644 index e2bfa2e437b..00000000000 --- a/libcxx/include/experimental/dynarray +++ /dev/null @@ -1,305 +0,0 @@ -// -*- C++ -*- -//===-------------------------- dynarray ----------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_DYNARRAY -#define _LIBCPP_DYNARRAY - -/* - dynarray synopsis - -namespace std { namespace experimental { - -template< typename T > -class dynarray -{ - // types: - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef T* pointer; - typedef const T* const_pointer; - typedef implementation-defined iterator; - typedef implementation-defined const_iterator; - typedef reverse_iterator<iterator> reverse_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - -public: - // construct/copy/destroy: - explicit dynarray(size_type c); - dynarray(size_type c, const T& v); - dynarray(const dynarray& d); - dynarray(initializer_list<T>); - - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc); - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc); - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc); - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc); - dynarray& operator=(const dynarray&) = delete; - ~dynarray(); - - // iterators: - iterator begin() noexcept; - const_iterator begin() const noexcept; - const_iterator cbegin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; - const_iterator cend() const noexcept; - - reverse_iterator rbegin() noexcept; - const_reverse_iterator rbegin() const noexcept; - const_reverse_iterator crbegin() const noexcept; - reverse_iterator rend() noexcept; - const_reverse_iterator rend() const noexcept; - const_reverse_iterator crend() const noexcept; - - // capacity: - size_type size() const noexcept; - size_type max_size() const noexcept; - bool empty() const noexcept; - - // element access: - reference operator[](size_type n); - const_reference operator[](size_type n) const; - - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; - - const_reference at(size_type n) const; - reference at(size_type n); - - // data access: - T* data() noexcept; - const T* data() const noexcept; - - // mutating member functions: - void fill(const T& v); -}; - -}} // std::experimental - -*/ -#include <__config> -#if _LIBCPP_STD_VER > 11 - -#include <__functional_base> -#include <iterator> -#include <stdexcept> -#include <initializer_list> -#include <new> -#include <algorithm> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -namespace std { namespace experimental { inline namespace __array_extensions_v1 { - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray -{ -public: - // types: - typedef dynarray __self; - typedef _Tp value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - -private: - size_t __size_; - value_type * __base_; - _LIBCPP_INLINE_VISIBILITY dynarray () noexcept : __size_(0), __base_(nullptr) {} - - static inline _LIBCPP_INLINE_VISIBILITY - value_type* __allocate(size_t __count) { - if (numeric_limits<size_t>::max() / sizeof (value_type) <= __count) - __throw_bad_array_length(); - - return static_cast<value_type *>( - _VSTD::__libcpp_allocate(sizeof(value_type) * __count, __alignof(value_type))); - } - - static inline _LIBCPP_INLINE_VISIBILITY - void __deallocate_value(value_type* __ptr, size_t __count) noexcept { - _VSTD::__libcpp_deallocate(static_cast<void *>(__ptr), sizeof(value_type) * __count, __alignof(value_type)); - } - -public: - - _LIBCPP_INLINE_VISIBILITY - explicit dynarray(size_type __c); - _LIBCPP_INLINE_VISIBILITY - dynarray(size_type __c, const value_type& __v); - _LIBCPP_INLINE_VISIBILITY - dynarray(const dynarray& __d); - _LIBCPP_INLINE_VISIBILITY - dynarray(initializer_list<value_type>); - -// We're not implementing these right now. -// Updated with the resolution of LWG issue #2255 -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c); -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v); -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d); -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>); - - dynarray& operator=(const dynarray&) = delete; - _LIBCPP_INLINE_VISIBILITY - ~dynarray(); - - // iterators: - inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); } - inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); } - - inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } - inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } - - // capacity: - inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; } - inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; } - inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; } - - // element access: - inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; } - inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; } - - inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; } - inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; } - inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; } - inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; } - - inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const; - inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n); - - // data access: - inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; } - inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; } - - // mutating member functions: - inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); } -}; - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(size_type __c) : dynarray () -{ - __base_ = __allocate (__c); - value_type *__data = data (); - for ( __size_ = 0; __size_ < __c; ++__size_, ++__data ) - ::new (__data) value_type; -} - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray () -{ - __base_ = __allocate (__c); - value_type *__data = data (); - for ( __size_ = 0; __size_ < __c; ++__size_, ++__data ) - ::new (__data) value_type (__v); -} - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray () -{ - size_t sz = __il.size(); - __base_ = __allocate (sz); - value_type *__data = data (); - auto src = __il.begin(); - for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src ) - ::new (__data) value_type (*src); -} - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray () -{ - size_t sz = __d.size(); - __base_ = __allocate (sz); - value_type *__data = data (); - auto src = __d.begin(); - for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src ) - ::new (__data) value_type (*src); -} - -template <class _Tp> -inline -dynarray<_Tp>::~dynarray() -{ - value_type *__data = data () + __size_; - for ( size_t i = 0; i < __size_; ++i ) - (--__data)->value_type::~value_type(); - __deallocate_value(__base_, __size_); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename dynarray<_Tp>::reference -dynarray<_Tp>::at(size_type __n) -{ - if (__n >= __size_) - __throw_out_of_range("dynarray::at"); - - return data()[__n]; -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename dynarray<_Tp>::const_reference -dynarray<_Tp>::at(size_type __n) const -{ - if (__n >= __size_) - __throw_out_of_range("dynarray::at"); - - return data()[__n]; -} - -}}} - - -_LIBCPP_BEGIN_NAMESPACE_STD -template <class _Tp, class _Alloc> -struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {}; -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // if _LIBCPP_STD_VER > 11 -#endif // _LIBCPP_DYNARRAY diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap index 681c80bea7b..6d88f52113c 100644 --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -524,10 +524,6 @@ module std [system] { header "experimental/deque" export * } - module dynarray { - header "experimental/dynarray" - export * - } module filesystem { header "experimental/filesystem" export * diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp index 9ad8df4dd92..5a0f2ba72dc 100644 --- a/libcxx/test/libcxx/double_include.sh.cpp +++ b/libcxx/test/libcxx/double_include.sh.cpp @@ -145,7 +145,6 @@ #include <experimental/coroutine> #endif #include <experimental/deque> -#include <experimental/dynarray> #include <experimental/filesystem> #include <experimental/forward_list> #include <experimental/functional> diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp deleted file mode 100644 index c6a83cc61bd..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// dynarray.cons - -// template <class Alloc> -// dynarray(size_type c, const Alloc& alloc); -// template <class Alloc> -// dynarray(size_type c, const T& v, const Alloc& alloc); -// template <class Alloc> -// dynarray(const dynarray& d, const Alloc& alloc); -// template <class Alloc> -// dynarray(initializer_list<T>, const Alloc& alloc); - -// ~dynarray(); - - -#include <__config> - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> -#include "test_allocator.h" - -using std::experimental::dynarray; - -template <class T, class Allocator> -void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) { - for ( int i = 0; i < dyn.size (); ++i ) - assert ( dyn[i].get_allocator() == alloc ); -} - -template <class T, class Allocator> -void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) { - typedef dynarray<T> dynA; - - dynA d1 ( vals, alloc ); - assert ( d1.size () == vals.size() ); - assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ())); - check_allocator ( d1, alloc ); - } - - -template <class T, class Allocator> -void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) { - typedef dynarray<T> dynA; - - dynA d1 ( 4, alloc1 ); - assert ( d1.size () == 4 ); - assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } )); - check_allocator ( d1, alloc1 ); - - dynA d2 ( 7, val, alloc1 ); - assert ( d2.size () == 7 ); - assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } )); - check_allocator ( d2, alloc1 ); - - dynA d3 ( d2, alloc2 ); - assert ( d3.size () == 7 ); - assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } )); - check_allocator ( d3, alloc2 ); - } - -int main() -{ -// This test is waiting on the resolution of LWG issue #2235 -// typedef test_allocator<char> Alloc; -// typedef std::basic_string<char, std::char_traits<char>, Alloc> nstr; -// -// test ( nstr("fourteen"), Alloc(3), Alloc(4) ); -// test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6)); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp deleted file mode 100644 index db7484d468d..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - -// dynarray.cons - -// explicit dynarray(size_type c); -// dynarray(size_type c, const T& v); -// dynarray(initializer_list<T>); -// dynarray(const dynarray& d); - -// ~dynarray(); - - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <limits> -#include <new> -#include <string> - -#include "test_macros.h" - - -using std::experimental::dynarray; - -template <class T> -void testInitList( const std::initializer_list<T> &vals ) { - typedef dynarray<T> dynA; - - dynA d1 ( vals ); - assert ( d1.size () == vals.size() ); - assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ())); - } - - -template <class T> -void test ( const T &val, bool DefaultValueIsIndeterminate = false) { - typedef dynarray<T> dynA; - - dynA d1 ( 4 ); - assert ( d1.size () == 4 ); - if (!DefaultValueIsIndeterminate) { - assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } )); - } - - dynA d2 ( 7, val ); - assert ( d2.size () == 7 ); - assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } )); - - dynA d3 ( d2 ); - assert ( d3.size () == 7 ); - assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } )); - } - -#ifndef TEST_HAS_NO_EXCEPTIONS -void test_bad_length () { - try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); } - catch ( std::bad_array_length & ) { return ; } - catch (...) { assert(false); } - assert ( false ); -} -#endif - - -int main() -{ - test<int> ( 14, /* DefaultValueIsIndeterminate */ true ); // ints don't get default initialized - test<long> ( 0, true); - test<double> ( 14.0, true ); - test<std::complex<double>> ( std::complex<double> ( 14, 0 )); - test<std::string> ( "fourteen" ); - - testInitList( { 1, 1, 2, 3, 5, 8 } ); - testInitList( { 1., 1., 2., 3., 5., 8. } ); - testInitList( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), - std::string("5"), std::string("8")} ); - -// Make sure we don't pick up the Allocator version here - dynarray<long> d1 ( 20, 3 ); - assert ( d1.size() == 20 ); - assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } )); - -#ifndef TEST_HAS_NO_EXCEPTIONS - test_bad_length (); -#endif -} diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp deleted file mode 100644 index 4009841355f..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: libcpp-no-exceptions -// XFAIL: availability -// dynarray.cons - -// explicit dynarray(size_type c); - -// UNSUPPORTED: c++98, c++03, c++11 - -// The sanitizers replace new/delete with versions that do not throw bad_alloc. -// UNSUPPORTED: sanitizer-new-delete - - -#include <experimental/dynarray> -#include <limits> -#include <new> -#include <cassert> - - -using std::experimental::dynarray; - -int main() { - try { dynarray<int>((std::numeric_limits<size_t>::max() / sizeof(int)) - 1); } - catch (std::bad_alloc &) { return 0; } - catch (...) { assert(false); } - assert(false); -} diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp deleted file mode 100644 index 5c745e0d1ea..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - -// dynarray.data - -// T* data() noexcept; -// const T* data() const noexcept; - - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void dyn_test_const(const dynarray<T> &dyn, bool CheckEquals = true) { - const T *data = dyn.data (); - assert ( data != NULL ); - if (CheckEquals) { - assert ( std::equal ( dyn.begin(), dyn.end(), data )); - } -} - -template <class T> -void dyn_test( dynarray<T> &dyn, bool CheckEquals = true) { - T *data = dyn.data (); - assert ( data != NULL ); - if (CheckEquals) { - assert ( std::equal ( dyn.begin(), dyn.end(), data )); - } -} - - - -template <class T> -void test(const T &val, bool DefaultValueIsIndeterminate = false) { - typedef dynarray<T> dynA; - - const bool CheckDefaultValues = !DefaultValueIsIndeterminate; - - dynA d1(4); - dyn_test(d1, CheckDefaultValues); - dyn_test_const(d1, CheckDefaultValues); - - dynA d2 (7, val); - dyn_test ( d2 ); - dyn_test_const ( d2 ); -} - -int main() -{ - test<int>(14, /* DefaultValueIsIndeterminate */ true); - test<double>(14.0, true); - test<std::complex<double>> ( std::complex<double> ( 14, 0 )); - test<std::string> ( "fourteen" ); -} diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp deleted file mode 100644 index 1ed51538f6f..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - -// dynarray.data - -// void fill(const T& v); -// const T* data() const noexcept; - - -#include <__config> - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void test ( const T &val ) { - typedef dynarray<T> dynA; - - dynA d1 ( 4 ); - d1.fill ( val ); - assert ( std::all_of ( d1.begin (), d1.end (), - [&val]( const T &item ){ return item == val; } )); - } - -int main() -{ - test<int> ( 14 ); - test<double> ( 14.0 ); - test<std::complex<double>> ( std::complex<double> ( 14, 0 )); - test<std::string> ( "fourteen" ); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp deleted file mode 100644 index 473313f39fc..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// UNSUPPORTED: libcpp-no-exceptions -// XFAIL: availability - -// dynarray.overview - -// const_reference at(size_type n) const; -// reference at(size_type n); - -#include <__config> - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void dyn_at_fail ( dynarray<T> &dyn, size_t sz ) { - try { dyn.at (sz); } - catch (const std::out_of_range &) { return; } - assert ( false ); - } - -template <class T> -void dyn_at_fail_const ( const dynarray<T> &dyn, size_t sz ) { - try { dyn.at (sz); } - catch (const std::out_of_range &) { return; } - assert ( false ); - } - - -template <class T> -void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) { - const T *data = dyn.data (); - auto it = vals.begin (); - for ( size_t i = 0; i < dyn.size(); ++i, ++it ) { - assert ( data + i == &dyn.at(i)); - assert ( *it == dyn.at(i)); - } - - dyn_at_fail_const ( dyn, dyn.size ()); - dyn_at_fail_const ( dyn, 2*dyn.size ()); - dyn_at_fail_const ( dyn, size_t (-1)); - } - -template <class T> -void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) { - T *data = dyn.data (); - auto it = vals.begin (); - for ( size_t i = 0; i < dyn.size(); ++i, ++it ) { - assert ( data + i == &dyn.at(i)); - assert ( *it == dyn.at(i)); - } - - dyn_at_fail ( dyn, dyn.size ()); - dyn_at_fail ( dyn, 2*dyn.size ()); - dyn_at_fail ( dyn, size_t (-1)); - } - - -template <class T> -void test ( std::initializer_list<T> vals ) { - typedef dynarray<T> dynA; - - dynA d1 ( vals ); - dyn_test ( d1, vals ); - dyn_test_const ( d1, vals ); - } - -int main() -{ - test ( { 1, 1, 2, 3, 5, 8 } ); - test ( { 1., 1., 2., 3., 5., 8. } ); - test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), - std::string("5"), std::string("8")} ); - - test<int> ( {} ); - test<std::complex<double>> ( {} ); - test<std::string> ( {} ); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp deleted file mode 100644 index f0aa1e3ff69..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp +++ /dev/null @@ -1,110 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - -// dynarray.overview - - -// iterator begin() noexcept; -// const_iterator begin() const noexcept; -// const_iterator cbegin() const noexcept; -// iterator end() noexcept; -// const_iterator end() const noexcept; -// const_iterator cend() const noexcept; -// -// reverse_iterator rbegin() noexcept; -// const_reverse_iterator rbegin() const noexcept; -// const_reverse_iterator crbegin() const noexcept; -// reverse_iterator rend() noexcept; -// const_reverse_iterator rend() const noexcept; -// const_reverse_iterator crend() const noexcept; - - -#include <__config> - -#include <experimental/dynarray> -#include <cstddef> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void dyn_test_const ( const dynarray<T> &dyn ) { - const T *data = dyn.data (); - assert ( data == &*dyn.begin ()); - assert ( data == &*dyn.cbegin ()); - - assert ( data + dyn.size() - 1 == &*dyn.rbegin ()); - assert ( data + dyn.size() - 1 == &*dyn.crbegin ()); - - std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size()); - assert (ds == std::distance ( dyn.begin(), dyn.end())); - assert (ds == std::distance ( dyn.cbegin(), dyn.cend())); - assert (ds == std::distance ( dyn.rbegin(), dyn.rend())); - assert (ds == std::distance ( dyn.crbegin(), dyn.crend())); - - assert ( dyn.begin () == dyn.cbegin ()); - assert ( &*dyn.begin () == &*dyn.cbegin ()); - assert ( dyn.rbegin () == dyn.crbegin ()); - assert ( &*dyn.rbegin () == &*dyn.crbegin ()); - assert ( dyn.end () == dyn.cend ()); - assert ( dyn.rend () == dyn.crend ()); - } - -template <class T> -void dyn_test ( dynarray<T> &dyn ) { - T *data = dyn.data (); - assert ( data == &*dyn.begin ()); - assert ( data == &*dyn.cbegin ()); - - assert ( data + dyn.size() - 1 == &*dyn.rbegin ()); - assert ( data + dyn.size() - 1 == &*dyn.crbegin ()); - - std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size()); - assert (ds == std::distance ( dyn.begin(), dyn.end())); - assert (ds == std::distance ( dyn.cbegin(), dyn.cend())); - assert (ds == std::distance ( dyn.rbegin(), dyn.rend())); - assert (ds == std::distance ( dyn.crbegin(), dyn.crend())); - - assert ( dyn.begin () == dyn.cbegin ()); - assert ( &*dyn.begin () == &*dyn.cbegin ()); - assert ( dyn.rbegin () == dyn.crbegin ()); - assert ( &*dyn.rbegin () == &*dyn.crbegin ()); - assert ( dyn.end () == dyn.cend ()); - assert ( dyn.rend () == dyn.crend ()); - } - - -template <class T> -void test ( const T &val ) { - typedef dynarray<T> dynA; - - dynA d1 ( 4 ); - dyn_test ( d1 ); - dyn_test_const ( d1 ); - - dynA d2 ( 7, val ); - dyn_test ( d2 ); - dyn_test_const ( d2 ); - } - -int main() -{ - test<int> ( 14 ); - test<double> ( 14.0 ); - test<std::complex<double>> ( std::complex<double> ( 14, 0 )); - test<std::string> ( "fourteen" ); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp deleted file mode 100644 index a5484296fa2..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - -// dynarray.overview - -// size_type size() const noexcept; -// size_type max_size() const noexcept; -// bool empty() const noexcept; - -#include <__config> - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void dyn_test ( const dynarray<T> &dyn, size_t sz ) { - assert ( dyn.size () == sz ); - assert ( dyn.max_size () == sz ); - assert ( dyn.empty () == ( sz == 0 )); - } - -template <class T> -void test ( std::initializer_list<T> vals ) { - typedef dynarray<T> dynA; - - dynA d1 ( vals ); - dyn_test ( d1, vals.size ()); - } - -int main() -{ - test ( { 1, 1, 2, 3, 5, 8 } ); - test ( { 1., 1., 2., 3., 5., 8. } ); - test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), - std::string("5"), std::string("8")} ); - - test<int> ( {} ); - test<std::complex<double>> ( {} ); - test<std::string> ( {} ); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp deleted file mode 100644 index 0ba27cf925f..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - -// dynarray.overview - -// reference front(); -// const_reference front() const; -// reference back(); -// const_reference back() const; - - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void dyn_test_const ( const dynarray<T> &dyn, bool CheckValues = true ) { - const T *data = dyn.data (); - assert(data == &dyn.front()); - assert((data + dyn.size() - 1) == &dyn.back()); - if (CheckValues) { - assert ( *data == dyn.front ()); - assert ( *(data + dyn.size() - 1 ) == dyn.back ()); - } -} - -template <class T> -void dyn_test ( dynarray<T> &dyn, bool CheckValues = true ) { - T *data = dyn.data (); - assert(data == &dyn.front()); - assert((data + dyn.size() - 1) == &dyn.back()); - if (CheckValues) { - assert ( *data == dyn.front ()); - assert ( *(data + dyn.size() - 1 ) == dyn.back ()); - } -} - - -template <class T> -void test ( const T &val, bool DefaultValueIsIndeterminate = false) { - typedef dynarray<T> dynA; - - const bool CheckDefaultValues = ! DefaultValueIsIndeterminate; - - dynA d1 ( 4 ); - dyn_test ( d1, CheckDefaultValues ); - dyn_test_const ( d1, CheckDefaultValues ); - - dynA d2 ( 7, val ); - dyn_test ( d2 ); - dyn_test_const ( d2 ); -} - -int main() -{ - test<int> ( 14, /* DefaultValueIsIndeterminate */ true); - test<double> ( 14.0, true ); - test<std::complex<double>> ( std::complex<double> ( 14, 0 )); - test<std::string> ( "fourteen" ); -} diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp deleted file mode 100644 index 4306d1e9c1b..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - -// dynarray.overview - -// const_reference at(size_type n) const; -// reference at(size_type n); - -#include <__config> - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) { - const T *data = dyn.data (); - auto it = vals.begin (); - for ( size_t i = 0; i < dyn.size(); ++i, ++it ) { - assert ( data + i == &dyn[i]); - assert ( *it == dyn[i]); - } - } - -template <class T> -void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) { - T *data = dyn.data (); - auto it = vals.begin (); - for ( size_t i = 0; i < dyn.size(); ++i, ++it ) { - assert ( data + i == &dyn[i]); - assert ( *it == dyn[i]); - } - } - - -template <class T> -void test ( std::initializer_list<T> vals ) { - typedef dynarray<T> dynA; - - dynA d1 ( vals ); - dyn_test ( d1, vals ); - dyn_test_const ( d1, vals ); - } - -int main() -{ - test ( { 1, 1, 2, 3, 5, 8 } ); - test ( { 1., 1., 2., 3., 5., 8. } ); - test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), - std::string("5"), std::string("8")} ); - - test<int> ( {} ); - test<std::complex<double>> ( {} ); - test<std::string> ( {} ); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp deleted file mode 100644 index 48da6d88577..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// dynarray.data - -// template <class Type, class Alloc> -// struct uses_allocator<dynarray<Type>, Alloc> : true_type { }; - - -#include <__config> - -#include <experimental/dynarray> -#include "test_allocator.h" - -using std::experimental::dynarray; - -int main() -{ - static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" ); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp deleted file mode 100644 index ab496003506..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability -// dynarray.zero - -// dynarray shall provide support for the special case of construction with a size of zero. -// In the case that the size is zero, begin() == end() == unique value. -// The return value of data() is unspecified. -// The effect of calling front() or back() for a zero-sized dynarray is undefined. - - - -#include <__config> - -#include <experimental/dynarray> -#include <cassert> - -#include <algorithm> -#include <complex> -#include <string> - -using std::experimental::dynarray; - -template <class T> -void test ( ) { - typedef dynarray<T> dynA; - - dynA d1 ( 0 ); - assert ( d1.size() == 0 ); - assert ( d1.begin() == d1.end ()); - } - -int main() -{ - test<int> (); - test<double> (); - test<std::complex<double>> (); - test<std::string> (); -} - diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg deleted file mode 100644 index 93553b5130e..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if ('availability' in config.available_features - and not 'libcpp-no-exceptions' in config.available_features): - config.unsupported = True diff --git a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp b/libcxx/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b64..00000000000 --- a/libcxx/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/libcxx/test/libcxx/min_max_macros.sh.cpp b/libcxx/test/libcxx/min_max_macros.sh.cpp index 45b7bb1f6a8..7b9202d952f 100644 --- a/libcxx/test/libcxx/min_max_macros.sh.cpp +++ b/libcxx/test/libcxx/min_max_macros.sh.cpp @@ -241,8 +241,6 @@ TEST_MACROS(); TEST_MACROS(); #include <experimental/deque> TEST_MACROS(); -#include <experimental/dynarray> -TEST_MACROS(); #include <experimental/filesystem> TEST_MACROS(); #include <experimental/forward_list> |

