From c0acd34e9aab8e28f2d7ba49529d36906dff0c10 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 7 Feb 2018 23:50:25 +0000 Subject: [PATCH 001/176] Fix size and alignment of array. An array T[1] isn't necessarily the same say when it's a member of a struct. This patch addresses that problem and corrects the tests to deal with it. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324545 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 1 + include/array | 5 +++-- .../array/size_and_alignment.pass.cpp | 20 +++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/__config b/include/__config index a4acbcaf1..cfe4ef08c 100644 --- a/include/__config +++ b/include/__config @@ -582,6 +582,7 @@ namespace std { #define __alignof__ __alignof #define _LIBCPP_NORETURN __declspec(noreturn) #define _ALIGNAS(x) __declspec(align(x)) +#define _ALIGNAS_TYPE(x) alignas(x) #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { diff --git a/include/array b/include/array index 706e573db..fdb1f9dae 100644 --- a/include/array +++ b/include/array @@ -244,10 +244,11 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - typedef typename conditional::value, const char, char>::type _CharType; - _ALIGNAS(alignment_of<_Tp[1]>::value) _CharType __elems_[sizeof(_Tp[1])]; + + struct _ArrayInStructT { _Tp __data_[1]; }; + _ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; // No explicit construct/copy/destroy for aggregate type _LIBCPP_INLINE_VISIBILITY void fill(const value_type&) { diff --git a/test/std/containers/sequences/array/size_and_alignment.pass.cpp b/test/std/containers/sequences/array/size_and_alignment.pass.cpp index d01e1ceb7..966d063fe 100644 --- a/test/std/containers/sequences/array/size_and_alignment.pass.cpp +++ b/test/std/containers/sequences/array/size_and_alignment.pass.cpp @@ -21,12 +21,26 @@ #include "test_macros.h" + +template +struct MyArray { + T elems[Size]; +}; + template void test() { typedef T CArrayT[Size == 0 ? 1 : Size]; typedef std::array ArrayT; - static_assert(sizeof(CArrayT) == sizeof(ArrayT), ""); - static_assert(TEST_ALIGNOF(CArrayT) == TEST_ALIGNOF(ArrayT), ""); + typedef MyArray MyArrayT; + static_assert(sizeof(ArrayT) == sizeof(CArrayT), ""); + static_assert(sizeof(ArrayT) == sizeof(MyArrayT), ""); + static_assert(TEST_ALIGNOF(ArrayT) == TEST_ALIGNOF(MyArrayT), ""); +#if defined(_LIBCPP_VERSION) + ArrayT a; + ((void)a); + static_assert(sizeof(ArrayT) == sizeof(a.__elems_), ""); + static_assert(TEST_ALIGNOF(ArrayT) == __alignof__(a.__elems_), ""); +#endif } template @@ -44,6 +58,8 @@ struct TEST_ALIGNAS(TEST_ALIGNOF(std::max_align_t) * 2) TestType2 { char data[1000]; }; +//static_assert(sizeof(void*) == 4, ""); + int main() { test_type(); test_type(); From 60020e6384719ac16a4d84559f84ce78f1f04780 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 05:47:40 +0000 Subject: [PATCH 002/176] Improve a test. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324566 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/libcxx/memory/is_allocator.pass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/libcxx/memory/is_allocator.pass.cpp b/test/libcxx/memory/is_allocator.pass.cpp index c33b7e829..95f1079d6 100644 --- a/test/libcxx/memory/is_allocator.pass.cpp +++ b/test/libcxx/memory/is_allocator.pass.cpp @@ -26,6 +26,7 @@ template void test_allocators() { + static_assert(!std::__is_allocator::value, "" ); static_assert( std::__is_allocator>::value, "" ); static_assert( std::__is_allocator>::value, "" ); static_assert( std::__is_allocator>::value, "" ); From 5b1e87e52d055e55396efff955b76d5e56779676 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 06:34:03 +0000 Subject: [PATCH 003/176] Implement deduction guide for basic_string as described in P0433 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324569 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 19 +++++++ .../string.cons/iter_alloc.fail.cpp | 54 ++++++++++++++++++ .../string.cons/iter_alloc.pass.cpp | 56 +++++++++++++++++++ www/cxx1z_status.html | 5 +- 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp diff --git a/include/string b/include/string index f89ef5741..e8ec709c2 100644 --- a/include/string +++ b/include/string @@ -311,6 +311,13 @@ public: bool __invariants() const; }; +template::value_type>> +basic_string(InputIterator, InputIterator, Allocator = Allocator()) + -> basic_string::value_type, + char_traits::value_type>, + Allocator>; // C++17 + template basic_string operator+(const basic_string& lhs, @@ -1485,6 +1492,18 @@ private: friend basic_string operator+<>(const basic_string&, value_type); }; +#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +template::value_type, + class _Allocator = allocator<_CharT>, + class = typename enable_if<__is_input_iterator<_InputIterator>::value, void>::type, + class = typename enable_if<__is_allocator<_Allocator>::value, void>::type + > +basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> basic_string<_CharT, char_traits<_CharT>, _Allocator>; +#endif + + template inline _LIBCPP_INLINE_VISIBILITY void diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp new file mode 100644 index 000000000..3bc10e4ac --- /dev/null +++ b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp @@ -0,0 +1,54 @@ +//===----------------------------------------------------------------------===// +// +// 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, c++14 + +// template::value_type>> +// basic_string(InputIterator, InputIterator, Allocator = Allocator()) +// -> basic_string::value_type, +// char_traits::value_type>, +// Allocator>; +// +// The deduction guide shall not participate in overload resolution if InputIterator +// is a type that does not qualify as an input iterator, or if Allocator is a type +// that does not qualify as an allocator. + + +#include +#include +#include +#include + +#include "test_macros.h" + +class NotAnItertor {}; + +template +struct NotAnAllocator { typedef T value_type; }; + +int main() +{ + { // Not an iterator at all + std::basic_string s1{NotAnItertor{}, NotAnItertor{}, std::allocator{}}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}} + } + { // Not an input iterator + const char16_t* s = u"12345678901234"; + std::basic_string s0; + std::basic_string s1{std::back_insert_iterator(s0), // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}} + std::back_insert_iterator(s0), + std::allocator{}}; + } + { // Not an allocator + const wchar_t* s = L"12345678901234"; + std::basic_string s1{s, s+10, NotAnAllocator{}}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}} + } + +} diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 1f8369689..00ac988bf 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -13,6 +13,18 @@ // basic_string(InputIterator begin, InputIterator end, // const Allocator& a = Allocator()); +// template::value_type>> +// basic_string(InputIterator, InputIterator, Allocator = Allocator()) +// -> basic_string::value_type, +// char_traits::value_type>, +// Allocator>; +// +// The deduction guide shall not participate in overload resolution if InputIterator +// is a type that does not qualify as an input iterator, or if Allocator is a type +// that does not qualify as an allocator. + + #include #include #include @@ -116,4 +128,48 @@ int main() test(input_iterator(s), input_iterator(s+50), A()); } #endif + +// Test deduction guides +#if TEST_STD_VER > 14 + { + const char* s = "12345678901234"; + std::basic_string s1{s, s+10, std::allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const wchar_t* s = L"12345678901234"; + std::basic_string s1{s, s+10, test_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char16_t* s = u"12345678901234"; + std::basic_string s1{s, s+10, min_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char32_t* s = U"12345678901234"; + std::basic_string s1{s, s+10, explicit_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } +#endif } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index c78cc7e6a..84bfd2878 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -150,7 +150,7 @@ P0298R3CWGA byte type definitionKonaComplete5.0 P0317R1LWGDirectory Entry Caching for FilesystemKona P0430R2LWGFile system library on non-POSIX-like operating systemsKona - P0433R2LWGToward a resolution of US7 and US14: Integrating template deduction for class templates into the standard libraryKona + P0433R2LWGToward a resolution of US7 and US14: Integrating template deduction for class templates into the standard libraryKonaIn progress7.0 P0452R1LWGUnifying <numeric> Parallel AlgorithmsKona P0467R2LWGIterator Concerns for Parallel AlgorithmsKona P0492R2LWGProposed Resolution of C++17 National Body Comments for FilesystemsKona @@ -161,7 +161,7 @@ P0574R1LWGAlgorithm Complexity Constraints and Parallel OverloadsKona P0599R1LWGnoexcept for hash functionsKonaComplete5.0 P0604R0LWGResolving GB 55, US 84, US 85, US 86Kona - P0607R0LWGInline Variables for the Standard LibraryKonaIn Progress6.0 + P0607R0LWGInline Variables for the Standard LibraryKonaIn Progress6.0 P0618R0LWGDeprecating <codecvt>Kona P0623R0LWGFinal C++17 Parallel Algorithms FixesKona @@ -172,6 +172,7 @@

The parts of P0607 that are not done are the <regex> bits.

+

So far, only the <string> part of P0433 has been implemented.

[ Note: "Nothing to do" means that no library changes were needed to implement this change -- end note]

From 4c153004af3a23b6ce0a448f781edc16b77f6e90 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 07:20:45 +0000 Subject: [PATCH 004/176] Temporarily comment out deduction guide tests while I figure out what to do with old bots git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324573 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp | 1 + test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp index 3bc10e4ac..449b75d90 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp @@ -9,6 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: c++17 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 00ac988bf..9314ecb9a 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -129,6 +129,7 @@ int main() } #endif +#if 0 // Test deduction guides #if TEST_STD_VER > 14 { @@ -172,4 +173,5 @@ int main() assert(s1.compare(0, s1.size(), s, s1.size()) == 0); } #endif +#endif } From 171ed2198d74a9cc58a933a502c2c23378b4a631 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Thu, 8 Feb 2018 11:33:48 +0000 Subject: [PATCH 005/176] [libcxx] Avoid spurious construction of valarray elements Summary: Currently libc++ implements some operations on valarray by using the resize method. This method has a parameter with a default value. Because of this, valarray may spuriously construct and destruct objects of valarray's element type. This patch fixes this issue and adds corresponding test cases. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: rogfer01, cfe-commits Differential Revision: https://reviews.llvm.org/D41992 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324596 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/valarray | 79 ++++++++++++++----- .../valarray.assign/copy_assign.pass.cpp | 27 +++++++ .../initializer_list_assign.pass.cpp | 26 ++++++ .../valarray.cons/default.pass.cpp | 12 +++ .../valarray.cons/size.pass.cpp | 16 ++++ 5 files changed, 139 insertions(+), 21 deletions(-) diff --git a/include/valarray b/include/valarray index ee61238a9..b495ccf57 100644 --- a/include/valarray +++ b/include/valarray @@ -1053,6 +1053,9 @@ private: friend const _Up* end(const valarray<_Up>& __v); + + void __clear(); + valarray& __assign_range(const value_type* __f, const value_type* __l); }; _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray::valarray(size_t)) @@ -2750,7 +2753,24 @@ valarray<_Tp>::valarray(size_t __n) : __begin_(0), __end_(0) { - resize(__n); + if (__n) + { + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); +#ifndef _LIBCPP_NO_EXCEPTIONS + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + for (; __n; --__n, ++__end_) + ::new (__end_) value_type(); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + __clear(); + throw; + } +#endif // _LIBCPP_NO_EXCEPTIONS + } } template @@ -2780,7 +2800,7 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2805,7 +2825,7 @@ valarray<_Tp>::valarray(const valarray& __v) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2842,7 +2862,7 @@ valarray<_Tp>::valarray(initializer_list __il) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2870,7 +2890,7 @@ valarray<_Tp>::valarray(const slice_array& __sa) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2899,7 +2919,7 @@ valarray<_Tp>::valarray(const gslice_array& __ga) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2928,7 +2948,7 @@ valarray<_Tp>::valarray(const mask_array& __ma) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2957,7 +2977,7 @@ valarray<_Tp>::valarray(const indirect_array& __ia) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2968,7 +2988,24 @@ template inline valarray<_Tp>::~valarray() { - resize(0); + __clear(); +} + +template +valarray<_Tp>& +valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) +{ + size_t __n = __l - __f; + if (size() != __n) + { + __clear(); + __begin_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __end_ = __begin_ + __n; + _VSTD::uninitialized_copy(__f, __l, __begin_); + } else { + _VSTD::copy(__f, __l, __begin_); + } + return *this; } template @@ -2976,11 +3013,7 @@ valarray<_Tp>& valarray<_Tp>::operator=(const valarray& __v) { if (this != &__v) - { - if (size() != __v.size()) - resize(__v.size()); - _VSTD::copy(__v.__begin_, __v.__end_, __begin_); - } + return __assign_range(__v.__begin_, __v.__end_); return *this; } @@ -2991,7 +3024,7 @@ inline valarray<_Tp>& valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT { - resize(0); + __clear(); __begin_ = __v.__begin_; __end_ = __v.__end_; __v.__begin_ = nullptr; @@ -3004,10 +3037,7 @@ inline valarray<_Tp>& valarray<_Tp>::operator=(initializer_list __il) { - if (size() != __il.size()) - resize(__il.size()); - _VSTD::copy(__il.begin(), __il.end(), __begin_); - return *this; + return __assign_range(__il.begin(), __il.end()); } #endif // _LIBCPP_CXX03_LANG @@ -3680,7 +3710,7 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const template void -valarray<_Tp>::resize(size_t __n, value_type __x) +valarray<_Tp>::__clear() { if (__begin_ != nullptr) { @@ -3689,6 +3719,13 @@ valarray<_Tp>::resize(size_t __n, value_type __x) _VSTD::__libcpp_deallocate(__begin_); __begin_ = __end_ = nullptr; } +} + +template +void +valarray<_Tp>::resize(size_t __n, value_type __x) +{ + __clear(); if (__n) { __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); @@ -3702,7 +3739,7 @@ valarray<_Tp>::resize(size_t __n, value_type __x) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp index 3803489c3..da1225ae0 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp @@ -17,6 +17,21 @@ #include #include +struct S +{ + S() : x_(0) { default_ctor_called = true; } + S(int x) : x_(x) {} + int x_; + static bool default_ctor_called; +}; + +bool S::default_ctor_called = false; + +bool operator==(const S& lhs, const S& rhs) +{ + return lhs.x_ == rhs.x_; +} + int main() { { @@ -56,4 +71,16 @@ int main() assert(v2[i][j] == v[i][j]); } } + { + typedef S T; + T a[] = {T(1), T(2), T(3), T(4), T(5)}; + const unsigned N = sizeof(a)/sizeof(a[0]); + std::valarray v(a, N); + std::valarray v2; + v2 = v; + assert(v2.size() == v.size()); + for (std::size_t i = 0; i < v2.size(); ++i) + assert(v2[i] == v[i]); + assert(!S::default_ctor_called); + } } 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 5122f44c3..7923b104b 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 @@ -19,6 +19,21 @@ #include #include +struct S +{ + S() : x_(0) { default_ctor_called = true; } + S(int x) : x_(x) {} + int x_; + static bool default_ctor_called; +}; + +bool S::default_ctor_called = false; + +bool operator==(const S& lhs, const S& rhs) +{ + return lhs.x_ == rhs.x_; +} + int main() { { @@ -55,4 +70,15 @@ int main() assert(v2[i][j] == a[i][j]); } } + { + typedef S T; + T a[] = {T(1), T(2), T(3), T(4), T(5)}; + const unsigned N = sizeof(a)/sizeof(a[0]); + std::valarray v2; + v2 = {T(1), T(2), T(3), T(4), T(5)}; + assert(v2.size() == N); + for (std::size_t i = 0; i < v2.size(); ++i) + assert(v2[i] == a[i]); + assert(!S::default_ctor_called); + } } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp index f46e0bf28..9933322de 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp @@ -16,6 +16,13 @@ #include #include +struct S { + S() { ctor_called = true; } + static bool ctor_called; +}; + +bool S::ctor_called = false; + int main() { { @@ -34,4 +41,9 @@ int main() std::valarray > v; assert(v.size() == 0); } + { + std::valarray v; + assert(v.size() == 0); + assert(!S::ctor_called); + } } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp index 359073eb3..221187c4e 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp @@ -16,6 +16,15 @@ #include #include +struct S { + S() : x(1) {} + ~S() { ++cnt_dtor; } + int x; + static size_t cnt_dtor; +}; + +size_t S::cnt_dtor = 0; + int main() { { @@ -36,4 +45,11 @@ int main() for (int i = 0; i < 100; ++i) assert(v[i].size() == 0); } + { + std::valarray v(100); + assert(v.size() == 100); + for (int i = 0; i < 100; ++i) + assert(v[i].x == 1); + } + assert(S::cnt_dtor == 100); } From 1a2caf573faa37a2935d6bc23390864920daba3f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 14:51:22 +0000 Subject: [PATCH 006/176] Update the status of removed components git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324609 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/TS_deprecation.html | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/www/TS_deprecation.html b/www/TS_deprecation.html index 75ca0e16a..a8dd8c183 100644 --- a/www/TS_deprecation.html +++ b/www/TS_deprecation.html @@ -48,22 +48,22 @@ - - - - + + + + - + - - - + + + - - - + + + @@ -77,9 +77,9 @@ - + - +
SectionFeatureshipped in
std
To be removed from
std::experimental
Notes
2.1uses_allocator construction
5.0
7.0
3.1.2erased_type
n/a
Not part of C++17
3.2.1tuple_size_v
5.0
7.0
3.2.2apply
5.0
7.0
3.3.1All of the '_v' traits in <type_traits>
5.0
7.0
3.1.2erased_type
n/a
Not part of C++17
3.2.1tuple_size_v
5.0
7.0
Removed
3.2.2apply
5.0
7.0
Removed
3.3.1All of the '_v' traits in <type_traits>
5.0
7.0
Removed
3.3.2invocation_type and raw_invocation_type
n/a
Not part of C++17
3.3.3Logical operator traits
5.0
7.0
3.3.3Logical operator traits
5.0
7.0
Removed
3.3.3Detection Idiom
5.0
Only partially in C++17
3.4.1All of the '_v' traits in <ratio>
5.0
7.0
3.5.1All of the '_v' traits in <chrono>
5.0
7.0
3.6.1All of the '_v' traits in <system_error>
5.0
7.0
3.4.1All of the '_v' traits in <ratio>
5.0
7.0
Removed
3.5.1All of the '_v' traits in <chrono>
5.0
7.0
Removed
3.6.1All of the '_v' traits in <system_error>
5.0
7.0
Removed
3.7propagate_const
n/a
Not part of C++17
4.2Enhancements to function
Not yet
4.3searchers
7.0
9.0
5optional
5.0
7.0
6any
5.0
7.0
7string_view
5.0
7.0
5optional
5.0
7.0
Removed
6any
5.0
7.0
Removed
7string_view
5.0
7.0
Removed
8.2.1shared_ptr enhancements
Not yet
Never added
8.2.2weak_ptr enhancements
Not yet
Never added
8.5memory_resource
Not yet
11.2promise
n/a
Not part of C++17
11.3packaged_task
n/a
Not part of C++17
12.2search
7.0
9.0
12.3sample
5.0
7.0
12.3sample
5.0
7.0
Removed
12.4shuffleNot part of C++17
13.1gcd and lcm
5.0
7.0
13.1gcd and lcm
5.0
7.0
Removed
13.2Random number generationNot part of C++17
14Reflection LibraryNot part of C++17
@@ -132,7 +132,7 @@
-

Last Updated: 8-Jan-2018

+

Last Updated: 8-Feb-2018

From 0eec3e8b246c845292546cc2a7ba4ca8256a45f0 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 16:25:57 +0000 Subject: [PATCH 007/176] Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324619 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.cons/iter_alloc.pass.cpp | 57 ------------- ...fail.cpp => iter_alloc_deduction.fail.cpp} | 2 +- .../string.cons/iter_alloc_deduction.pass.cpp | 82 +++++++++++++++++++ 3 files changed, 83 insertions(+), 58 deletions(-) rename test/std/strings/basic.string/string.cons/{iter_alloc.fail.cpp => iter_alloc_deduction.fail.cpp} (95%) create mode 100644 test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 9314ecb9a..e7fefacc0 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -13,17 +13,6 @@ // basic_string(InputIterator begin, InputIterator end, // const Allocator& a = Allocator()); -// template::value_type>> -// basic_string(InputIterator, InputIterator, Allocator = Allocator()) -// -> basic_string::value_type, -// char_traits::value_type>, -// Allocator>; -// -// The deduction guide shall not participate in overload resolution if InputIterator -// is a type that does not qualify as an input iterator, or if Allocator is a type -// that does not qualify as an allocator. - #include #include @@ -128,50 +117,4 @@ int main() test(input_iterator(s), input_iterator(s+50), A()); } #endif - -#if 0 -// Test deduction guides -#if TEST_STD_VER > 14 - { - const char* s = "12345678901234"; - std::basic_string s1{s, s+10, std::allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } - { - const wchar_t* s = L"12345678901234"; - std::basic_string s1{s, s+10, test_allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } - { - const char16_t* s = u"12345678901234"; - std::basic_string s1{s, s+10, min_allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } - { - const char32_t* s = U"12345678901234"; - std::basic_string s1{s, s+10, explicit_allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } -#endif -#endif } diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp similarity index 95% rename from test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp rename to test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 449b75d90..56a7d4e5b 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp new file mode 100644 index 000000000..49b1cff82 --- /dev/null +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -0,0 +1,82 @@ +//===----------------------------------------------------------------------===// +// +// 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, c++14 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 + +// template +// basic_string(InputIterator begin, InputIterator end, +// const Allocator& a = Allocator()); + +// template::value_type>> +// basic_string(InputIterator, InputIterator, Allocator = Allocator()) +// -> basic_string::value_type, +// char_traits::value_type>, +// Allocator>; +// +// The deduction guide shall not participate in overload resolution if InputIterator +// is a type that does not qualify as an input iterator, or if Allocator is a type +// that does not qualify as an allocator. + + +#include +#include +#include +#include + +#include "test_macros.h" +#include "test_allocator.h" +#include "../input_iterator.h" +#include "min_allocator.h" + +int main() +{ + { + const char* s = "12345678901234"; + std::basic_string s1{s, s+10, std::allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const wchar_t* s = L"12345678901234"; + std::basic_string s1{s, s+10, test_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char16_t* s = u"12345678901234"; + std::basic_string s1{s, s+10, min_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char32_t* s = U"12345678901234"; + std::basic_string s1{s, s+10, explicit_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } +} From 88ba9758ff0a24aa4d911ec31c8d83c62bdf50b6 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 17:06:08 +0000 Subject: [PATCH 008/176] Once more, with feeling. Spell 'clang-4.0' correctly this time git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324624 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 2 +- .../basic.string/string.cons/iter_alloc_deduction.pass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 56a7d4e5b..a8e440bac 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index 49b1cff82..3200a02bd 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 // template // basic_string(InputIterator begin, InputIterator end, From 5bfbd7daccd8e34a44c435379aaeab7568b583e8 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 19:33:03 +0000 Subject: [PATCH 009/176] The apple versions of clang don't support deduction guides yet. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324640 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 1 + .../basic.string/string.cons/iter_alloc_deduction.pass.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index a8e440bac..65aba0493 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -10,6 +10,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index 3200a02bd..a6c458c0e 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -10,6 +10,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 // template // basic_string(InputIterator begin, InputIterator end, From 9e6ac074eef0d9e96c578d1a08fbff12d5484203 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 10 Feb 2018 02:53:47 +0000 Subject: [PATCH 010/176] Use multi-key tree search for {map, set}::{count, equal_range} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch from ngolovliov@gmail.com Reviewed as: https://reviews.llvm.org/D42344 As described in llvm.org/PR30959, the current implementation of std::{map, key}::{count, equal_range} in libcxx is non-conforming. Quoting the C++14 standard [associative.reqmts]p3 > The phrase “equivalence of keys” means the equivalence relation imposed by > the comparison and not the operator== on keys. That is, two keys k1 and k2 are > considered to be equivalent if for the comparison object comp, > comp(k1, k2) == false && comp(k2, k1) == false. In the same section, the requirements table states the following: > a.equal_range(k) equivalent to make_pair(a.lower_bound(k), a.upper_bound(k)) > a.count(k) returns the number of elements with key equivalent to k The behaviour of libstdc++ seems to conform to the standard here. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324799 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/map | 6 +- include/set | 6 +- .../map/map.ops/count_transparent.pass.cpp | 50 ++++++++++++++++ .../map.ops/equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ .../multimap.ops/count_transparent.pass.cpp | 50 ++++++++++++++++ .../equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ .../multiset/count_transparent.pass.cpp | 51 ++++++++++++++++ .../multiset/equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ .../set/count_transparent.pass.cpp | 51 ++++++++++++++++ .../set/equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ 10 files changed, 448 insertions(+), 6 deletions(-) create mode 100644 test/std/containers/associative/map/map.ops/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp create mode 100644 test/std/containers/associative/multiset/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/multiset/equal_range_transparent.pass.cpp create mode 100644 test/std/containers/associative/set/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/set/equal_range_transparent.pass.cpp diff --git a/include/map b/include/map index 952149389..8a722606f 100644 --- a/include/map +++ b/include/map @@ -1228,7 +1228,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) const {return __tree_.__count_unique(__k);} + count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -1275,11 +1275,11 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif private: diff --git a/include/set b/include/set index a9d102f85..94db8c79d 100644 --- a/include/set +++ b/include/set @@ -668,7 +668,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) const {return __tree_.__count_unique(__k);} + count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -715,11 +715,11 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif }; diff --git a/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp b/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp new file mode 100644 index 000000000..899757e54 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class map + +// template +// size_type count(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::map, int, Comp> s{ + {{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..cce90c695 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class map + +// template +// pair equal_range(const K& x); // C++14 +// template +// pair equal_range(const K& x) const; +// // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::map, int, Comp> s{ + {{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first.first == 1); + nels++; + } + + assert(nels == 3); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp new file mode 100644 index 000000000..a1dbf806a --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class multimap + +// template +// size_type count(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multimap, int, Comp> s{ + {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..2b199d23c --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class multimap + +// template +// pair equal_range(const K& x); // C++14 +// template +// pair equal_range(const K& x) const; +// // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multimap, int, Comp> s{ + {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first.first == 1); + nels++; + } + + assert(nels == 3); +} diff --git a/test/std/containers/associative/multiset/count_transparent.pass.cpp b/test/std/containers/associative/multiset/count_transparent.pass.cpp new file mode 100644 index 000000000..9ef223345 --- /dev/null +++ b/test/std/containers/associative/multiset/count_transparent.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class multiset + +// template +// iterator lower_bound(const K& x); // C++14 +// template +// const_iterator lower_bound(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multiset, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp b/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..ffd87acfd --- /dev/null +++ b/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class multiset + +// template +// pair equal_range(const K& x); // +// C++14 +// template +// pair equal_range(const K& x) const; // +// C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multiset, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first == 1); + nels++; + } + + assert(nels == 3); +} diff --git a/test/std/containers/associative/set/count_transparent.pass.cpp b/test/std/containers/associative/set/count_transparent.pass.cpp new file mode 100644 index 000000000..26908eacd --- /dev/null +++ b/test/std/containers/associative/set/count_transparent.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class set + +// template +// iterator lower_bound(const K& x); // C++14 +// template +// const_iterator lower_bound(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/set/equal_range_transparent.pass.cpp b/test/std/containers/associative/set/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..88030847a --- /dev/null +++ b/test/std/containers/associative/set/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// class set + +// template +// pair equal_range(const K& x); // +// C++14 +// template +// pair equal_range(const K& x) const; // +// C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first == 1); + nels++; + } + + assert(nels == 3); +} From a8de0635685fd67ca740bb5f093bc9a23cae7263 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 11 Feb 2018 21:51:49 +0000 Subject: [PATCH 011/176] Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324851 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/utility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/utility b/include/utility index 535e3cb3a..f11d58019 100644 --- a/include/utility +++ b/include/utility @@ -52,7 +52,7 @@ template >::type move_if_noexcept(T& x) noexcept; // constexpr in C++14 -template constexpr add_const_t& as_const(T& t) noexcept; // C++17 +template constexpr add_const_t& as_const(T& t) noexcept; // C++17 template void as_const(const T&&) = delete; // C++17 template typename add_rvalue_reference::type declval() noexcept; From 0fc3d1264c6ae49b04718cce91c829cd4926b53d Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 11 Feb 2018 21:57:25 +0000 Subject: [PATCH 012/176] Mark two issues as complete git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324852 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 88d2d9d30..fa2b259ed 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -98,9 +98,9 @@ - + - +
Issue #Issue NameMeetingStatus
2412promise::set_value() and promise::get_future() should not raceJacksonvilleComplete
2682filesystem::copy() won't create a symlink to a directoryJacksonville
2682filesystem::copy() won't create a symlink to a directoryJacksonvilleComplete
2697[concurr.ts] Behavior of future/shared_future unwrapping constructor when given an invalid futureJacksonville
2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonville
2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonvilleComplete
2936Path comparison is defined in terms of the generic formatJacksonville
@@ -144,9 +144,9 @@

Comments about the "Review" issues

  • 2412 - I think we do this already
  • -
  • 2682 - Eric - don't we do this already?
  • +
  • 2682 - We already to this
  • 2697 - No concurrency TS implementation yet
  • -
  • 2708 - Eric?
  • +
  • 2708 - We already do this
  • 2936 - Eric - don't we do this already?
From 22a291c94e4994b35d6fb307796dfa4864690302 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 11 Feb 2018 22:00:19 +0000 Subject: [PATCH 013/176] Fix libcxx MSVC C++17 redefinition of 'align_val_t' Patch from charlieio@outlook.com Reviewed as https://reviews.llvm.org/D42354 When the following command is used: > clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib An error occurred: In file included from hello.cc:1: In file included from include\c++\v1\iostream:38: In file included from include\c++\v1\ios:216: In file included from include\c++\v1\__locale:15: In file included from include\c++\v1\string:477: In file included from include\c++\v1\string_view:176: In file included from include\c++\v1\__string:56: In file included from include\c++\v1\algorithm:643: In file included from include\c++\v1\memory:656: include\c++\v1\new(165,29): error: redefinition of 'align_val_t' enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; ^ C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16): note: previous definition is here enum class align_val_t : size_t {}; ^ 1 error generated. vcruntime_new.h has defined align_val_t, libcxx need hide align_val_t. This patch fixes that error. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324853 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/new | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/new b/include/new index 4e527501b..27c248c83 100644 --- a/include/new +++ b/include/new @@ -160,6 +160,7 @@ public: #endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) +#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME) #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14 #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; @@ -167,6 +168,7 @@ enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif +#endif } // std From 524afaedd1c1f7e172c9b04aa54326e03a801d99 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 11 Feb 2018 22:31:05 +0000 Subject: [PATCH 014/176] Add default C++ ABI libname and include paths for FreeBSD Summary: As noted in a discussion about testing the LLVM 6.0.0 release candidates (with libc++) for FreeBSD, many tests turned out to fail with "exception_ptr not yet implemented". This was because libc++ did not choose the correct C++ ABI library, and therefore it fell back to the `exception_fallback.ipp` header. Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library, and its headers have always been installed in /usr/include/c++/v1, together with the (system) libc++ headers. (Older versions of FreeBSD used GNU libsupc++ by default, but these are now unsupported.) Therefore, if we are building libc++ for FreeBSD, set: * `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt" * `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1" by default. Reviewers: emaste, EricWF, mclow.lists Reviewed By: EricWF Subscribers: mgorny, cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D43166 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324855 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b27db2c6..bfaed58ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,9 @@ if (LIBCXX_CXX_ABI STREQUAL "default") elseif (APPLE) set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_SYSTEM 1) + elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt") + set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1") else() set(LIBCXX_CXX_ABI_LIBNAME "default") endif() From b8cb776511a38502d1ab7b045155c76ca61beeaa Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 12 Feb 2018 15:41:25 +0000 Subject: [PATCH 015/176] While implementing P0777 - preventing unnecessary decay, I found some non-public uses of decay that could be replaced by __uncvref. NFC intented git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324895 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/functional | 8 ++++---- include/variant | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/experimental/functional b/include/experimental/functional index a136cbb57..f63dfb07b 100644 --- a/include/experimental/functional +++ b/include/experimental/functional @@ -241,8 +241,8 @@ public: operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { static_assert ( std::is_same< - typename std::decay::value_type>::type, - typename std::decay::value_type>::type + typename std::__uncvref::value_type>::type, + typename std::__uncvref::value_type>::type >::value, "Corpus and Pattern iterators must point to the same type" ); @@ -394,8 +394,8 @@ public: operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { static_assert ( std::is_same< - typename std::decay::value_type>::type, - typename std::decay::value_type>::type + typename std::__uncvref::value_type>::type, + typename std::__uncvref::value_type>::type >::value, "Corpus and Pattern iterators must point to the same type" ); diff --git a/include/variant b/include/variant index 63c7677c5..f9098f422 100644 --- a/include/variant +++ b/include/variant @@ -476,8 +476,8 @@ private: template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_farray(_Fs&&... __fs) { - __std_visit_visitor_return_type_check...>(); - using __result = array...>, sizeof...(_Fs)>; + __std_visit_visitor_return_type_check<__uncvref_t<_Fs>...>(); + using __result = array...>, sizeof...(_Fs)>; return __result{{_VSTD::forward<_Fs>(__fs)...}}; } @@ -514,8 +514,8 @@ private: template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal() { - constexpr size_t _Np = decay_t<_Vp>::__size(); - static_assert(__all<(_Np == decay_t<_Vs>::__size())...>::value); + constexpr size_t _Np = __uncvref_t<_Vp>::__size(); + static_assert(__all<(_Np == __uncvref_t<_Vs>::__size())...>::value); return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{}); } @@ -538,7 +538,7 @@ private: inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fmatrix() { return __make_fmatrix_impl<_Fp, _Vs...>( - index_sequence<>{}, make_index_sequence::__size()>{}...); + index_sequence<>{}, make_index_sequence<__uncvref_t<_Vs>::__size()>{}...); } }; @@ -756,7 +756,7 @@ _LIBCPP_VARIANT_DESTRUCTOR( if (!this->valueless_by_exception()) { __visitation::__base::__visit_alt( [](auto& __alt) noexcept { - using __alt_type = decay_t; + using __alt_type = __uncvref_t; __alt.~__alt_type(); }, *this); @@ -1564,7 +1564,7 @@ struct _LIBCPP_TEMPLATE_VIS hash< ? 299792458 // Random value chosen by the universe upon creation : __variant::__visit_alt( [](const auto& __alt) { - using __alt_type = decay_t; + using __alt_type = __uncvref_t; using __value_type = remove_const_t< typename __alt_type::__value_type>; return hash<__value_type>{}(__alt.__value); From f72f21907c21b0d17860a3ba07397f0f57e9983c Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 12 Feb 2018 17:26:40 +0000 Subject: [PATCH 016/176] Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324911 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/memory | 5 +++++ www/cxx1z_status.html | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/memory b/include/memory index 2d9d75f99..bc5c4c653 100644 --- a/include/memory +++ b/include/memory @@ -4805,8 +4805,13 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { +#if _LIBCPP_STD_VER <= 11 typedef typename common_type<_Tp*, _Up*>::type _Vp; return less<_Vp>()(__x.get(), __y.get()); +#else + return less<>()(__x.get(), __y.get()); +#endif + } template diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 84bfd2878..e4f624634 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -483,13 +483,13 @@ 2874Constructor shared_ptr::shared_ptr(Y*) should be constrainedKona 2875shared_ptr::shared_ptr(Y*, D, […]) constructors should be constrainedKona 2876shared_ptr::shared_ptr(const weak_ptr<Y>&) constructor should be constrainedKona - 2878Missing DefaultConstructible requirement for istream_iterator default constructorKona + 2878Missing DefaultConstructible requirement for istream_iterator default constructorKonaComplete 2890The definition of 'object state' applies only to class typesKonaComplete 2900The copy and move constructors of optional are not constexprKonaComplete 2903The form of initialization for the emplace-constructors is not specifiedKonaComplete 2904Make variant move-assignment more exception safeKonaComplete 2905is_constructible_v<unique_ptr<P, D>, P, D const &> should be false when D is not copy constructibleKonaComplete - 2908The less-than operator for shared pointers could do moreKona + 2908The less-than operator for shared pointers could do moreKonaComplete 2911An is_aggregate type trait is neededKonaComplete 2921packaged_task and type-erased allocatorsKonaComplete 2934optional<const T> doesn't compare with TKonaComplete @@ -504,7 +504,7 @@ -

Last Updated: 25-Jan-2018

+

Last Updated: 12-Feb-2018

From 806a6ec6450851e2964832c9e70358e4cddcd88d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 12 Feb 2018 19:13:24 +0000 Subject: [PATCH 017/176] Implement LWG 2835 - fix git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324923 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/tgmath.h | 16 ++++++++++++---- www/cxx1z_status.html | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/tgmath.h b/include/tgmath.h index fbe1e8248..aba87499c 100644 --- a/include/tgmath.h +++ b/include/tgmath.h @@ -14,16 +14,24 @@ /* tgmath.h synopsis -#include -#include +#include */ -#include -#include +#include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +#ifdef __cplusplus + +#include + +#else // __cplusplus + +#include_next + +#endif // __cplusplus + #endif // _LIBCPP_TGMATH_H diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index e4f624634..5cead9b1c 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -467,7 +467,7 @@ 2824list::sort should say that the order of elements is unspecified if an exception is thrownKonaComplete 2826string_view iterators use old wordingKonaComplete 2834Resolution LWG 2223 is missing wording about end iteratorsKonaComplete - 2835LWG 2536 seems to misspecify <tgmath.h>Kona + 2835LWG 2536 seems to misspecify <tgmath.h>KonaComplete 2837gcd and lcm should support a wider range of input valuesKonaComplete 2838is_literal_type specification needs a little cleanupKonaComplete 2842in_place_t check for optional::optional(U&&) should decay UKonaComplete From a2b7665eb2e8ad9469a63e29dac9ae546aafdb2f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 12 Feb 2018 22:54:35 +0000 Subject: [PATCH 018/176] [libcxx] [test] Strip trailing whitespace, NFC. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324959 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../alg.modifying.operations/alg.copy/copy.pass.cpp | 4 ++-- .../alg.copy/copy_backward.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.copy/copy_if.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.copy/copy_n.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.fill/fill.pass.cpp | 2 +- .../alg.modifying.operations/alg.fill/fill_n.pass.cpp | 2 +- .../alg.generate/generate.pass.cpp | 2 +- .../alg.generate/generate_n.pass.cpp | 2 +- .../alg.partitions/partition_copy.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.remove/remove.pass.cpp | 2 +- .../alg.remove/remove_copy.pass.cpp | 2 +- .../alg.remove/remove_copy_if.pass.cpp | 2 +- .../alg.remove/remove_if.pass.cpp | 2 +- .../alg.replace/replace_copy.pass.cpp | 2 +- .../alg.replace/replace_copy_if.pass.cpp | 2 +- .../alg.reverse/reverse_copy.pass.cpp | 2 +- .../alg.rotate/rotate_copy.pass.cpp | 4 ++-- .../alg.transform/binary_transform.pass.cpp | 6 +++--- .../alg.transform/unary_transform.pass.cpp | 2 +- .../alg.modifying.operations/alg.unique/unique.pass.cpp | 2 +- .../alg.nonmodifying/alg.find.end/find_end.pass.cpp | 2 +- .../alg.find.first.of/find_first_of.pass.cpp | 2 +- .../alg.nonmodifying/alg.foreach/for_each_n.pass.cpp | 2 +- .../alg.nonmodifying/mismatch/mismatch.pass.cpp | 6 +++--- .../alg.nonmodifying/mismatch/mismatch_pred.pass.cpp | 6 +++--- test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp | 2 +- .../algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp | 4 ++-- .../alg.set.operations/includes/includes.pass.cpp | 2 +- .../alg.set.operations/includes/includes_comp.pass.cpp | 2 +- .../set.intersection/set_intersection.pass.cpp | 2 +- .../set.intersection/set_intersection_comp.pass.cpp | 2 +- .../container.adaptors/queue/queue.defn/emplace.pass.cpp | 4 ++-- .../container.adaptors/stack/stack.defn/emplace.pass.cpp | 4 ++-- .../containers/sequences/list/list.ops/sort_comp.pass.cpp | 8 ++++---- test/std/strings/string.view/types.pass.cpp | 2 +- test/std/utilities/meta/meta.type.synop/endian.pass.cpp | 4 ++-- test/std/utilities/utility/exchange/exchange.pass.cpp | 4 ++-- 37 files changed, 57 insertions(+), 57 deletions(-) diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp index 7f75e011b..57aa11e56 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp @@ -23,11 +23,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 2, 3, 4, 5}; // int ic[] = {6, 6, 6, 6, 6, 6, 6}; -// +// // auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic)); // return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p) // && std::all_of(p, std::end(ic), [](int a){return a == 6;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp index 418535457..aaad25f70 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp @@ -25,12 +25,12 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 2, 3, 4, 5}; // int ic[] = {6, 6, 6, 6, 6, 6, 6}; -// +// // size_t N = std::size(ia); // auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N); // return std::equal(std::begin(ic), p, std::begin(ia)) // && std::all_of(p, std::end(ic), [](int a){return a == 6;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp index ae94ab433..2ec832546 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp @@ -25,11 +25,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {2, 4, 6, 8, 6}; // int ic[] = {0, 0, 0, 0, 0, 0}; -// +// // auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6); // return std::all_of(std::begin(ic), p, [](int a){return a == 6;}) // && std::all_of(p, std::end(ic), [](int a){return a == 0;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp index 24e5577b0..a268cd90f 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp @@ -24,11 +24,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 2, 3, 4, 5}; // int ic[] = {6, 6, 6, 6, 6, 6, 6}; -// +// // auto p = std::copy_n(std::begin(ia), 4, std::begin(ic)); // return std::equal(std::begin(ic), p, std::begin(ia)) // && std::all_of(p, std::end(ic), [](int a){return a == 6;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp index 8b9e109d7..1c08fee40 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp @@ -25,7 +25,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {0, 1, 2, 3, 4}; std::fill(std::begin(ia), std::end(ia), 5); - + return std::all_of(std::begin(ia), std::end(ia), [](int a) {return a == 5; }) ; } diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp index fea7165af..1e962990b 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp @@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() { const size_t N = 5; int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N - auto it = std::fill_n(std::begin(ib), N, 5); + auto it = std::fill_n(std::begin(ib), N, 5); return it == (std::begin(ib) + N) && std::all_of(std::begin(ib), it, [](int a) {return a == 5; }) && *it == 0 // don't overwrite the last value in the output array diff --git a/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp index 8be501c27..1b1562866 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp @@ -32,7 +32,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {0, 1, 2, 3, 4}; std::generate(std::begin(ia), std::end(ia), gen_test()); - + return std::all_of(std::begin(ia), std::end(ia), [](int x) { return x == 1; }) ; } diff --git a/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp index 98b7bea65..361324439 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp @@ -38,7 +38,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N auto it = std::generate_n(std::begin(ib), N, gen_test()); - + return it == (std::begin(ib) + N) && std::all_of(std::begin(ib), it, [](int x) { return x == 2; }) && *it == 0 // don't overwrite the last value in the output array diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp index 0fd24c1c3..9738fef35 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp @@ -32,8 +32,8 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 4, 6}; int r1[10] = {0}; int r2[10] = {0}; - - auto p = std::partition_copy(std::begin(ia), std::end(ia), + + auto p = std::partition_copy(std::begin(ia), std::end(ia), std::begin(r1), std::begin(r2), is_odd()); return std::all_of(std::begin(r1), p.first, is_odd()) 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 557984f39..70b3316d3 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 @@ -25,7 +25,7 @@ #if TEST_STD_VER > 17 TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; - + auto it = std::remove(std::begin(ia), std::end(ia), 5); return (std::begin(ia) + std::size(ia) - 2) == it // we removed two elements diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp index ae7b34184..4ace1494d 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp @@ -24,7 +24,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; int ib[std::size(ia)] = {0}; - + auto it = std::remove_copy(std::begin(ia), std::end(ia), std::begin(ib), 5); return std::distance(std::begin(ib), it) == (std::size(ia) - 2) // we removed two elements diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp index 111c59eb7..c13788690 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool equalToTwo(int v) { return v == 2; } TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; int ib[std::size(ia)] = {0}; - + auto it = std::remove_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo); return std::distance(std::begin(ib), it) == (std::size(ia) - 1) // we removed one element 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 d8123ee45..7a0f3405c 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 @@ -29,7 +29,7 @@ TEST_CONSTEXPR bool equal2 ( int i ) { return i == 2; } #if TEST_STD_VER > 17 TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; - + auto it = std::remove_if(std::begin(ia), std::end(ia), equal2); return (std::begin(ia) + std::size(ia) - 1) == it // we removed one element diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp index aad7f9f92..32be4e5bc 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp @@ -31,7 +31,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int expected[] = {0, 1, 5, 3, 4}; auto it = std::replace_copy(std::begin(ia), std::end(ia), std::begin(ib), 2, 5); - + return it == (std::begin(ib) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(ib), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp index 6ba74ff07..3d9a5bb73 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp @@ -34,7 +34,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int expected[] = {0, 1, 5, 3, 4}; auto it = std::replace_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo, 5); - + return it == (std::begin(ib) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(ib), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp index ec9aa9e94..e5aa427b9 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp @@ -23,7 +23,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; int ib[std::size(ia)] = {0}; - + auto it = std::reverse_copy(std::begin(ia), std::end(ia), std::begin(ib)); return std::distance(std::begin(ib), it) == std::size(ia) diff --git a/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp index 2294c79b5..e0e096a6f 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp @@ -23,11 +23,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 3, 5, 2, 5, 6}; // int ib[std::size(ia)] = {0}; -// +// // const size_t N = 2; // const auto middle = std::begin(ia) + N; // auto it = std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib)); -// +// // return std::distance(std::begin(ib), it) == std::size(ia) // && std::equal (std::begin(ia), middle, std::begin(ib) + std::size(ia) - N) // && std::equal (middle, std::end(ia), std::begin(ib)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp index 27d3a968a..b2b894912 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp @@ -28,10 +28,10 @@ TEST_CONSTEXPR bool test_constexpr() { const int ib[] = {2, 4, 7, 8}; int ic[] = {0, 0, 0, 0, 0}; // one bigger const int expected[] = {3, 7, 13, 15}; - - auto it = std::transform(std::begin(ia), std::end(ia), + + auto it = std::transform(std::begin(ia), std::end(ia), std::begin(ib), std::begin(ic), std::plus()); - + return it == (std::begin(ic) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(expected), std::end(expected), std::begin(ic), it) diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp index b6f9cbad0..a929291ad 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp @@ -32,7 +32,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int expected[] = {2, 4, 7, 8}; auto it = std::transform(std::begin(ia), std::end(ia), std::begin(ib), plusOne); - + return it == (std::begin(ib) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(ib), it, std::begin(expected), std::end(expected)) 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 1c25b4808..b61196c9d 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 @@ -27,7 +27,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {0, 1, 1, 3, 4}; const int expected[] = {0, 1, 3, 4}; const size_t N = 4; - + auto it = std::unique(std::begin(ia), std::end(ia)); return it == (std::begin(ia) + N) && std::equal(std::begin(ia), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp index bc5d50cd5..afcf27b55 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() { typedef forward_iterator FI; typedef bidirectional_iterator BI; typedef random_access_iterator RI; - + return (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+15)) && (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic))) && (std::find_end(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+15)) diff --git a/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp index bd9297490..2212285ae 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() { typedef forward_iterator FI; typedef bidirectional_iterator BI; typedef random_access_iterator RI; - + return (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+1)) && (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic))) && (std::find_first_of(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+1)) diff --git a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp index b2db22b1e..6c6824faf 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp @@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 6, 7}; int expected[] = {3, 5, 8, 9}; const size_t N = 4; - + auto it = std::for_each_n(std::begin(ia), N, [](int &a) { a += 2; }); return it == (std::begin(ia) + N) && std::equal(std::begin(ia), std::end(ia), std::begin(expected)) diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp index fd83cbcb4..4b5ddb191 100644 --- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp @@ -35,11 +35,11 @@ TEST_CONSTEXPR bool test_constexpr() { auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic)); if (p1.first != ia+2 || p1.second != ic+2) return false; - + auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic)); if (p2.first != ia+2 || p2.second != ic+2) return false; - + auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic)); if (p3.first != ib+2 || p3.second != ic+2) return false; @@ -55,7 +55,7 @@ TEST_CONSTEXPR bool test_constexpr() { if (p6.first != BI(ib+2) || p6.second != BI(ic+2)) return false; - return true; + return true; } #endif diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp index 490309a81..ed9ba055a 100644 --- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp @@ -40,11 +40,11 @@ TEST_CONSTEXPR bool test_constexpr() { auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), eq); if (p1.first != ia+2 || p1.second != ic+2) return false; - + auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), eq); if (p2.first != ia+2 || p2.second != ic+2) return false; - + auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic), eq); if (p3.first != ib+2 || p3.second != ic+2) return false; @@ -60,7 +60,7 @@ TEST_CONSTEXPR bool test_constexpr() { if (p6.first != BI(ib+2) || p6.second != BI(ic+2)) return false; - return true; + return true; } #endif diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp index 9f70428f9..a42936124 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp @@ -32,7 +32,7 @@ // int ib[] = {2, 4, 6, 8}; // int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8}; -// +// // auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(ic)); // return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib)) // && *it == 0 diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp index 3d2bbfb14..1506a8cd5 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp @@ -35,8 +35,8 @@ // int ib[] = {2, 4, 6, 8}; // int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8}; -// -// auto it = std::merge(std::begin(ia), std::end(ia), +// +// auto it = std::merge(std::begin(ia), std::end(ia), // std::begin(ib), std::end(ib), // std::begin(ic), [](int a, int b) {return a == b; }); // return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib)) diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp index 60a5d2bd7..ca1b42251 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp @@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; int ib[] = {2, 4}; int ic[] = {3, 3, 3, 3}; - + return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib)) && !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic)) ; diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp index 82cf043d3..06192f93b 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp @@ -27,7 +27,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; int ib[] = {2, 4}; int ic[] = {3, 3, 3, 3}; - + auto comp = [](int a, int b) {return a < b; }; return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), comp) && !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), comp) diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp index 96a1eae8d..8d18027ee 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp @@ -29,7 +29,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; const int ib[] = {2, 4, 4, 6}; int results[std::size(ia)] = {0}; - + auto it = std::set_intersection(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(results)); diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp index 75316921c..6b0cfe168 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp @@ -31,7 +31,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; const int ib[] = {2, 4, 4, 6}; int results[std::size(ia)] = {0}; - + auto comp = [](int a, int b) {return a < b; }; auto it = std::set_intersection(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(results), comp); diff --git a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp index e338c99fd..bcf5fb695 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp @@ -29,7 +29,7 @@ void test_return_type() { typedef typename Queue::container_type Container; typedef typename Container::value_type value_type; typedef decltype(std::declval().emplace(std::declval())) queue_return_type; - + #if TEST_STD_VER > 14 typedef decltype(std::declval().emplace_back(std::declval())) container_return_type; static_assert(std::is_same::value, ""); @@ -42,7 +42,7 @@ int main() { test_return_type > (); test_return_type > > (); - + typedef Emplaceable T; std::queue q; #if TEST_STD_VER > 14 diff --git a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp index 0fec47558..bb6ff8f91 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp @@ -28,7 +28,7 @@ void test_return_type() { typedef typename Stack::container_type Container; typedef typename Container::value_type value_type; typedef decltype(std::declval().emplace(std::declval())) stack_return_type; - + #if TEST_STD_VER > 14 typedef decltype(std::declval().emplace_back(std::declval())) container_return_type; static_assert(std::is_same::value, ""); @@ -43,7 +43,7 @@ int main() test_return_type > > (); typedef Emplaceable T; - std::stack q; + std::stack q; #if TEST_STD_VER > 14 T& r1 = q.emplace(1, 2.5); assert(&r1 == &q.top()); diff --git a/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp b/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp index c8966f6fc..33f2fab0d 100644 --- a/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp +++ b/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp @@ -24,18 +24,18 @@ template struct throwingLess { throwingLess() : num_(1) {} throwingLess(int num) : num_(num) {} - + bool operator() (const T& lhs, const T& rhs) const { if ( --num_ == 0) throw 1; return lhs < rhs; } - + mutable int num_; }; #endif - - + + int main() { { diff --git a/test/std/strings/string.view/types.pass.cpp b/test/std/strings/string.view/types.pass.cpp index 68bbc29b9..00f4d60ee 100644 --- a/test/std/strings/string.view/types.pass.cpp +++ b/test/std/strings/string.view/types.pass.cpp @@ -28,7 +28,7 @@ // using size_type = size_t; // using difference_type = ptrdiff_t; // static constexpr size_type npos = size_type(-1); -// +// // }; #include diff --git a/test/std/utilities/meta/meta.type.synop/endian.pass.cpp b/test/std/utilities/meta/meta.type.synop/endian.pass.cpp index c71229caf..cf0ab2d26 100644 --- a/test/std/utilities/meta/meta.type.synop/endian.pass.cpp +++ b/test/std/utilities/meta/meta.type.synop/endian.pass.cpp @@ -33,9 +33,9 @@ int main() { static_assert( std::endian::little != std::endian::big ); // Technically not required, but true on all existing machines - static_assert( std::endian::native == std::endian::little || + static_assert( std::endian::native == std::endian::little || std::endian::native == std::endian::big ); - + // Try to check at runtime { uint32_t i = 0x01020304; diff --git a/test/std/utilities/utility/exchange/exchange.pass.cpp b/test/std/utilities/utility/exchange/exchange.pass.cpp index 0e5de039d..1a5007ea4 100644 --- a/test/std/utilities/utility/exchange/exchange.pass.cpp +++ b/test/std/utilities/utility/exchange/exchange.pass.cpp @@ -25,13 +25,13 @@ #if TEST_STD_VER > 17 TEST_CONSTEXPR bool test_constexpr() { int v = 12; - + if (12 != std::exchange(v,23) || v != 23) return false; if (23 != std::exchange(v,static_cast(67)) || v != 67) return false; - + if (67 != std::exchange(v, {}) || v != 0) return false; return true; From e89a34f66a654ff47fbcce504237e05b01a1c1a5 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 13 Feb 2018 08:12:00 +0000 Subject: [PATCH 019/176] Fix typos. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43224 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324989 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/DesignDocs/AvailabilityMarkup.rst | 2 +- docs/DesignDocs/CapturingConfigInfo.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/DesignDocs/AvailabilityMarkup.rst b/docs/DesignDocs/AvailabilityMarkup.rst index 4a85c698f..b8b445097 100644 --- a/docs/DesignDocs/AvailabilityMarkup.rst +++ b/docs/DesignDocs/AvailabilityMarkup.rst @@ -58,7 +58,7 @@ Testing Some parameters can be passed to lit to run the test-suite and exercising the availability. -* The `platform` parameter controls the deployement target. For example lit can +* The `platform` parameter controls the deployment target. For example lit can be invoked with `--param=platform=macosx10.8`. Default is the current host. * The `use_system_cxx_lib` parameter indicates to use another library than the just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run diff --git a/docs/DesignDocs/CapturingConfigInfo.rst b/docs/DesignDocs/CapturingConfigInfo.rst index 73378a21c..88102251d 100644 --- a/docs/DesignDocs/CapturingConfigInfo.rst +++ b/docs/DesignDocs/CapturingConfigInfo.rst @@ -46,7 +46,7 @@ we do NOTHING. Otherwise we create a custom installation rule that modifies the installed __config header. The rule first generates a dummy "__config_site" header containing the required -#defines. The contents of the dummy header are then prependend to the installed +#defines. The contents of the dummy header are then prepended to the installed __config header. By manually prepending the files we avoid the cost of an extra #include and we allow the __config header to be ignorant of the extra configuration all together. An example "__config" header generated when From 52474820e4090e6f84c08d89e5bbe313708f972e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 13 Feb 2018 17:40:59 +0000 Subject: [PATCH 020/176] Put type attributes after class keyword Summary: Compiling `` in C++17 or higher mode results in: ``` functional:2500:1: warning: attribute '__visibility__' is ignored, place it after "class" to apply attribute to type declaration [-Wignored-attributes] _LIBCPP_TYPE_VIS ^ __config:701:46: note: expanded from macro '_LIBCPP_TYPE_VIS' # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) ^ 1 warning generated. ``` Fix it by putting the attribute after the `class` keyword. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43209 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325027 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/functional | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/functional b/include/functional index 69bcadae2..e45beb818 100644 --- a/include/functional +++ b/include/functional @@ -2497,8 +2497,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, // default searcher template> -_LIBCPP_TYPE_VIS -class default_searcher { +class _LIBCPP_TYPE_VIS default_searcher { public: _LIBCPP_INLINE_VISIBILITY default_searcher(_ForwardIterator __f, _ForwardIterator __l, From e64dcb66c05c35373c564502fe53a81a6584a4aa Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 13 Feb 2018 17:43:24 +0000 Subject: [PATCH 021/176] Make the ctype_byname::widen test cases pass on FreeBSD. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325028 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../category.ctype/locale.ctype.byname/widen_1.pass.cpp | 2 +- .../category.ctype/locale.ctype.byname/widen_many.pass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp index 8f51d12d7..1070fa613 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp @@ -55,7 +55,7 @@ int main() assert(f.widen('.') == L'.'); assert(f.widen('a') == L'a'); assert(f.widen('1') == L'1'); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) assert(f.widen(char(-5)) == L'\u00fb'); #else assert(f.widen(char(-5)) == wchar_t(-1)); diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp index 7a382c4df..9b841b28b 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp @@ -61,7 +61,7 @@ int main() assert(v[3] == L'.'); assert(v[4] == L'a'); assert(v[5] == L'1'); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) assert(v[6] == L'\x85'); #else assert(v[6] == wchar_t(-1)); From 26a02748ebf125e59271224de908cd9d13af8470 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 14 Feb 2018 00:29:38 +0000 Subject: [PATCH 022/176] Fix incorrect indentation. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43167 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325087 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ios | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ios b/include/ios index 0bffa571e..6e32d0fe6 100644 --- a/include/ios +++ b/include/ios @@ -670,7 +670,7 @@ protected: void set_rdbuf(basic_streambuf* __sb); private: basic_ostream* __tie_; - mutable int_type __fill_; + mutable int_type __fill_; }; template From 078dd9752d27dde7f4e05aa70d47ce5324dc9ac8 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 14 Feb 2018 18:05:25 +0000 Subject: [PATCH 023/176] Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325147 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../streambuf.put.area/pbump2gig.pass.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp index e7bdd897c..460e4c07e 100644 --- a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp +++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp @@ -32,12 +32,13 @@ int main() #ifndef TEST_HAS_NO_EXCEPTIONS try { #endif - std::string str(2147483648, 'a'); - SB sb; - sb.str(str); - assert(sb.pubpbase() <= sb.pubpptr()); + std::string str(2147483648, 'a'); + SB sb; + sb.str(str); + assert(sb.pubpbase() <= sb.pubpptr()); #ifndef TEST_HAS_NO_EXCEPTIONS - } - catch (const std::bad_alloc &) {} + } + catch (const std::length_error &) {} // maybe the string can't take 2GB + catch (const std::bad_alloc &) {} // maybe we don't have enough RAM #endif } From 6878e852d1d26cca0abee3013822311cd894ca3e Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 15 Feb 2018 02:41:19 +0000 Subject: [PATCH 024/176] Fix test failure on compilers w/o deduction guides git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325205 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.pass.cpp | 3 +-- utils/libcxx/test/config.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index a6c458c0e..b83275a57 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -9,8 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// XFAIL: libcpp-no-deduction-guides // template // basic_string(InputIterator begin, InputIterator end, diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 199ff3566..b9e2825db 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -463,7 +463,8 @@ class Configuration(object): if '__cpp_structured_bindings' not in macros: self.config.available_features.add('libcpp-no-structured-bindings') - if '__cpp_deduction_guides' not in macros: + if '__cpp_deduction_guides' not in macros or \ + int(macros['__cpp_deduction_guides']) < 201611: self.config.available_features.add('libcpp-no-deduction-guides') if self.is_windows: From c4658abe601d5af65ce835331ba6e31a5cd85367 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Mon, 19 Feb 2018 15:41:36 +0000 Subject: [PATCH 025/176] [libcxx] Improve accuracy of complex asinh and acosh Summary: Currently std::asinh and std::acosh use std::pow to compute x^2. This results in a significant error when computing e.g. asinh(i) or acosh(-1). This patch expresses x^2 directly via x.real() and x.imag(), like it is done in libstdc++/glibc, and adds tests that checks the accuracy. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D41629 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325510 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/complex | 17 +++- .../numerics/complex.number/__sqr.pass.cpp | 81 +++++++++++++++++++ .../complex.transcendentals/acosh.pass.cpp | 9 +++ .../complex.transcendentals/asinh.pass.cpp | 9 +++ 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 test/libcxx/numerics/complex.number/__sqr.pass.cpp diff --git a/include/complex b/include/complex index c7c1cdedf..d692ee319 100644 --- a/include/complex +++ b/include/complex @@ -1125,6 +1125,17 @@ pow(const _Tp& __x, const complex<_Up>& __y) return _VSTD::pow(result_type(__x), result_type(__y)); } +// __sqr, computes pow(x, 2) + +template +inline _LIBCPP_INLINE_VISIBILITY +complex<_Tp> +__sqr(const complex<_Tp>& __x) +{ + return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), + _Tp(2) * __x.real() * __x.imag()); +} + // asinh template @@ -1150,7 +1161,7 @@ asinh(const complex<_Tp>& __x) } if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag())); - complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1))); + complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1))); return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); } @@ -1184,7 +1195,7 @@ acosh(const complex<_Tp>& __x) } if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag())); - complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); + complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag())); } @@ -1318,7 +1329,7 @@ acos(const complex<_Tp>& __x) return complex<_Tp>(__pi/_Tp(2), -__x.imag()); if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag()))) return complex<_Tp>(__pi/_Tp(2), -__x.imag()); - complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); + complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); if (signbit(__x.imag())) return complex<_Tp>(abs(__z.imag()), abs(__z.real())); return complex<_Tp>(abs(__z.imag()), -abs(__z.real())); diff --git a/test/libcxx/numerics/complex.number/__sqr.pass.cpp b/test/libcxx/numerics/complex.number/__sqr.pass.cpp new file mode 100644 index 000000000..a3cc9dd38 --- /dev/null +++ b/test/libcxx/numerics/complex.number/__sqr.pass.cpp @@ -0,0 +1,81 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// complex +// __sqr(const complex& x); + +#include +#include + +template +void +test() +{ + const T tolerance = std::is_same::value ? 1.e-6 : 1.e-14; + + typedef std::complex cplx; + struct test_case + { + cplx value; + cplx expected; + }; + + const test_case cases[] = { + {cplx( 0, 0), cplx( 0, 0)}, + {cplx( 1, 0), cplx( 1, 0)}, + {cplx( 2, 0), cplx( 4, 0)}, + {cplx(-1, 0), cplx( 1, 0)}, + {cplx( 0, 1), cplx(-1, 0)}, + {cplx( 0, 2), cplx(-4, 0)}, + {cplx( 0, -1), cplx(-1, 0)}, + {cplx( 1, 1), cplx( 0, 2)}, + {cplx( 1, -1), cplx( 0, -2)}, + {cplx(-1, -1), cplx( 0, 2)}, + {cplx(0.5, 0), cplx(0.25, 0)}, + }; + + const unsigned num_cases = sizeof(cases) / sizeof(test_case); + for (unsigned i = 0; i < num_cases; ++i) + { + const test_case& test = cases[i]; + const std::complex actual = std::__sqr(test.value); + assert(std::abs(actual.real() - test.expected.real()) < tolerance); + assert(std::abs(actual.imag() - test.expected.imag()) < tolerance); + } + + const cplx nan1 = std::__sqr(cplx(NAN, 0)); + assert(std::isnan(nan1.real())); + assert(std::isnan(nan1.imag())); + + const cplx nan2 = std::__sqr(cplx(0, NAN)); + assert(std::isnan(nan2.real())); + assert(std::isnan(nan2.imag())); + + const cplx nan3 = std::__sqr(cplx(NAN, NAN)); + assert(std::isnan(nan3.real())); + assert(std::isnan(nan3.imag())); + + const cplx inf1 = std::__sqr(cplx(INFINITY, 0)); + assert(std::isinf(inf1.real())); + assert(inf1.real() > 0); + + const cplx inf2 = std::__sqr(cplx(0, INFINITY)); + assert(std::isinf(inf2.real())); + assert(inf2.real() < 0); +} + +int main() +{ + test(); + test(); + test(); +} diff --git a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp index deb056d67..5258bdc3a 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp @@ -54,6 +54,15 @@ void test_edges() assert(r.imag() == 0); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } + else if (testcases[i].real() == -1 && testcases[i].imag() == 0) + { + assert(r.real() == 0); + assert(!std::signbit(r.real())); + if (std::signbit(testcases[i].imag())) + is_about(r.imag(), -pi); + else + is_about(r.imag(), pi); + } else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag())) { assert(std::isinf(r.real())); diff --git a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp index 3da56c32f..cb9188d93 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp @@ -44,6 +44,15 @@ void test_edges() assert(std::signbit(r.real()) == std::signbit(testcases[i].real())); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } + else if (testcases[i].real() == 0 && std::abs(testcases[i].imag()) == 1) + { + assert(r.real() == 0); + assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag())); + if (std::signbit(testcases[i].imag())) + is_about(r.imag(), -pi/2); + else + is_about(r.imag(), pi/2); + } else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag())) { assert(std::isinf(r.real())); From 61494b519c2b31d52a2142f89de26579cacbb643 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 21 Feb 2018 21:36:18 +0000 Subject: [PATCH 026/176] libcxx: Unbreak external thread library configuration. Differential Revision: https://reviews.llvm.org/D42503 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325723 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__threading_support | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/include/__threading_support b/include/__threading_support index c20123d56..3c1eff22f 100644 --- a/include/__threading_support +++ b/include/__threading_support @@ -31,6 +31,14 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCPP_HAS_THREAD_API_WIN32) +#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS +#else +#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY +#endif + #if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(no_thread_safety_analysis) #define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) #else @@ -39,15 +47,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ - defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) - -#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS - -#elif defined(_LIBCPP_HAS_THREAD_API_PTHREAD) - -#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY - +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) // Mutex typedef pthread_mutex_t __libcpp_mutex_t; #define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER @@ -75,9 +75,6 @@ typedef pthread_key_t __libcpp_tls_key; #define _LIBCPP_TLS_DESTRUCTOR_CC #else - -#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS - // Mutex typedef void* __libcpp_mutex_t; #define _LIBCPP_MUTEX_INITIALIZER 0 From 2c893111fc11054a650e95886557939d5dab2f8b Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 22 Feb 2018 05:14:20 +0000 Subject: [PATCH 027/176] Add another test case to the deduction guide for basic_string. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325740 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.cons/iter_alloc_deduction.pass.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index b83275a57..815b5600d 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -39,6 +39,17 @@ int main() { + { + const char* s = "12345678901234"; + std::basic_string s1(s, s+10); // Can't use {} here + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { const char* s = "12345678901234"; std::basic_string s1{s, s+10, std::allocator{}}; From df7a35ce322c7ce6ae2f21aaa98e451a9537b821 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Thu, 22 Feb 2018 09:34:08 +0000 Subject: [PATCH 028/176] [libcxx] Do not include the C math.h header before __config Summary: Certain C libraries require configuration macros defined in __config to provide the correct functionality for libc++. This patch ensures that the C header math.h is always included after the __config header. It also adds a Windows-specific #if guard for the case when the C math.h file is included the second time, as suggested by Marshall in https://reviews.llvm.org/rL323490. Fixes PR36382. Reviewers: mclow.lists, EricWF Reviewed By: mclow.lists Subscribers: cfe-commits, pcc, christof, rogfer01 Differential Revision: https://reviews.llvm.org/D43579 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325760 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/math.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/include/math.h b/include/math.h index 147677235..cd055caef 100644 --- a/include/math.h +++ b/include/math.h @@ -8,16 +8,6 @@ // //===----------------------------------------------------------------------===// -// This include lives outside the header guard in order to support an MSVC -// extension which allows users to do: -// -// #define _USE_MATH_DEFINES -// #include -// -// and receive the definitions of mathematical constants, even if -// has previously been included. -#include_next - #ifndef _LIBCPP_MATH_H #define _LIBCPP_MATH_H @@ -308,6 +298,8 @@ long double truncl(long double x); #pragma GCC system_header #endif +#include_next + #ifdef __cplusplus // We support including .h headers inside 'extern "C"' contexts, so switch @@ -1494,4 +1486,18 @@ trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);} #endif // __cplusplus +#else // _LIBCPP_MATH_H + +// This include lives outside the header guard in order to support an MSVC +// extension which allows users to do: +// +// #define _USE_MATH_DEFINES +// #include +// +// and receive the definitions of mathematical constants, even if +// has previously been included. +#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) +#include_next +#endif + #endif // _LIBCPP_MATH_H From 9880456e8d4f83ee5ce512ce24f5479884591534 Mon Sep 17 00:00:00 2001 From: Alexander Richardson Date: Fri, 23 Feb 2018 15:19:48 +0000 Subject: [PATCH 029/176] Allow passing additional compiler/linker flags for the tests Summary: These flags can be specified using the CMake variables LIBCXX_TEST_LINKER_FLAGS and LIBCXX_TEST_COMPILER_FLAGS. When building the tests for CHERI I need to pass additional flags (such as -mabi=n64 or -mabi=purecap) to the compiler for our test configurations Reviewers: EricWF Reviewed By: EricWF Subscribers: christof, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D42139 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325914 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CMakeLists.txt | 5 +++++ test/lit.site.cfg.in | 3 +++ utils/libcxx/test/config.py | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6219e1857..45dc34ac2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,6 +9,11 @@ endmacro() set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING "Configuration variant to use for LIT.") +set(LIBCXX_TEST_LINKER_FLAGS "" CACHE STRING + "Additonal linker flags to pass when compiling the tests") +set(LIBCXX_TEST_COMPILER_FLAGS "" CACHE STRING + "Additonal linker flags to pass when compiling the tests") + # The tests shouldn't link to any ABI library when it has been linked into # libc++ statically or via a linker script. if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT) diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 4b746a135..53f797268 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -22,6 +22,9 @@ config.sysroot = "@LIBCXX_SYSROOT@" config.gcc_toolchain = "@LIBCXX_GCC_TOOLCHAIN@" config.generate_coverage = "@LIBCXX_GENERATE_COVERAGE@" config.target_info = "@LIBCXX_TARGET_INFO@" +config.test_linker_flags = "@LIBCXX_TEST_LINKER_FLAGS@" +config.test_compiler_flags = "@LIBCXX_TEST_COMPILER_FLAGS@" + config.executor = "@LIBCXX_EXECUTOR@" config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@" config.compiler_rt = "@LIBCXX_USE_COMPILER_RT@" diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index b9e2825db..2af4a473e 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -510,6 +510,9 @@ class Configuration(object): # and so that those tests don't have to be changed to tolerate # this insanity. self.cxx.compile_flags += ['-DNOMINMAX'] + additional_flags = self.get_lit_conf('test_compiler_flags') + if additional_flags: + self.cxx.compile_flags += shlex.split(additional_flags) def configure_default_compile_flags(self): # Try and get the std version from the command line. Fall back to @@ -794,6 +797,9 @@ class Configuration(object): self.use_system_cxx_lib] if self.is_windows and self.link_shared: self.add_path(self.cxx.compile_env, self.use_system_cxx_lib) + additional_flags = self.get_lit_conf('test_linker_flags') + if additional_flags: + self.cxx.link_flags += shlex.split(additional_flags) def configure_link_flags_abi_library_path(self): # Configure ABI library paths. From 7102892bf3dfffb3f988aa9a0a29f58171a508d7 Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Sat, 24 Feb 2018 07:57:32 +0000 Subject: [PATCH 030/176] Cleanup __config indention NFC This commit indents each level by two space characters, e.g. #if defined(CONDITION) # define _LIBCPP_NAME VALUE #else # define _LIBCPP_NAME VALUE #endif The simple #ifndef, #define, and #endif sequences are not indented, e.g. #ifndef _LIBCPP_NAME #define _LIBCPP_NAME ... #endif git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326027 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 854 ++++++++++++++++++++++++----------------------- 1 file changed, 433 insertions(+), 421 deletions(-) diff --git a/include/__config b/include/__config index cfe4ef08c..f96d74374 100644 --- a/include/__config +++ b/include/__config @@ -12,9 +12,9 @@ #define _LIBCPP_CONFIG #if defined(_MSC_VER) && !defined(__clang__) -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# endif #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -24,13 +24,13 @@ #ifdef __cplusplus #ifdef __GNUC__ -#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +# define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) // The _GNUC_VER_NEW macro better represents the new GCC versioning scheme // introduced in GCC 5.0. -#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) +# define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) #else -#define _GNUC_VER 0 -#define _GNUC_VER_NEW 0 +# define _GNUC_VER 0 +# define _GNUC_VER_NEW 0 #endif #define _LIBCPP_VERSION 7000 @@ -40,63 +40,63 @@ #endif #if defined(__ELF__) -#define _LIBCPP_OBJECT_FORMAT_ELF 1 +# define _LIBCPP_OBJECT_FORMAT_ELF 1 #elif defined(__MACH__) -#define _LIBCPP_OBJECT_FORMAT_MACHO 1 +# define _LIBCPP_OBJECT_FORMAT_MACHO 1 #elif defined(_WIN32) -#define _LIBCPP_OBJECT_FORMAT_COFF 1 +# define _LIBCPP_OBJECT_FORMAT_COFF 1 #elif defined(__wasm__) -#define _LIBCPP_OBJECT_FORMAT_WASM 1 +# define _LIBCPP_OBJECT_FORMAT_WASM 1 #else -#error Unknown object file format +# error Unknown object file format #endif #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. -#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. -#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. -#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. -#define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. -#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB -#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB -#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE +# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr // provided under the alternate keyword __nullptr, which changes the mangling // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. -#define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR +# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR // Define the `pointer_safety` enum as a C++11 strongly typed enumeration // instead of as a class simulating an enum. If this option is enabled // `pointer_safety` and `get_pointer_safety()` will no longer be available // in C++03. -#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE +# define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION // Enable optimized version of __do_get_(un)signed which avoids redundant copies. -#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusivly. -#define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION #elif _LIBCPP_ABI_VERSION == 1 -#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition // of inline functions to be emitted anyway. Our own non-inline copy would // conflict with the dllexport-emitted copy, so we disable it. -#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS -#endif +# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS +# endif // Feature macros for disabling pre ABI v1 features. All of these options // are deprecated. -#if defined(__FreeBSD__) -#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR -#endif +# if defined(__FreeBSD__) +# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# endif #endif #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR @@ -116,23 +116,29 @@ #ifndef __has_attribute #define __has_attribute(__x) 0 #endif + #ifndef __has_builtin #define __has_builtin(__x) 0 #endif + #ifndef __has_extension #define __has_extension(__x) 0 #endif + #ifndef __has_feature #define __has_feature(__x) 0 #endif + #ifndef __has_cpp_attribute #define __has_cpp_attribute(__x) 0 #endif + // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. #ifndef __is_identifier #define __is_identifier(__x) 1 #endif + #ifndef __has_declspec_attribute #define __has_declspec_attribute(__x) 0 #endif @@ -140,22 +146,22 @@ #define __has_keyword(__x) !(__is_identifier(__x)) #ifdef __has_include -#define __libcpp_has_include(__x) __has_include(__x) +# define __libcpp_has_include(__x) __has_include(__x) #else -#define __libcpp_has_include(__x) 0 +# define __libcpp_has_include(__x) 0 #endif #if defined(__clang__) -#define _LIBCPP_COMPILER_CLANG -# ifndef __apple_build_version__ -# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) -# endif +# define _LIBCPP_COMPILER_CLANG +# ifndef __apple_build_version__ +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +# endif #elif defined(__GNUC__) -#define _LIBCPP_COMPILER_GCC +# define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) -#define _LIBCPP_COMPILER_MSVC +# define _LIBCPP_COMPILER_MSVC #elif defined(__IBMCPP__) -#define _LIBCPP_COMPILER_IBM +# define _LIBCPP_COMPILER_IBM #endif #ifndef _LIBCPP_CLANG_VER @@ -168,69 +174,69 @@ // and allow the user to explicitly specify the ABI to handle cases where this // heuristic falls short. #if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" +# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" #elif defined(_LIBCPP_ABI_FORCE_ITANIUM) -# define _LIBCPP_ABI_ITANIUM -#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# define _LIBCPP_ABI_MICROSOFT -#else -# if defined(_WIN32) && defined(_MSC_VER) -# define _LIBCPP_ABI_MICROSOFT -# else # define _LIBCPP_ABI_ITANIUM -# endif +#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# define _LIBCPP_ABI_MICROSOFT +#else +# if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +# else +# define _LIBCPP_ABI_ITANIUM +# endif #endif // Need to detect which libc we're using if we're on Linux. #if defined(__linux__) -#include -#if defined(__GLIBC_PREREQ) -#define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) -#else -#define _LIBCPP_GLIBC_PREREQ(a, b) 0 -#endif // defined(__GLIBC_PREREQ) +# include +# if defined(__GLIBC_PREREQ) +# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) +# else +# define _LIBCPP_GLIBC_PREREQ(a, b) 0 +# endif // defined(__GLIBC_PREREQ) #endif // defined(__linux__) #ifdef __LITTLE_ENDIAN__ -#if __LITTLE_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN -#endif // __LITTLE_ENDIAN__ +# if __LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# endif // __LITTLE_ENDIAN__ #endif // __LITTLE_ENDIAN__ #ifdef __BIG_ENDIAN__ -#if __BIG_ENDIAN__ -#define _LIBCPP_BIG_ENDIAN -#endif // __BIG_ENDIAN__ +# if __BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BIG_ENDIAN__ #endif // __BIG_ENDIAN__ #ifdef __BYTE_ORDER__ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN -#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#define _LIBCPP_BIG_ENDIAN -#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #endif // __BYTE_ORDER__ #ifdef __FreeBSD__ -# include +# include # if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -# ifndef __LONG_LONG_SUPPORTED -# define _LIBCPP_HAS_NO_LONG_LONG -# endif // __LONG_LONG_SUPPORTED +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# ifndef __LONG_LONG_SUPPORTED +# define _LIBCPP_HAS_NO_LONG_LONG +# endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ #ifdef __NetBSD__ -# include +# include # if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_HAS_QUICK_EXIT #endif // __NetBSD__ #if defined(_WIN32) @@ -248,64 +254,64 @@ # define _LIBCPP_HAS_BITSCAN64 # endif # define _LIBCPP_HAS_OPEN_WITH_WCHAR -# if defined(_LIBCPP_MSVCRT) -# define _LIBCPP_HAS_QUICK_EXIT -# endif +# if defined(_LIBCPP_MSVCRT) +# define _LIBCPP_HAS_QUICK_EXIT +# endif // Some CRT APIs are unavailable to store apps -#if defined(WINAPI_FAMILY) -#include -#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ - (!defined(WINAPI_PARTITION_SYSTEM) || \ - !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) -#define _LIBCPP_WINDOWS_STORE_APP -#endif -#endif +# if defined(WINAPI_FAMILY) +# include +# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ + (!defined(WINAPI_PARTITION_SYSTEM) || \ + !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) +# define _LIBCPP_WINDOWS_STORE_APP +# endif +# endif #endif // defined(_WIN32) #ifdef __sun__ -# include -# ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else -# define _LIBCPP_BIG_ENDIAN -# endif +# include +# ifdef _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else +# define _LIBCPP_BIG_ENDIAN +# endif #endif // __sun__ #if defined(__CloudABI__) - // Certain architectures provide arc4random(). Prefer using - // arc4random() over /dev/{u,}random to make it possible to obtain - // random data even when using sandboxing mechanisms such as chroots, - // Capsicum, etc. -# define _LIBCPP_USING_ARC4_RANDOM + // Certain architectures provide arc4random(). Prefer using + // arc4random() over /dev/{u,}random to make it possible to obtain + // random data even when using sandboxing mechanisms such as chroots, + // Capsicum, etc. +# define _LIBCPP_USING_ARC4_RANDOM #elif defined(__Fuchsia__) -# define _LIBCPP_USING_GETENTROPY +# define _LIBCPP_USING_GETENTROPY #elif defined(__native_client__) - // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, - // including accesses to the special files under /dev. C++11's - // std::random_device is instead exposed through a NaCl syscall. -# define _LIBCPP_USING_NACL_RANDOM + // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, + // including accesses to the special files under /dev. C++11's + // std::random_device is instead exposed through a NaCl syscall. +# define _LIBCPP_USING_NACL_RANDOM #elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_USING_WIN32_RANDOM +# define _LIBCPP_USING_WIN32_RANDOM #else -# define _LIBCPP_USING_DEV_RANDOM +# define _LIBCPP_USING_DEV_RANDOM #endif #if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -# include -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER == __BIG_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# else // __BYTE_ORDER == __BIG_ENDIAN -# error unable to determine endian -# endif +# include +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# else // __BYTE_ORDER == __BIG_ENDIAN +# error unable to determine endian +# endif #endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) -#define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) +# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) #else -#define _LIBCPP_NO_CFI +# define _LIBCPP_NO_CFI #endif #if defined(_LIBCPP_COMPILER_CLANG) @@ -358,11 +364,11 @@ typedef __char32_t char32_t; #endif #if !(__has_feature(cxx_nullptr)) -# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) -# define nullptr __nullptr -# else -# define _LIBCPP_HAS_NO_NULLPTR -# endif +# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) +# define nullptr __nullptr +# else +# define _LIBCPP_HAS_NO_NULLPTR +# endif #endif #if !(__has_feature(cxx_rvalue_references)) @@ -382,11 +388,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(is_base_of) -# define _LIBCPP_HAS_IS_BASE_OF +#define _LIBCPP_HAS_IS_BASE_OF #endif #if __has_feature(is_final) -# define _LIBCPP_HAS_IS_FINAL +#define _LIBCPP_HAS_IS_FINAL #endif // Objective-C++ features (opt-in) @@ -411,25 +417,25 @@ typedef __char32_t char32_t; #endif #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L -#if defined(__FreeBSD__) -#define _LIBCPP_HAS_QUICK_EXIT -#define _LIBCPP_HAS_C11_FEATURES -#elif defined(__Fuchsia__) -#define _LIBCPP_HAS_QUICK_EXIT -#define _LIBCPP_HAS_C11_FEATURES -#elif defined(__linux__) -#if !defined(_LIBCPP_HAS_MUSL_LIBC) -#if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -#define _LIBCPP_HAS_QUICK_EXIT -#endif -#if _LIBCPP_GLIBC_PREREQ(2, 17) -#define _LIBCPP_HAS_C11_FEATURES -#endif -#else // defined(_LIBCPP_HAS_MUSL_LIBC) -#define _LIBCPP_HAS_QUICK_EXIT -#define _LIBCPP_HAS_C11_FEATURES -#endif -#endif // __linux__ +# if defined(__FreeBSD__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__Fuchsia__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__linux__) +# if !defined(_LIBCPP_HAS_MUSL_LIBC) +# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) +# define _LIBCPP_HAS_QUICK_EXIT +# endif +# if _LIBCPP_GLIBC_PREREQ(2, 17) +# define _LIBCPP_HAS_C11_FEATURES +# endif +# else // defined(_LIBCPP_HAS_MUSL_LIBC) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# endif +# endif // __linux__ #endif #if !(__has_feature(cxx_noexcept)) @@ -437,11 +443,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(underlying_type) -# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #endif #if __has_feature(is_literal) -# define _LIBCPP_IS_LITERAL(T) __is_literal(T) +#define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif // Inline namespaces are available in Clang regardless of C++ dialect. @@ -461,7 +467,7 @@ namespace std { // Allow for build-time disabling of unsigned integer sanitization #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize) #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) -#endif +#endif #if __has_builtin(__builtin_launder) #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER @@ -485,7 +491,7 @@ namespace std { #endif #if defined(__GNUC__) && _GNUC_VER >= 403 -# define _LIBCPP_HAS_IS_BASE_OF +#define _LIBCPP_HAS_IS_BASE_OF #endif #if !__EXCEPTIONS @@ -494,10 +500,10 @@ namespace std { // constexpr was added to GCC in 4.6. #if _GNUC_VER < 406 -#define _LIBCPP_HAS_NO_CONSTEXPR +# define _LIBCPP_HAS_NO_CONSTEXPR // Can only use constexpr in c++11 mode. #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L -#define _LIBCPP_HAS_NO_CONSTEXPR +# define _LIBCPP_HAS_NO_CONSTEXPR #endif // Determine if GCC supports relaxed constexpr @@ -511,6 +517,7 @@ namespace std { #endif #ifndef __GXX_EXPERIMENTAL_CXX0X__ + #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS @@ -589,10 +596,11 @@ namespace std { #define _LIBCPP_END_NAMESPACE_STD } #define _VSTD std -# define _LIBCPP_WEAK namespace std { } +#define _LIBCPP_WEAK + #define _LIBCPP_HAS_NO_ASAN #elif defined(_LIBCPP_COMPILER_IBM) @@ -628,27 +636,28 @@ namespace std { #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] #if defined(_LIBCPP_OBJECT_FORMAT_COFF) + #ifdef _DLL -# define _LIBCPP_CRT_FUNC __declspec(dllimport) +# define _LIBCPP_CRT_FUNC __declspec(dllimport) #else -# define _LIBCPP_CRT_FUNC +# define _LIBCPP_CRT_FUNC #endif #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_DLL_VIS -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_DLL_VIS +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS #elif defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_DLL_VIS __declspec(dllexport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_DLL_VIS __declspec(dllexport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS #else -# define _LIBCPP_DLL_VIS __declspec(dllimport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_DLL_VIS __declspec(dllimport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS #endif #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS @@ -661,39 +670,40 @@ namespace std { #define _LIBCPP_ENUM_VIS #if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_INLINE_VISIBILITY __forceinline -# define _LIBCPP_ALWAYS_INLINE __forceinline -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline +# define _LIBCPP_INLINE_VISIBILITY __forceinline +# define _LIBCPP_ALWAYS_INLINE __forceinline +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline #else -# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) -# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) #endif + #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifndef _LIBCPP_HIDDEN -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) -#else -#define _LIBCPP_HIDDEN -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) +# else +# define _LIBCPP_HIDDEN +# endif #endif #ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) // The inline should be removed once PR32114 is resolved -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN -#else -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#endif +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN +# else +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# endif #endif #ifndef _LIBCPP_FUNC_VIS -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) -#else -#define _LIBCPP_FUNC_VIS -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) +# else +# define _LIBCPP_FUNC_VIS +# endif #endif #ifndef _LIBCPP_TYPE_VIS @@ -717,19 +727,19 @@ namespace std { #endif #ifndef _LIBCPP_EXTERN_VIS -# define _LIBCPP_EXTERN_VIS +#define _LIBCPP_EXTERN_VIS #endif #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS +#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS #endif #ifndef _LIBCPP_EXCEPTION_ABI -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) -#else -#define _LIBCPP_EXCEPTION_ABI -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +# else +# define _LIBCPP_EXCEPTION_ABI +# endif #endif #ifndef _LIBCPP_ENUM_VIS @@ -749,31 +759,31 @@ namespace std { #endif #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS #endif #ifndef _LIBCPP_INLINE_VISIBILITY -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) -#else -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +# else +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# endif #endif #ifndef _LIBCPP_ALWAYS_INLINE -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) -#else -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) +# else +# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) -# else -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) -# endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +# else +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) +# endif #endif #ifndef _LIBCPP_PREFERRED_OVERLOAD @@ -791,19 +801,19 @@ namespace std { #endif #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS) -# if !defined(_LIBCPP_DEBUG) -# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined -# endif -# ifdef _LIBCPP_HAS_NO_NOEXCEPT -# define _NOEXCEPT_DEBUG -# define _NOEXCEPT_DEBUG_(x) -# else -# define _NOEXCEPT_DEBUG noexcept(false) -# define _NOEXCEPT_DEBUG_(x) noexcept(false) -#endif +# if !defined(_LIBCPP_DEBUG) +# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined +# endif +# ifdef _LIBCPP_HAS_NO_NOEXCEPT +# define _NOEXCEPT_DEBUG +# define _NOEXCEPT_DEBUG_(x) +# else +# define _NOEXCEPT_DEBUG noexcept(false) +# define _NOEXCEPT_DEBUG_(x) noexcept(false) +# endif #else -# define _NOEXCEPT_DEBUG _NOEXCEPT -# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) +# define _NOEXCEPT_DEBUG _NOEXCEPT +# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) #endif #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS @@ -816,88 +826,88 @@ typedef unsigned int char32_t; #endif #ifdef _LIBCPP_CXX03_LANG -# if __has_extension(c_static_assert) -# define static_assert(__b, __m) _Static_assert(__b, __m) -# else +# if __has_extension(c_static_assert) +# define static_assert(__b, __m) _Static_assert(__b, __m) +# else extern "C++" { template struct __static_assert_test; template <> struct __static_assert_test {}; template struct __static_assert_check {}; } -#define static_assert(__b, __m) \ - typedef __static_assert_check)> \ - _LIBCPP_CONCAT(__t, __LINE__) -# endif // __has_extension(c_static_assert) +# define static_assert(__b, __m) \ + typedef __static_assert_check)> \ + _LIBCPP_CONCAT(__t, __LINE__) +# endif // __has_extension(c_static_assert) #endif // _LIBCPP_CXX03_LANG #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. -#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 -# define decltype(__x) __decltype(__x) -#else -# define decltype(__x) __typeof__(__x) -#endif +# if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 +# define decltype(__x) __decltype(__x) +# else +# define decltype(__x) __typeof__(__x) +# endif #endif #ifdef _LIBCPP_HAS_NO_CONSTEXPR -#define _LIBCPP_CONSTEXPR +# define _LIBCPP_CONSTEXPR #else -#define _LIBCPP_CONSTEXPR constexpr +# define _LIBCPP_CONSTEXPR constexpr #endif #ifdef _LIBCPP_CXX03_LANG -#define _LIBCPP_DEFAULT {} +# define _LIBCPP_DEFAULT {} #else -#define _LIBCPP_DEFAULT = default; +# define _LIBCPP_DEFAULT = default; #endif #ifdef _LIBCPP_CXX03_LANG -#define _LIBCPP_EQUAL_DELETE +# define _LIBCPP_EQUAL_DELETE #else -#define _LIBCPP_EQUAL_DELETE = delete +# define _LIBCPP_EQUAL_DELETE = delete #endif #ifdef __GNUC__ -#define _NOALIAS __attribute__((__malloc__)) +# define _NOALIAS __attribute__((__malloc__)) #else -#define _NOALIAS +# define _NOALIAS #endif #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \ (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions -# define _LIBCPP_EXPLICIT explicit +# define _LIBCPP_EXPLICIT explicit #else -# define _LIBCPP_EXPLICIT +# define _LIBCPP_EXPLICIT #endif #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) -# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE +#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE #endif #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS -#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx -#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ - __lx __v_; \ - _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ - _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ - _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ - }; +# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ + _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ + }; #else // _LIBCPP_HAS_NO_STRONG_ENUMS -#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x -#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) #endif // _LIBCPP_HAS_NO_STRONG_ENUMS #ifdef _LIBCPP_DEBUG -# if _LIBCPP_DEBUG == 0 -# define _LIBCPP_DEBUG_LEVEL 1 -# elif _LIBCPP_DEBUG == 1 -# define _LIBCPP_DEBUG_LEVEL 2 -# else -# error Supported values for _LIBCPP_DEBUG are 0 and 1 -# endif -# if !defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_EXTERN_TEMPLATE(...) -# endif +# if _LIBCPP_DEBUG == 0 +# define _LIBCPP_DEBUG_LEVEL 1 +# elif _LIBCPP_DEBUG == 1 +# define _LIBCPP_DEBUG_LEVEL 2 +# else +# error Supported values for _LIBCPP_DEBUG are 0 and 1 +# endif +# if !defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_EXTERN_TEMPLATE(...) +# endif #endif #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE @@ -924,9 +934,9 @@ template struct __static_assert_check {}; #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) // Most unix variants have catopen. These are the specific ones that don't. -#if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) -#define _LIBCPP_HAS_CATOPEN 1 -#endif +# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) +# define _LIBCPP_HAS_CATOPEN 1 +# endif #endif #ifdef __FreeBSD__ @@ -934,15 +944,15 @@ template struct __static_assert_check {}; #endif #if defined(__APPLE__) -# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ - defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -# endif -# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -# endif -# endif +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# endif +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif +# endif #endif // defined(__APPLE__) #if defined(__APPLE__) || defined(__FreeBSD__) @@ -966,47 +976,47 @@ template struct __static_assert_check {}; #endif // _LIBCPP_STD_VER #if _LIBCPP_STD_VER > 11 -#define _LIBCPP_DEPRECATED [[deprecated]] +# define _LIBCPP_DEPRECATED [[deprecated]] #else -#define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED #endif #if _LIBCPP_STD_VER <= 11 -#define _LIBCPP_EXPLICIT_AFTER_CXX11 -#define _LIBCPP_DEPRECATED_AFTER_CXX11 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 +# define _LIBCPP_DEPRECATED_AFTER_CXX11 #else -#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit -#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] +# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit +# define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] #endif #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr +# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX11 +# define _LIBCPP_CONSTEXPR_AFTER_CXX11 #endif #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -#define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr +# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX14 +# define _LIBCPP_CONSTEXPR_AFTER_CXX14 #endif #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -#define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr +# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX17 +# define _LIBCPP_CONSTEXPR_AFTER_CXX17 #endif #if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) -#define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] +# define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] #else -#define _LIBCPP_NODISCARD_AFTER_CXX17 +# define _LIBCPP_NODISCARD_AFTER_CXX17 #endif #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) -# define _LIBCPP_INLINE_VAR inline +# define _LIBCPP_INLINE_VAR inline #else -# define _LIBCPP_INLINE_VAR +# define _LIBCPP_INLINE_VAR #endif #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1024,8 +1034,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // g++ and cl.exe have RTTI on by default and define a macro when it is. // g++ only defines the macro in 4.3.2 and onwards. #if !defined(_LIBCPP_NO_RTTI) -# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ - (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) +# if defined(__GNUC__) && \ + ((__GNUC__ >= 5) || \ + (__GNUC__ == 4 && (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && \ + !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI # elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) # define _LIBCPP_NO_RTTI @@ -1033,7 +1045,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #ifndef _LIBCPP_WEAK -# define _LIBCPP_WEAK __attribute__((__weak__)) +#define _LIBCPP_WEAK __attribute__((__weak__)) #endif // Thread API @@ -1041,35 +1053,35 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# if defined(__FreeBSD__) || \ - defined(__Fuchsia__) || \ - defined(__NetBSD__) || \ - defined(__linux__) || \ - defined(__APPLE__) || \ - defined(__CloudABI__) || \ - defined(__sun__) || \ - (defined(__MINGW32__) && __libcpp_has_include()) -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_HAS_THREAD_API_WIN32 -# else -# error "No thread API" -# endif // _LIBCPP_HAS_THREAD_API +# if defined(__FreeBSD__) || \ + defined(__Fuchsia__) || \ + defined(__NetBSD__) || \ + defined(__linux__) || \ + defined(__APPLE__) || \ + defined(__CloudABI__) || \ + defined(__sun__) || \ + (defined(__MINGW32__) && __libcpp_has_include()) +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_HAS_THREAD_API_WIN32 +# else +# error "No thread API" +# endif // _LIBCPP_HAS_THREAD_API #endif // _LIBCPP_HAS_NO_THREADS #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ - _LIBCPP_HAS_NO_THREADS is not defined. +#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ + _LIBCPP_HAS_NO_THREADS is not defined. #endif #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ - _LIBCPP_HAS_NO_THREADS is defined. +#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ + _LIBCPP_HAS_NO_THREADS is defined. #endif #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) -# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ - _LIBCPP_HAS_NO_THREADS is defined. +#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ + _LIBCPP_HAS_NO_THREADS is defined. #endif // Systems that use capability-based security (FreeBSD with Capsicum, @@ -1099,9 +1111,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) -#define _LIBCPP_HAS_C_ATOMIC_IMP +# define _LIBCPP_HAS_C_ATOMIC_IMP #elif _GNUC_VER > 407 -#define _LIBCPP_HAS_GCC_ATOMIC_IMP +# define _LIBCPP_HAS_GCC_ATOMIC_IMP #endif #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ @@ -1114,73 +1126,73 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) -#if defined(__clang__) && __has_attribute(acquire_capability) +# if defined(__clang__) && __has_attribute(acquire_capability) // Work around the attribute handling in clang. When both __declspec and // __attribute__ are present, the processing goes awry preventing the definition // of the types. -#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) -#define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS -#endif -#endif +# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# endif +# endif #endif #if __has_attribute(require_constant_initialization) -#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) +# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) #else -#define _LIBCPP_SAFE_STATIC +# define _LIBCPP_SAFE_STATIC #endif #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 -# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF +#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) -#if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION) -#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS -#endif +# if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION) +# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS +# endif #endif #if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) -# define _LIBCPP_DIAGNOSE_WARNING(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "warning"))) -# define _LIBCPP_DIAGNOSE_ERROR(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "error"))) +# define _LIBCPP_DIAGNOSE_WARNING(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "warning"))) +# define _LIBCPP_DIAGNOSE_ERROR(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "error"))) #else -# define _LIBCPP_DIAGNOSE_WARNING(...) -# define _LIBCPP_DIAGNOSE_ERROR(...) +# define _LIBCPP_DIAGNOSE_WARNING(...) +# define _LIBCPP_DIAGNOSE_ERROR(...) #endif #if __has_attribute(fallthough) || _GNUC_VER >= 700 // Use a function like macro to imply that it must be followed by a semicolon -#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) +# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) #else -#define _LIBCPP_FALLTHROUGH() ((void)0) +# define _LIBCPP_FALLTHROUGH() ((void)0) #endif #if defined(_LIBCPP_ABI_MICROSOFT) && \ - (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) -# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) + (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) +# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) #else -# define _LIBCPP_DECLSPEC_EMPTY_BASES +# define _LIBCPP_DECLSPEC_EMPTY_BASES #endif #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) -# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR +#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 -# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES +#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES #endif #if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) -# define _LIBCPP_HAS_NO_IS_AGGREGATE +#define _LIBCPP_HAS_NO_IS_AGGREGATE #endif #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L -# define _LIBCPP_HAS_NO_COROUTINES +#define _LIBCPP_HAS_NO_COROUTINES #endif // Decide whether to use availability macros. @@ -1188,65 +1200,65 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ __has_feature(attribute_availability_with_strict) && \ __has_feature(attribute_availability_in_templates) -#ifdef __APPLE__ -#define _LIBCPP_USE_AVAILABILITY_APPLE -#endif +# ifdef __APPLE__ +# define _LIBCPP_USE_AVAILABILITY_APPLE +# endif #endif // Define availability macros. #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) -#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ - __attribute__((availability(ios,strict,introduced=6.0))) -#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ + __attribute__((availability(ios,strict,introduced=6.0))) +# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) #else -#define _LIBCPP_AVAILABILITY_SHARED_MUTEX -#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS -#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST -#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS -#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE -#define _LIBCPP_AVAILABILITY_FUTURE_ERROR -#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE -#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY -#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +# define _LIBCPP_AVAILABILITY_SHARED_MUTEX +# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH +# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST +# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS +# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE +# define _LIBCPP_AVAILABILITY_FUTURE_ERROR +# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE +# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY +# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR #endif // 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_DYNARRAY +# define _LIBCPP_AVAILABILITY_FUTURE +# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST #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_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 #endif // Availability of stream API in the dylib got dropped and re-added. The @@ -1266,39 +1278,39 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -# define _LIBCPP_PUSH_MACROS -# define _LIBCPP_POP_MACROS +# define _LIBCPP_PUSH_MACROS +# define _LIBCPP_POP_MACROS #else // Don't warn about macro conflicts when we can restore them at the // end of the header. -# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# endif -# if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_PUSH_MACROS \ - __pragma(push_macro("min")) \ - __pragma(push_macro("max")) -# define _LIBCPP_POP_MACROS \ - __pragma(pop_macro("min")) \ - __pragma(pop_macro("max")) -# else -# define _LIBCPP_PUSH_MACROS \ - _Pragma("push_macro(\"min\")") \ - _Pragma("push_macro(\"max\")") -# define _LIBCPP_POP_MACROS \ - _Pragma("pop_macro(\"min\")") \ - _Pragma("pop_macro(\"max\")") -# endif +# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS +# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS +# endif +# if defined(_LIBCPP_COMPILER_MSVC) +# define _LIBCPP_PUSH_MACROS \ + __pragma(push_macro("min")) \ + __pragma(push_macro("max")) +# define _LIBCPP_POP_MACROS \ + __pragma(pop_macro("min")) \ + __pragma(pop_macro("max")) +# else +# define _LIBCPP_PUSH_MACROS \ + _Pragma("push_macro(\"min\")") \ + _Pragma("push_macro(\"max\")") +# define _LIBCPP_POP_MACROS \ + _Pragma("pop_macro(\"min\")") \ + _Pragma("pop_macro(\"max\")") +# endif #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) #ifndef _LIBCPP_NO_AUTO_LINK -# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -# if defined(_DLL) -# pragma comment(lib, "c++.lib") -# else -# pragma comment(lib, "libc++.lib") -# endif -# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if defined(_DLL) +# pragma comment(lib, "c++.lib") +# else +# pragma comment(lib, "libc++.lib") +# endif +# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) #endif // _LIBCPP_NO_AUTO_LINK #endif // __cplusplus From 76c246434a99b0fb4c5217dbff737c9ec8809fa3 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 26 Feb 2018 20:47:46 +0000 Subject: [PATCH 031/176] [libcxx] [test] Fix MSVC warnings and errors. test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Fix MSVC x64 truncation warnings. warning C4267: conversion from 'size_t' to 'int', possible loss of data test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp Fix MSVC uninitialized memory warning. warning C6001: Using uninitialized memory 'vl'. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp Include for the assert() macro. Fixes D43273. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326120 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../exclusive.scan/exclusive_scan.pass.cpp | 16 +++++----- .../exclusive_scan_init_op.pass.cpp | 4 +-- .../inclusive.scan/inclusive_scan.pass.cpp | 12 ++++---- .../inclusive.scan/inclusive_scan_op.pass.cpp | 12 ++++---- .../inclusive_scan_op_init.pass.cpp | 26 ++++++++-------- ...sform_exclusive_scan_init_bop_uop.pass.cpp | 30 +++++++++---------- .../transform_inclusive_scan_bop_uop.pass.cpp | 18 +++++------ ...sform_inclusive_scan_bop_uop_init.pass.cpp | 30 +++++++++---------- .../string_append/push_back.pass.cpp | 2 +- ...855_tuple_ref_binding_diagnostics.pass.cpp | 1 + 10 files changed, 76 insertions(+), 75 deletions(-) diff --git a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp index 0cf6f2345..7026b73c6 100644 --- a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp +++ b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp @@ -55,31 +55,31 @@ test() test(Iter(ia), Iter(ia + i), 0, pRes, pRes + i); } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::exclusive_scan(v.begin(), v.end(), v.begin(), 50); + std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{50}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int) i * 3); + assert(v[i] == 50 + i * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::exclusive_scan(v.begin(), v.end(), v.begin(), 30); + std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{30}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 30 + triangle(i-1)); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::exclusive_scan(v.begin(), v.end(), v.begin(), 40); + std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{40}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 40 + triangle(i)); } diff --git a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp index c67716976..4fd5e236e 100644 --- a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp +++ b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp @@ -74,11 +74,11 @@ int main() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; + std::vector res; std::exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>()); assert(res.size() == 10); - int j = 1; + size_t j = 1; assert(res[0] == 1); for (size_t i = 1; i < v.size(); ++i) { diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp index a6ebe86c9..2058b8e3d 100644 --- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp +++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp @@ -55,21 +55,21 @@ test() test(Iter(ia), Iter(ia + i), pRes, pRes + i); } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == (int)(i+1) * 3); + assert(v[i] == (i+1) * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) @@ -77,7 +77,7 @@ void basic_tests() } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) @@ -85,7 +85,7 @@ void basic_tests() } { - std::vector v, res; + std::vector v, res; std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res)); assert(res.empty()); } diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp index ee1c48934..ca4da9841 100644 --- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp +++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp @@ -61,21 +61,21 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == (int)(i+1) * 3); + assert(v[i] == (i+1) * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) @@ -83,7 +83,7 @@ void basic_tests() } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) @@ -91,7 +91,7 @@ void basic_tests() } { - std::vector v, res; + std::vector v, res; std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>()); assert(res.empty()); } diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp index d0e1eb133..c3b0feb34 100644 --- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp +++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp @@ -60,38 +60,38 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 50); + std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{50}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int)(i+1) * 3); + assert(v[i] == 50 + (i+1) * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 40); + std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{40}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 40 + triangle(i)); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 30); + std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{30}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 30 + triangle(i + 1)); } { - std::vector v, res; - std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), 40); + std::vector v, res; + std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), size_t{40}); assert(res.empty()); } @@ -99,11 +99,11 @@ void basic_tests() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; - std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), 1); + std::vector res; + std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), size_t{1}); assert(res.size() == 10); - int j = 1; + size_t j = 1; assert(res[0] == 1); for (size_t i = 1; i < v.size(); ++i) { diff --git a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp index 84e18785d..ff0cb29f4 100644 --- a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp +++ b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp @@ -87,38 +87,38 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 50, std::plus<>(), add_one{}); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{50}, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int) i * 4); + assert(v[i] == 50 + i * 4); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_one{}); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{30}, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i - 1) + (int) i); + assert(v[i] == 30 + triangle(i - 1) + i); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<>(), add_one{}); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{40}, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i) + (int) i); + assert(v[i] == 40 + triangle(i) + i); } { - std::vector v, res; - std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 40, std::plus<>(), add_one{}); + std::vector v, res; + std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), size_t{40}, std::plus<>(), add_one{}); assert(res.empty()); } @@ -126,11 +126,11 @@ void basic_tests() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; - std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>(), add_one{}); + std::vector res; + std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), size_t{1}, std::multiplies<>(), add_one{}); assert(res.size() == 10); - int j = 1; + size_t j = 1; assert(res[0] == 1); for (size_t i = 1; i < res.size(); ++i) { diff --git a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp index 1cffc167e..48aeadb87 100644 --- a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp +++ b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp @@ -76,39 +76,39 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); - std::copy(v.begin(), v.end(), std::ostream_iterator(std::cout, " ")); + std::copy(v.begin(), v.end(), std::ostream_iterator(std::cout, " ")); std::cout << std::endl; for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == (int)(i+1) * 4); + assert(v[i] == (i+1) * 4); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i) + (int)(i + 1)); + assert(v[i] == triangle(i) + i + 1); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i + 1) + (int)(i + 1)); + assert(v[i] == triangle(i + 1) + i + 1); } { - std::vector v, res; + std::vector v, res; std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}); assert(res.empty()); } diff --git a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp index 7a3cdd252..00c4aafdf 100644 --- a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp +++ b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp @@ -87,38 +87,38 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 50); + std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{50}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int) (i + 1) * 4); + assert(v[i] == 50 + (i + 1) * 4); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 30); + std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{30}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i) + (int) (i + 1)); + assert(v[i] == 30 + triangle(i) + i + 1); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 40); + std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{40}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i + 1) + (int) (i + 1)); + assert(v[i] == 40 + triangle(i + 1) + i + 1); } { - std::vector v, res; - std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}, 1); + std::vector v, res; + std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}, size_t{1}); assert(res.empty()); } @@ -126,11 +126,11 @@ void basic_tests() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; - std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), add_one{}, 1); + std::vector res; + std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), add_one{}, size_t{1}); assert(res.size() == 10); - int j = 2; + size_t j = 2; assert(res[0] == 2); for (size_t i = 1; i < res.size(); ++i) { diff --git a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp index 128446534..38b68aa69 100644 --- a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -52,7 +52,7 @@ int main() { // https://bugs.llvm.org/show_bug.cgi?id=31454 std::basic_string s; - veryLarge vl; + veryLarge vl = {}; s.push_back(vl); s.push_back(vl); s.push_back(vl); diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp index 468063544..457df5602 100644 --- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp +++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "test_macros.h" #if TEST_HAS_BUILTIN_IDENTIFIER(__reference_binds_to_temporary) From 04dd960ff3d2d2b580e4cdff7f450beae1ffb9aa Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Wed, 28 Feb 2018 23:27:40 +0000 Subject: [PATCH 032/176] [libcxx] Fix last_write_time test for filesystems that don't support very small times. APFS minimum supported file write time is -2^63 nanoseconds, which doesn't go as far as `file_time_type::min()` that is equal to -2^63 microseconds on macOS. This change doesn't affect filesystems that support `file_time_type` range only for in-memory file time representation but not for on-disk representation. Such filesystems are considered as `SupportsMinTime`. rdar://problem/35865151 Reviewers: EricWF, Hahnfeld Subscribers: jkorous-apple, mclow.lists, cfe-commits, christof Differential Revision: https://reviews.llvm.org/D42755 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326383 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../last_write_time.pass.cpp | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp index cdd177399..0ca82b21f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -116,12 +116,31 @@ bool TestSupportsMaxTime() { return !ec && new_write_time > max_sec - 1; } +bool TestSupportsMinTime() { + using namespace std::chrono; + using Lim = std::numeric_limits; + auto min_sec = duration_cast(file_time_type::min().time_since_epoch()).count(); + if (min_sec < Lim::min()) return false; + std::error_code ec; + std::time_t old_write_time, new_write_time; + { // WARNING: Do not assert in this scope. + scoped_test_env env; + const path file = env.create_file("file", 42); + old_write_time = LastWriteTime(file); + file_time_type tp = file_time_type::min(); + fs::last_write_time(file, tp, ec); + new_write_time = LastWriteTime(file); + } + return !ec && new_write_time < min_sec + 1; +} + #if defined(__clang__) #pragma clang diagnostic pop #endif static const bool SupportsNegativeTimes = TestSupportsNegativeTimes(); static const bool SupportsMaxTime = TestSupportsMaxTime(); +static const bool SupportsMinTime = TestSupportsMinTime(); } // end namespace @@ -140,6 +159,8 @@ static const bool SupportsMaxTime = TestSupportsMaxTime(); // (B) 'tp' is non-negative or the filesystem supports negative times. // (C) 'tp' is not 'file_time_type::max()' or the filesystem supports the max // value. +// (D) 'tp' is not 'file_time_type::min()' or the filesystem supports the min +// value. inline bool TimeIsRepresentableByFilesystem(file_time_type tp) { using namespace std::chrono; using Lim = std::numeric_limits; @@ -148,6 +169,7 @@ inline bool TimeIsRepresentableByFilesystem(file_time_type tp) { if (sec < Lim::min() || sec > Lim::max()) return false; else if (microsec < 0 && !SupportsNegativeTimes) return false; else if (tp == file_time_type::max() && !SupportsMaxTime) return false; + else if (tp == file_time_type::min() && !SupportsMinTime) return false; return true; } @@ -355,20 +377,20 @@ TEST_CASE(test_write_min_time) TEST_CHECK(!ec); TEST_CHECK(tt >= new_time); TEST_CHECK(tt < new_time + Sec(1)); - } - ec = GetTestEC(); - last_write_time(p, Clock::now()); + ec = GetTestEC(); + last_write_time(p, Clock::now()); - new_time = file_time_type::min() + MicroSec(1); + new_time = file_time_type::min() + MicroSec(1); - last_write_time(p, new_time, ec); - tt = last_write_time(p); + last_write_time(p, new_time, ec); + tt = last_write_time(p); - if (TimeIsRepresentableByFilesystem(new_time)) { - TEST_CHECK(!ec); - TEST_CHECK(tt >= new_time); - TEST_CHECK(tt < new_time + Sec(1)); + if (TimeIsRepresentableByFilesystem(new_time)) { + TEST_CHECK(!ec); + TEST_CHECK(tt >= new_time); + TEST_CHECK(tt < new_time + Sec(1)); + } } } From f31b30dc555601e103a07ebeb6028ce7bf7e350d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Mar 2018 21:16:07 +0000 Subject: [PATCH 033/176] Added P0805 to the list of ready bits git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326485 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index fa2b259ed..f10e823a0 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -48,7 +48,8 @@

Paper Status

- + + @@ -150,7 +151,7 @@
  • 2936 - Eric - don't we do this already?
  • -

    Last Updated: 7-Feb-2018

    +

    Last Updated: 1-Mar-2018

    From 06ac7cdfc798999dddaaf55f96e4f8986a6f87d7 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Mar 2018 15:01:19 +0000 Subject: [PATCH 034/176] Implement P0767R1 - Deprecate POD git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326801 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../support.types/byte.pass.cpp | 6 +- .../support.types/max_align_t.pass.cpp | 7 ++ .../meta.trans.other/aligned_storage.pass.cpp | 102 ++++++++++++++++++ www/cxx2a_status.html | 4 +- 4 files changed, 116 insertions(+), 3 deletions(-) diff --git a/test/std/language.support/support.types/byte.pass.cpp b/test/std/language.support/support.types/byte.pass.cpp index 66b2a5531..a1abefa84 100644 --- a/test/std/language.support/support.types/byte.pass.cpp +++ b/test/std/language.support/support.types/byte.pass.cpp @@ -9,14 +9,18 @@ #include #include -#include +#include "test_macros.h" // XFAIL: c++98, c++03, c++11, c++14 // std::byte is not an integer type, nor a character type. // It is a distinct type for accessing the bits that ultimately make up object storage. +#if TEST_STD_VER > 17 +static_assert( std::is_trivial::value, "" ); // P0767 +#else static_assert( std::is_pod::value, "" ); +#endif static_assert(!std::is_arithmetic::value, "" ); static_assert(!std::is_integral::value, "" ); diff --git a/test/std/language.support/support.types/max_align_t.pass.cpp b/test/std/language.support/support.types/max_align_t.pass.cpp index 08a6c28a4..603b6f107 100644 --- a/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/test/std/language.support/support.types/max_align_t.pass.cpp @@ -14,11 +14,18 @@ // great as that of every scalar type #include +#include "test_macros.h" int main() { +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, + "std::is_trivial::value"); +#else static_assert(std::is_pod::value, "std::is_pod::value"); +#endif static_assert((std::alignment_of::value >= std::alignment_of::value), "std::alignment_of::value >= " diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp index 079661d0c..216cb7b5b 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -21,6 +21,12 @@ int main() typedef std::aligned_storage<10, 1 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 10, ""); @@ -29,6 +35,12 @@ int main() typedef std::aligned_storage<10, 2 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); @@ -37,6 +49,12 @@ int main() typedef std::aligned_storage<10, 4 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 12, ""); @@ -45,6 +63,12 @@ int main() typedef std::aligned_storage<10, 8 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); @@ -53,6 +77,12 @@ int main() typedef std::aligned_storage<10, 16 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); @@ -61,6 +91,12 @@ int main() typedef std::aligned_storage<10, 32 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); @@ -69,6 +105,12 @@ int main() typedef std::aligned_storage<20, 32 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); @@ -77,6 +119,12 @@ int main() typedef std::aligned_storage<40, 32 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 64, ""); @@ -85,6 +133,12 @@ int main() typedef std::aligned_storage<12, 16 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); @@ -93,6 +147,12 @@ int main() typedef std::aligned_storage<1>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 1, ""); @@ -101,6 +161,12 @@ int main() typedef std::aligned_storage<2>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 2, ""); @@ -109,6 +175,12 @@ int main() typedef std::aligned_storage<3>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 4, ""); @@ -117,6 +189,12 @@ int main() typedef std::aligned_storage<4>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); @@ -125,6 +203,12 @@ int main() typedef std::aligned_storage<5>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 8, ""); @@ -141,6 +225,12 @@ int main() typedef std::aligned_storage<8>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 8, ""); @@ -149,6 +239,12 @@ int main() typedef std::aligned_storage<9>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); @@ -157,6 +253,12 @@ int main() typedef std::aligned_storage<15>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index efe59106b..7bdef1515 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -69,7 +69,7 @@ - + @@ -135,7 +135,7 @@
    Paper #GroupPaper NameMeetingStatusFirst released version
    Paper #Paper NameMeetingStatus
    P0805R1Comparing ContainersJacksonvillePatch Ready: D43773
    P0616R0LWGde-pessimize legacy algorithms with std::moveAlbuquerque
    P0653R2LWGUtility to convert a pointer to a raw pointerAlbuquerqueComplete6.0
    P0718R2LWGAtomic shared_ptrAlbuquerque
    P0767R1CWGDeprecate PODAlbuquerque
    P0767R1CWGDeprecate PODAlbuquerqueComplete7.0
    P0768R1CWGLibrary Support for the Spaceship (Comparison) OperatorAlbuquerque
    P0777R1LWGTreating Unnecessary decayAlbuquerqueComplete7.0
    -

    Last Updated: 6-Feb-2018

    +

    Last Updated: 6-Mar-2018

    From c80697556ad25765cd8b454c9b25274d06e30f85 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Mar 2018 15:01:55 +0000 Subject: [PATCH 035/176] One more test for P0767: git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326802 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/depr/depr.c.headers/stddef_h.pass.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/test/std/depr/depr.c.headers/stddef_h.pass.cpp index 0c08c782a..219534651 100644 --- a/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stddef_h.pass.cpp @@ -13,6 +13,8 @@ #include #include +#include "test_macros.h" + #ifndef NULL #error NULL not defined #endif @@ -42,8 +44,14 @@ int main() "decltype(nullptr) == nullptr_t"); static_assert(sizeof(nullptr_t) == sizeof(void*), "sizeof(nullptr_t) == sizeof(void*)"); +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, + "std::is_trivial::value"); +#else static_assert(std::is_pod::value, "std::is_pod::value"); +#endif static_assert((std::alignment_of::value >= std::alignment_of::value), "std::alignment_of::value >= " From 66c652fe0865a35afcff1195a277af810ea93522 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 7 Mar 2018 22:51:16 +0000 Subject: [PATCH 036/176] Include since we use it. Thanks to Andrey Maksimov for the catch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326958 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/numerics/rand/rand.device/eval.pass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp index 56690316c..e5a2a32ee 100644 --- a/test/std/numerics/rand/rand.device/eval.pass.cpp +++ b/test/std/numerics/rand/rand.device/eval.pass.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "test_macros.h" From 46b8a51b49ec0930425a4c55c68e24f47f47a481 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Mar 2018 15:01:50 +0000 Subject: [PATCH 037/176] Implement LWG#2518 - Non-member swap for propagate_const should call member swap git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327005 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/propagate_const | 3 +-- www/cxx1z_status.html | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/experimental/propagate_const b/include/experimental/propagate_const index e7f7e9fc6..188548596 100644 --- a/include/experimental/propagate_const +++ b/include/experimental/propagate_const @@ -463,8 +463,7 @@ template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { - using _VSTD::swap; - swap(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); + __pc1.swap(__pc2); } template diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 5cead9b1c..29f99c059 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -375,7 +375,7 @@ 2503multiline option should be added to syntax_option_typeIssaquah 2510Tag types should not be DefaultConstructibleIssaquah 2514Type traits must not be finalIssaquahComplete - 2518[fund.ts.v2] Non-member swap for propagate_const should call member swapIssaquah + 2518[fund.ts.v2] Non-member swap for propagate_const should call member swapIssaquahComplete 2519Iterator operator-= has gratuitous undefined behaviourIssaquahComplete 2521[fund.ts.v2] weak_ptr's converting move constructor should be modified as well for array supportIssaquah 2525[fund.ts.v2] get_memory_resource should be const and noexceptIssaquah @@ -504,7 +504,7 @@ -

    Last Updated: 12-Feb-2018

    +

    Last Updated: 8-Mar-2018

    From 2b588cbf15d89fae557dc03221e67ee4d61d43d2 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 8 Mar 2018 21:15:26 +0000 Subject: [PATCH 038/176] Low-hanging fruit optimization in string::__move_assign(). shrink_to_fit() ends up doing a lot work to get information that we already know since we just called clear(). This change seems concise enough to be worth the couple extra lines and my benchmarks show that it is indeed a pretty decent win. It looks like the same thing is going on twice in __copy_assign_alloc(), but I didn't want to go overboard since this is my first contribution to llvm/libc++. Patch by Timothy VanSlyke! Differential Revision: https://reviews.llvm.org/D41976 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327064 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 27 ++++++++--- .../clear_and_shrink_db1.pass.cpp | 48 +++++++++++++++++++ 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp diff --git a/include/string b/include/string index e8ec709c2..2630799c0 100644 --- a/include/string +++ b/include/string @@ -1257,6 +1257,8 @@ public: _LIBCPP_INLINE_VISIBILITY bool __invariants() const; + _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink(); + _LIBCPP_INLINE_VISIBILITY bool __is_long() const _NOEXCEPT {return bool(__r_.first().__s.__size_ & __short_mask);} @@ -1426,16 +1428,14 @@ private: { if (!__str.__is_long()) { - clear(); - shrink_to_fit(); + __clear_and_shrink(); __alloc() = __str.__alloc(); } else { allocator_type __a = __str.__alloc(); pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap()); - clear(); - shrink_to_fit(); + __clear_and_shrink(); __alloc() = _VSTD::move(__a); __set_long_pointer(__p); __set_long_cap(__str.__get_long_cap()); @@ -2125,8 +2125,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr _NOEXCEPT_(is_nothrow_move_assignable::value) #endif { - clear(); - shrink_to_fit(); + __clear_and_shrink(); __r_.first() = __str.__r_.first(); __move_assign_alloc(__str); __str.__zero(); @@ -3579,6 +3578,22 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const return true; } +// __clear_and_shrink + +template +inline _LIBCPP_INLINE_VISIBILITY +void +basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() +{ + clear(); + if(__is_long()) + { + __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); + __set_long_cap(0); + __set_short_size(0); + } +} + // operator== template diff --git a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp new file mode 100644 index 000000000..b7e278b75 --- /dev/null +++ b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// Call __clear_and_shrink() and ensure string invariants hold + +#if _LIBCPP_DEBUG >= 1 + +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include + +int main() +{ + std::string l = "Long string so that allocation definitely, for sure, absolutely happens. Probably."; + std::string s = "short"; + + assert(l.__invariants()); + assert(s.__invariants()); + + s.__clear_and_shrink(); + assert(s.__invariants()); + assert(s.size() == 0); + + { + std::string::size_type cap = l.capacity(); + l.__clear_and_shrink(); + assert(l.__invariants()); + assert(l.size() == 0); + assert(l.capacity() < cap); + } +} + +#else + +int main() +{ +} + +#endif From 057ac7c9daee48ca8a7cbfe2687db54e5abd279b Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Fri, 9 Mar 2018 22:13:12 +0000 Subject: [PATCH 039/176] XFAIL: libcpp-no-deduction-guides in libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp Summary: Refactor the previous version method of marking each apple-clang version as UNSUPPORTED and just XFAIL'ing the libcpp-no-deduction-guides instead. This brings this test inline with the same style as iter_alloc_deduction.pass.cpp Reviewers: EricWF, dexonsmith Reviewed By: EricWF Subscribers: EricWF, vsapsai, vsk, cfe-commits Differential Revision: https://reviews.llvm.org/D44103 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327178 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 65aba0493..ce710072b 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,8 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// XFAIL: libcpp-no-deduction-guides // template::value_type>> From 00c27d8a40788386d324528e75dc41f2e798af45 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Sat, 10 Mar 2018 00:19:25 +0000 Subject: [PATCH 040/176] [libcxx][test] Marking libcpp-no-deduction-guides unsupported. This fixes linux bot failures with r327178. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327190 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index ce710072b..94b9e25f4 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: libcpp-no-deduction-guides +// UNSUPPORTED: libcpp-no-deduction-guides // template::value_type>> From 7c796ffe54f43310299cf8e3d3ff1f492eb3a4bf Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Sat, 10 Mar 2018 00:53:05 +0000 Subject: [PATCH 041/176] [libcxx][test] Reverting r327178 and r327190. Reverting changes made to iter_alloc_deduction.fail.cpp as my changes seem to be making several Linux bots angry. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327191 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 94b9e25f4..65aba0493 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,8 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 // template::value_type>> From 698b6951472a52d1a26de1cbab1e831d3db37189 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Sat, 10 Mar 2018 01:20:11 +0000 Subject: [PATCH 042/176] [CMake] Copy the generated __config header into build directory When the generated __config file is being used, it is currently only copied during installation process. However, that means that the file that gets copied into LLVM build directory is the vanilla __config file, and any parts of the build that depend on the just built toolchain like sanitizers will get that instead of the generated version. To avoid this issue, we need to copy the generated header into the LLVM build directory as well. Differential Revision: https://reviews.llvm.org/D43797 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327194 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/CMakeLists.txt | 40 ++++++++++++++++++++++++++-------------- lib/CMakeLists.txt | 2 +- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index b98e09260..5bf92f016 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -2,6 +2,23 @@ if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS) set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE) endif() +if (LIBCXX_NEEDS_SITE_CONFIG) + # Generate a custom __config header. The new header is created + # by prepending __config_site to the current __config header. + add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config + COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py + ${LIBCXX_BINARY_DIR}/__config_site + ${LIBCXX_SOURCE_DIR}/include/__config + -o ${LIBCXX_BINARY_DIR}/__generated_config + DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config + ${LIBCXX_BINARY_DIR}/__config_site + ) + # Add a target that executes the generation commands. + add_custom_target(generate_config_header ALL + DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) + set(generated_config_deps generate_config_header) +endif() + set(LIBCXX_HEADER_PATTERN PATTERN "*" PATTERN "CMakeLists.txt" EXCLUDE @@ -16,6 +33,15 @@ if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR) FILES_MATCHING ${LIBCXX_HEADER_PATTERN} ) + + if (LIBCXX_NEEDS_SITE_CONFIG) + # Copy the generated header as __config into build directory. + add_custom_command( + TARGET generate_config_header POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${LIBCXX_BINARY_DIR}/__generated_config + ${LLVM_BINARY_DIR}/include/c++/v1/__config) + endif() endif() if (LIBCXX_INSTALL_HEADERS) @@ -28,20 +54,6 @@ if (LIBCXX_INSTALL_HEADERS) ) if (LIBCXX_NEEDS_SITE_CONFIG) - # Generate and install a custom __config header. The new header is created - # by prepending __config_site to the current __config header. - add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config - COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py - ${LIBCXX_BINARY_DIR}/__config_site - ${LIBCXX_SOURCE_DIR}/include/__config - -o ${LIBCXX_BINARY_DIR}/__generated_config - DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config - ${LIBCXX_BINARY_DIR}/__config_site - ) - # Add a target that executes the generation commands. - add_custom_target(generate_config_header ALL - DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) - set(generated_config_deps generate_config_header) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5d7111156..30fdc3075 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -283,7 +283,7 @@ if (LIBCXX_ENABLE_STATIC) endif() # Add a meta-target for both libraries. -add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS}) +add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps}) if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) From ddb6e5f2ef142a5af2060ded298dffc887b2fbea Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 12 Mar 2018 18:06:37 +0000 Subject: [PATCH 043/176] [libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp. After two failed attempts last week to make this work I am going back to a known good method of making this test pass on macOS...adding the current apple-clang version to the UNSUPPORTED list. During a previous patch review (https://reviews.llvm.org/D44103) it was suggested to just XFAIL libcpp-no-deduction-guides as was done to iter_alloc_deduction.pass.cpp. However this caused a an unexpected pass on: http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std/builds/214 I then attempted to just mark libcpp-no-deduction-guides as UNSUPPORTED, however this caused an additional bot failure. So I reverted everything (https://reviews.llvm.org/rCXX327191). To solve this and get work unblocked I am adding apple-clang-9 to the original UNSUPPORTED list. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327304 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 65aba0493..321dc9f02 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -10,7 +10,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0, apple-clang-9 // template::value_type>> From 6ce040b9aabec88e616853f0c48408d60b41a151 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 18 Mar 2018 19:29:21 +0000 Subject: [PATCH 044/176] Updated C++2a status with changes from Jacksonville WG21 meeting git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327806 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/cxx2a_status.html | 47 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 7bdef1515..1ed30839f 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -72,6 +72,15 @@ P0767R1CWGDeprecate PODAlbuquerqueComplete7.0 P0768R1CWGLibrary Support for the Spaceship (Comparison) OperatorAlbuquerque P0777R1LWGTreating Unnecessary decayAlbuquerqueComplete7.0 + P0122R7LWG<span>Jacksonville + P0355R7LWGExtending chrono to Calendars and Time ZonesJacksonville + P0551R3LWGThou Shalt Not Specialize std Function Templates!Jacksonville + P0753R2LWGManipulators for C++ Synchronized Buffered OstreamJacksonville + P0754R2LWG<version>Jacksonville + P0809R0LWGComparing Unordered ContainersJacksonville + P0858R0LWGConstexpr iterator requirementsJacksonville + P0905R1CWGSymmetry for spaceshipJacksonville + P0966R1LWGstring::reserve Should Not ShrinkJacksonville @@ -132,10 +141,46 @@ 3001weak_ptr::element_type needs remove_extent_tAlbuquerque 3024variant's copies must be deleted instead of disabled via SFINAEAlbuquerque + + 2164What are the semantics of vector.emplace(vector.begin(), vector.back())?Jacksonville + 2243istream::putback problemJacksonvilleComplete + 2816resize_file has impossible postconditionJacksonvilleNothing to do + 2843Unclear behavior of std::pmr::memory_resource::do_allocate()Jacksonville + 2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?JacksonvilleNothing to do + 2851std::filesystem enum classes are now underspecifiedJacksonvilleNothing to do + 2946LWG 2758's resolution missed further correctionsJacksonville + 2969polymorphic_allocator::construct() shouldn't pass resource()Jacksonville + 2975Missing case for pair construction in scoped and polymorphic allocatorsJacksonville + 2989path's stream insertion operator lets you insert everything under the sunJacksonvilleCompleted + 3000monotonic_memory_resource::do_is_equal uses dynamic_cast unnecessarilyJacksonville + 3002[networking.ts] basic_socket_acceptor::is_open() isn't noexceptJacksonville + 3004§[string.capacity] and §[vector.capacity] should specify time complexity for capacity()JacksonvilleNothing to do + 3005Destruction order of arrays by make_shared/allocate_shared only recommended?Jacksonville + 3007allocate_shared should rebind allocator to cv-unqualified value_type for constructionJacksonville + 3009Including <string_view> doesn't provide std::size/empty/dataJacksonvilleComplete + 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville + 3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete + 3014More noexcept issues with filesystem operationsJacksonvilleComplete + 3015copy_options::unspecified underspecifiedJacksonvilleNothing to do + 3017list splice functions should use addressofJacksonville + 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville + 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville + 3030Who shall meet the requirements of try_lock?JacksonvilleNothing to do + 3034P0767R1 breaks previously-standard-layout typesJacksonville + 3035std::allocator's constructors should be constexprJacksonville + 3039Unnecessary decay in thread and packaged_taskJacksonville + 3041Unnecessary decay in reference_wrapperJacksonville + 3042is_literal_type_v should be inlineJacksonvilleComplete + 3043Bogus postcondition for filesystem_error constructorJacksonville + 3045atomic<floating-point> doesn't have value_type or difference_typeJacksonville + 3048transform_reduce(exec, first1, last1, first2, init) discards execution policyJacksonville + 3051Floating point classifications were inadvertently changed in P0175JacksonvilleNothing to do + 3075basic_string needs deduction guides from basic_string_viewJacksonville + -

    Last Updated: 6-Mar-2018

    +

    Last Updated: 18-Mar-2018

    From 483bc7c64a43ff86c2f082b2a8305efbc70b97ca Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 20 Mar 2018 22:37:37 +0000 Subject: [PATCH 045/176] Implement LWG 3039 and 3041 - 'Treating Unnecessary decay'. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328054 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/future | 8 ++++---- include/thread | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/future b/include/future index a7c28a474..536574e75 100644 --- a/include/future +++ b/include/future @@ -2021,7 +2021,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type @@ -2032,7 +2032,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type @@ -2150,7 +2150,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type @@ -2161,7 +2161,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type diff --git a/include/thread b/include/thread index 1b8dca394..0629d70ef 100644 --- a/include/thread +++ b/include/thread @@ -298,7 +298,7 @@ public: template ::type, thread>::value + !is_same::type, thread>::value >::type > _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS From dfeb9b2af78112e21e2aaf6be8f15634c549409f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 20 Mar 2018 23:02:53 +0000 Subject: [PATCH 046/176] Implement LWG3035: std::allocator's constructors should be constexpr. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328059 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/memory | 25 +++++++--- .../default.allocator/allocator.ctor.pass.cpp | 50 +++++++++++++++++++ 2 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp diff --git a/include/memory b/include/memory index bc5c4c653..ea52ba2cb 100644 --- a/include/memory +++ b/include/memory @@ -126,9 +126,10 @@ public: template struct rebind {typedef allocator other;}; - allocator() noexcept; - allocator(const allocator&) noexcept; - template allocator(const allocator&) noexcept; + constexpr allocator() noexcept; // constexpr in C++20 + constexpr allocator(const allocator&) noexcept; // constexpr in C++20 + template + constexpr allocator(const allocator&) noexcept; // constexpr in C++20 ~allocator(); pointer address(reference x) const noexcept; const_pointer address(const_reference x) const noexcept; @@ -1778,8 +1779,13 @@ public: template struct rebind {typedef allocator<_Up> other;}; - _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} - template _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator() _NOEXCEPT {} + + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT @@ -1877,8 +1883,13 @@ public: template struct rebind {typedef allocator<_Up> other;}; - _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} - template _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator() _NOEXCEPT {} + + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator::const_pointer = 0) diff --git a/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp new file mode 100644 index 000000000..3841cb533 --- /dev/null +++ b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// 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, c++14, c++17 +// +// template +// class allocator +// { +// public: // All of these are constexpr after C++17 +// constexpr allocator() noexcept; +// constexpr allocator(const allocator&) noexcept; +// template constexpr allocator(const allocator&) noexcept; +// ... +// }; + +#include +#include + +#include "test_macros.h" + + +int main() +{ + { + typedef std::allocator AC; + typedef std::allocator AL; + + constexpr AC a1; + constexpr AC a2{a1}; + constexpr AL a3{a2}; + (void) a3; + } + { + typedef std::allocator AC; + typedef std::allocator AL; + + constexpr AC a1; + constexpr AC a2{a1}; + constexpr AL a3{a2}; + (void) a3; + } + +} From 256f187bc66b6771968af526a4626c058dcc4c40 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 21 Mar 2018 00:36:05 +0000 Subject: [PATCH 047/176] Implement LWG3034: P0767R1 breaks previously-standard-layout types git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328064 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 8 +-- include/string_view | 4 +- .../std/depr/depr.c.headers/stddef_h.pass.cpp | 2 + .../support.types/max_align_t.pass.cpp | 7 ++- .../strings/basic.string/char.bad.fail.cpp | 53 +++++++++++++++++++ .../std/strings/string.view/char.bad.fail.cpp | 53 +++++++++++++++++++ .../meta.trans.other/aligned_storage.pass.cpp | 45 ++++++++++++++++ .../meta.trans.other/aligned_union.pass.cpp | 21 ++++++++ www/cxx2a_status.html | 10 ++-- 9 files changed, 192 insertions(+), 11 deletions(-) create mode 100644 test/std/strings/basic.string/char.bad.fail.cpp create mode 100644 test/std/strings/string.view/char.bad.fail.cpp diff --git a/include/string b/include/string index 2630799c0..7218aa2e4 100644 --- a/include/string +++ b/include/string @@ -658,10 +658,12 @@ public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; - static_assert(is_trivial::value, "Character type of basic_string must be trivial"); - static_assert((is_same<_CharT, typename traits_type::char_type>::value), + static_assert((!is_array::value), "Character type of basic_string must not be an array"); + static_assert(( is_standard_layout::value), "Character type of basic_string must be standard-layout"); + static_assert(( is_trivial::value), "Character type of basic_string must be trivial"); + static_assert(( is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); - static_assert((is_same::value), + static_assert(( is_same::value), "Allocator::value_type must be same type as value_type"); #if defined(_LIBCPP_RAW_ITERATORS) typedef pointer iterator; diff --git a/include/string_view b/include/string_view index fd8c3790b..6377aeb6d 100644 --- a/include/string_view +++ b/include/string_view @@ -208,7 +208,9 @@ public: typedef ptrdiff_t difference_type; static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); - static_assert(is_trivial::value, "Character type of basic_string_view must be trivial"); + static_assert((!is_array::value), "Character type of basic_string_view must not be an array"); + static_assert(( is_standard_layout::value), "Character type of basic_string_view must be standard-layout"); + static_assert(( is_trivial::value), "Character type of basic_string_view must be trivial"); static_assert((is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); diff --git a/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/test/std/depr/depr.c.headers/stddef_h.pass.cpp index 219534651..68f70b80e 100644 --- a/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stddef_h.pass.cpp @@ -48,6 +48,8 @@ int main() // P0767 static_assert(std::is_trivial::value, "std::is_trivial::value"); + static_assert(std::is_standard_layout::value, + "std::is_standard_layout::value"); #else static_assert(std::is_pod::value, "std::is_pod::value"); diff --git a/test/std/language.support/support.types/max_align_t.pass.cpp b/test/std/language.support/support.types/max_align_t.pass.cpp index 603b6f107..dc202897a 100644 --- a/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/test/std/language.support/support.types/max_align_t.pass.cpp @@ -10,18 +10,21 @@ #include #include -// max_align_t is a POD type whose alignment requirement is at least as -// great as that of every scalar type +// max_align_t is a trivial standard-layout type whose alignment requirement +// is at least as great as that of every scalar type #include #include "test_macros.h" int main() { + #if TEST_STD_VER > 17 // P0767 static_assert(std::is_trivial::value, "std::is_trivial::value"); + static_assert(std::is_standard_layout::value, + "std::is_standard_layout::value"); #else static_assert(std::is_pod::value, "std::is_pod::value"); diff --git a/test/std/strings/basic.string/char.bad.fail.cpp b/test/std/strings/basic.string/char.bad.fail.cpp new file mode 100644 index 000000000..1878cd02c --- /dev/null +++ b/test/std/strings/basic.string/char.bad.fail.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// +// ... manipulating sequences of any non-array trivial standard-layout types. + +#include +#include "test_traits.h" + +struct NotTrivial { + NotTrivial() : value(3) {} + int value; +}; + +struct NotStandardLayout { +public: + NotStandardLayout() : one(1), two(2) {} + int sum() const { return one + two; } // silences "unused field 'two' warning" + int one; +private: + int two; +}; + +int main() +{ + { +// array + typedef char C[3]; + static_assert(std::is_array::value, ""); + std::basic_string > s; +// expected-error-re@string:* {{static_assert failed{{.*}} "Character type of basic_string must not be an array"}} + } + + { +// not trivial + static_assert(!std::is_trivial::value, ""); + std::basic_string > s; +// expected-error-re@string:* {{static_assert failed{{.*}} "Character type of basic_string must be trivial"}} + } + + { +// not standard layout + static_assert(!std::is_standard_layout::value, ""); + std::basic_string > s; +// expected-error-re@string:* {{static_assert failed{{.*}} "Character type of basic_string must be standard-layout"}} + } +} diff --git a/test/std/strings/string.view/char.bad.fail.cpp b/test/std/strings/string.view/char.bad.fail.cpp new file mode 100644 index 000000000..cbd2b47b9 --- /dev/null +++ b/test/std/strings/string.view/char.bad.fail.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// +// ... manipulating sequences of any non-array trivial standard-layout types. + +#include +#include "../basic.string/test_traits.h" + +struct NotTrivial { + NotTrivial() : value(3) {} + int value; +}; + +struct NotStandardLayout { +public: + NotStandardLayout() : one(1), two(2) {} + int sum() const { return one + two; } // silences "unused field 'two' warning" + int one; +private: + int two; +}; + +int main() +{ + { +// array + typedef char C[3]; + static_assert(std::is_array::value, ""); + std::basic_string_view > sv; +// expected-error-re@string_view:* {{static_assert failed{{.*}} "Character type of basic_string_view must not be an array"}} + } + + { +// not trivial + static_assert(!std::is_trivial::value, ""); + std::basic_string_view > sv; +// expected-error-re@string_view:* {{static_assert failed{{.*}} "Character type of basic_string_view must be trivial"}} + } + + { +// not standard layout + static_assert(!std::is_standard_layout::value, ""); + std::basic_string_view > sv; +// expected-error-re@string_view:* {{static_assert failed{{.*}} "Character type of basic_string_view must be standard-layout"}} + } +} diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp index 216cb7b5b..5f3146edd 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -10,6 +10,9 @@ // type_traits // aligned_storage +// +// Issue 3034 added: +// The member typedef type shall be a trivial standard-layout type. #include #include // for std::max_align_t @@ -28,6 +31,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 10, ""); } @@ -42,6 +47,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -56,6 +63,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 12, ""); } @@ -70,6 +79,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -84,6 +95,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); } @@ -98,6 +111,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); } @@ -112,6 +127,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); } @@ -126,6 +143,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 64, ""); } @@ -140,6 +159,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); } @@ -154,6 +175,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 1, ""); } @@ -168,6 +191,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 2, ""); } @@ -182,6 +207,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 4, ""); } @@ -196,6 +223,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } @@ -210,6 +239,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 8, ""); } @@ -218,6 +249,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 8, ""); } @@ -232,6 +265,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 8, ""); } @@ -246,6 +281,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -260,6 +297,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -274,6 +313,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == alignof(std::max_align_t), ""); static_assert(sizeof(T1) == 16, ""); @@ -283,6 +324,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == alignof(std::max_align_t), ""); static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), ""); @@ -292,6 +335,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } 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 883548270..3e58b51a6 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 @@ -13,6 +13,9 @@ // aligned_union +// Issue 3034 added: +// The member typedef type shall be a trivial standard-layout type. + #include #include "test_macros.h" @@ -24,6 +27,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 10, ""); } @@ -32,6 +37,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -40,6 +47,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 12, ""); } @@ -48,6 +57,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -56,6 +67,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -64,6 +77,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -72,6 +87,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } @@ -80,6 +97,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } @@ -88,6 +107,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 1ed30839f..4ecfc795d 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -166,10 +166,10 @@ 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville 3030Who shall meet the requirements of try_lock?JacksonvilleNothing to do - 3034P0767R1 breaks previously-standard-layout typesJacksonville - 3035std::allocator's constructors should be constexprJacksonville - 3039Unnecessary decay in thread and packaged_taskJacksonville - 3041Unnecessary decay in reference_wrapperJacksonville + 3034P0767R1 breaks previously-standard-layout typesJacksonvilleComplete + 3035std::allocator's constructors should be constexprJacksonvilleComplete + 3039Unnecessary decay in thread and packaged_taskJacksonvilleComplete + 3041Unnecessary decay in reference_wrapperJacksonvilleComplete 3042is_literal_type_v should be inlineJacksonvilleComplete 3043Bogus postcondition for filesystem_error constructorJacksonville 3045atomic<floating-point> doesn't have value_type or difference_typeJacksonville @@ -180,7 +180,7 @@ -

    Last Updated: 18-Mar-2018

    +

    Last Updated: 20-Mar-2018

    From a83128739983c83eaf1ba4c2bc0e3aa570082d15 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 04:42:56 +0000 Subject: [PATCH 048/176] Fix PR22634 - std::allocator doesn't respect over-aligned types. This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328180 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 1 + include/__sso_allocator | 4 +- include/memory | 37 +--- include/new | 51 +++++- include/valarray | 58 +++--- src/experimental/memory_resource.cpp | 6 +- .../allocator.members/allocate.pass.cpp | 98 +++++++--- test/support/count_new.hpp | 169 +++++++++++++++++- test/support/test_macros.h | 6 + 9 files changed, 343 insertions(+), 87 deletions(-) diff --git a/include/__config b/include/__config index f96d74374..d150ede18 100644 --- a/include/__config +++ b/include/__config @@ -955,6 +955,7 @@ template struct __static_assert_check {}; # endif #endif // defined(__APPLE__) + #if defined(__APPLE__) || defined(__FreeBSD__) #define _LIBCPP_HAS_DEFAULTRUNELOCALE #endif diff --git a/include/__sso_allocator b/include/__sso_allocator index 8147e75ec..40027363a 100644 --- a/include/__sso_allocator +++ b/include/__sso_allocator @@ -55,14 +55,14 @@ public: __allocated_ = true; return (pointer)&buf_; } - return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) { if (__p == (pointer)&buf_) __allocated_ = false; else - _VSTD::__libcpp_deallocate(__p); + _VSTD::__libcpp_deallocate(__p, __alignof(_Tp)); } _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);} diff --git a/include/memory b/include/memory index ea52ba2cb..021bd136a 100644 --- a/include/memory +++ b/include/memory @@ -1796,10 +1796,10 @@ public: if (__n > max_size()) __throw_length_error("allocator::allocate(size_t n)" " 'n' exceeds maximum supported size"); - return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {_VSTD::__libcpp_deallocate((void*)__p);} + {_VSTD::__libcpp_deallocate((void*)__p, __alignof(_Tp));} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -1897,10 +1897,10 @@ public: if (__n > max_size()) __throw_length_error("allocator::allocate(size_t n)" " 'n' exceeds maximum supported size"); - return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p));} + {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __alignof(_Tp));} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -2016,12 +2016,7 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT while (__n > 0) { #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) -#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) - if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -#else - if (std::alignment_of<_Tp>::value > - std::alignment_of::value) -#endif + if (__is_overaligned_for_new(__alignof(_Tp))) { std::align_val_t __al = std::align_val_t(std::alignment_of<_Tp>::value); @@ -2032,12 +2027,7 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT __n * sizeof(_Tp), nothrow)); } #else -#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) - if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -#else - if (std::alignment_of<_Tp>::value > - std::alignment_of::value) -#endif + if (__is_overaligned_for_new(__alignof(_Tp))) { // Since aligned operator new is unavailable, return an empty // buffer rather than one with invalid alignment. @@ -2061,20 +2051,7 @@ template inline _LIBCPP_INLINE_VISIBILITY void return_temporary_buffer(_Tp* __p) _NOEXCEPT { -#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) -#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) - if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -#else - if (std::alignment_of<_Tp>::value > - std::alignment_of::value) -#endif - { - std::align_val_t __al = std::align_val_t(std::alignment_of<_Tp>::value); - ::operator delete(__p, __al); - return; - } -#endif - ::operator delete(__p); + _VSTD::__libcpp_deallocate((void*)__p, __alignof(_Tp)); } #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) diff --git a/include/new b/include/new index 27c248c83..e42ffad27 100644 --- a/include/new +++ b/include/new @@ -89,6 +89,7 @@ void operator delete[](void* ptr, void*) noexcept; #include <__config> #include +#include #include #ifdef _LIBCPP_NO_EXCEPTIONS #include @@ -113,6 +114,14 @@ void operator delete[](void* ptr, void*) noexcept; # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION #endif + +#if !__has_builtin(__builtin_operator_new) || \ + __has_builtin(__builtin_operator_new) < 201802L || \ + defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ + !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606 +#define _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE +#endif + namespace std // purposefully not using versioning namespace { @@ -223,7 +232,27 @@ inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT _LIBCPP_BEGIN_NAMESPACE_STD -inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { +_LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT { +#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ + return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__; +#else + return __align > alignment_of::value; +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) { +#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) { + const align_val_t __align_val = static_cast(__align); +# ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE + return ::operator new(__size, __align_val); +# else + return __builtin_operator_new(__size, __align_val); +# endif + } +#else + ((void)__align); +#endif #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE return ::operator new(__size); #else @@ -231,11 +260,23 @@ inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { #endif } -inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) { -#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE - ::operator delete(__ptr); +inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __align) { +#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) { + const align_val_t __align_val = static_cast(__align); +# ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE + return ::operator delete(__ptr, __align_val); +# else + return __builtin_operator_delete(__ptr, __align_val); +# endif + } #else - __builtin_operator_delete(__ptr); + ((void)__align); +#endif +#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE + return ::operator delete(__ptr); +#else + return __builtin_operator_delete(__ptr); #endif } diff --git a/include/valarray b/include/valarray index b495ccf57..8d3892ad3 100644 --- a/include/valarray +++ b/include/valarray @@ -2738,7 +2738,8 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(result_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(result_type), __alignof(result_type))); for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i) ::new (__r.__end_) result_type(__expr_[__i]); } @@ -2755,7 +2756,8 @@ valarray<_Tp>::valarray(size_t __n) { if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2789,7 +2791,8 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n) { if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2814,7 +2817,8 @@ valarray<_Tp>::valarray(const valarray& __v) { if (__v.size()) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__v.size() * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__v.size() * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2851,7 +2855,8 @@ valarray<_Tp>::valarray(initializer_list __il) size_t __n = __il.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( +_VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2879,7 +2884,8 @@ valarray<_Tp>::valarray(const slice_array& __sa) size_t __n = __sa.__size_; if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2905,7 +2911,8 @@ valarray<_Tp>::valarray(const gslice_array& __ga) size_t __n = __ga.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2934,7 +2941,8 @@ valarray<_Tp>::valarray(const mask_array& __ma) size_t __n = __ma.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2963,7 +2971,8 @@ valarray<_Tp>::valarray(const indirect_array& __ia) size_t __n = __ia.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2999,7 +3008,8 @@ valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) if (size() != __n) { __clear(); - __begin_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); __end_ = __begin_ + __n; _VSTD::uninitialized_copy(__f, __l, __begin_); } else { @@ -3254,7 +3264,8 @@ valarray<_Tp>::operator+() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(+*__p); } @@ -3271,7 +3282,8 @@ valarray<_Tp>::operator-() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(-*__p); } @@ -3288,7 +3300,8 @@ valarray<_Tp>::operator~() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(~*__p); } @@ -3305,7 +3318,7 @@ valarray<_Tp>::operator!() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(bool))); + static_cast(_VSTD::__libcpp_allocate(__n * sizeof(bool), __alignof(bool))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) bool(!*__p); } @@ -3625,7 +3638,8 @@ valarray<_Tp>::shift(int __i) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); const value_type* __sb; value_type* __tb; value_type* __te; @@ -3663,7 +3677,8 @@ valarray<_Tp>::cshift(int __i) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); __i %= static_cast(__n); const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i; for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s) @@ -3684,7 +3699,8 @@ valarray<_Tp>::apply(value_type __f(value_type)) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(__f(*__p)); } @@ -3701,7 +3717,8 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(__f(*__p)); } @@ -3716,7 +3733,7 @@ valarray<_Tp>::__clear() { while (__end_ != __begin_) (--__end_)->~value_type(); - _VSTD::__libcpp_deallocate(__begin_); + _VSTD::__libcpp_deallocate(__begin_, __alignof(value_type)); __begin_ = __end_ = nullptr; } } @@ -3728,7 +3745,8 @@ valarray<_Tp>::resize(size_t __n, value_type __x) __clear(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { diff --git a/src/experimental/memory_resource.cpp b/src/experimental/memory_resource.cpp index c4dc1ca89..a6eca3743 100644 --- a/src/experimental/memory_resource.cpp +++ b/src/experimental/memory_resource.cpp @@ -31,10 +31,10 @@ public: protected: virtual void* do_allocate(size_t __size, size_t __align) - { return __allocate(__size); } + { return _VSTD::__libcpp_allocate(__size, __align); /* FIXME */} - virtual void do_deallocate(void * __p, size_t, size_t) - { _VSTD::__libcpp_deallocate(__p); } + virtual void do_deallocate(void * __p, size_t, size_t __align) + { _VSTD::__libcpp_deallocate(__p, __align); /* FIXME */ } virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT { return &__other == this; } diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp index f2cf9f2d4..930da0b79 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp @@ -15,39 +15,93 @@ #include #include +#include "test_macros.h" #include "count_new.hpp" -int A_constructed = 0; -struct A -{ - int data; - A() {++A_constructed;} - A(const A&) {++A_constructed;} - ~A() {--A_constructed;} +#ifdef TEST_HAS_NO_ALIGNED_ALLOCATION +static const bool UsingAlignedNew = false; +#else +static const bool UsingAlignedNew = true; +#endif + +#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ +static const size_t MaxAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__; +#else +static const size_t MaxAligned = std::alignment_of::value; +#endif + +static const size_t OverAligned = MaxAligned * 2; + + +template +struct TEST_ALIGNAS(Align) AlignedType { + char data; + static int constructed; + AlignedType() { ++constructed; } + AlignedType(AlignedType const&) { ++constructed; } + ~AlignedType() { --constructed; } }; +template +int AlignedType::constructed = 0; -int main() -{ - globalMemCounter.reset(); - std::allocator a; + +template +void test_aligned() { + typedef AlignedType T; + T::constructed = 0; + globalMemCounter.reset(); + std::allocator a; + const bool IsOverAlignedType = Align > MaxAligned; + const bool ExpectAligned = IsOverAlignedType && UsingAlignedNew; + { assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A_constructed == 0); + assert(T::constructed == 0); globalMemCounter.last_new_size = 0; - A* volatile ap = a.allocate(3); + globalMemCounter.last_new_align = 0; + T* volatile ap = a.allocate(3); assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); - assert(A_constructed == 0); + assert(globalMemCounter.checkNewCalledEq(1)); + assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(T))); + assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + globalMemCounter.last_delete_align = 0; a.deallocate(ap, 3); assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A_constructed == 0); - + assert(globalMemCounter.checkDeleteCalledEq(1)); + assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + } + globalMemCounter.reset(); + { globalMemCounter.last_new_size = 0; - A* volatile ap2 = a.allocate(3, (const void*)5); + globalMemCounter.last_new_align = 0; + T* volatile ap2 = a.allocate(11, (const void*)5); assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); - assert(A_constructed == 0); - a.deallocate(ap2, 3); + assert(globalMemCounter.checkNewCalledEq(1)); + assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastNewSizeEq(11 * sizeof(T))); + assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + globalMemCounter.last_delete_align = 0; + a.deallocate(ap2, 11); assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A_constructed == 0); + assert(globalMemCounter.checkDeleteCalledEq(1)); + assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + } +} + +int main() { + test_aligned<1>(); + test_aligned<2>(); + test_aligned<4>(); + test_aligned<8>(); + test_aligned<16>(); + test_aligned(); + test_aligned(); + test_aligned(); } diff --git a/test/support/count_new.hpp b/test/support/count_new.hpp index c001c0340..e3111e7a5 100644 --- a/test/support/count_new.hpp +++ b/test/support/count_new.hpp @@ -59,12 +59,20 @@ public: int outstanding_new; int new_called; int delete_called; + int aligned_new_called; + int aligned_delete_called; std::size_t last_new_size; + std::size_t last_new_align; + std::size_t last_delete_align; int outstanding_array_new; int new_array_called; int delete_array_called; + int aligned_new_array_called; + int aligned_delete_array_called; std::size_t last_new_array_size; + std::size_t last_new_array_align; + std::size_t last_delete_array_align; public: void newCalled(std::size_t s) @@ -82,6 +90,12 @@ public: last_new_size = s; } + void alignedNewCalled(std::size_t s, std::size_t a) { + newCalled(s); + ++aligned_new_called; + last_new_align = a; + } + void deleteCalled(void * p) { assert(p); @@ -89,6 +103,12 @@ public: ++delete_called; } + void alignedDeleteCalled(void *p, std::size_t a) { + deleteCalled(p); + ++aligned_delete_called; + last_delete_align = a; + } + void newArrayCalled(std::size_t s) { assert(disable_allocations == false); @@ -104,6 +124,12 @@ public: last_new_array_size = s; } + void alignedNewArrayCalled(std::size_t s, std::size_t a) { + newArrayCalled(s); + ++aligned_new_array_called; + last_new_array_align = a; + } + void deleteArrayCalled(void * p) { assert(p); @@ -111,6 +137,12 @@ public: ++delete_array_called; } + void alignedDeleteArrayCalled(void * p, std::size_t a) { + deleteArrayCalled(p); + ++aligned_delete_array_called; + last_delete_array_align = a; + } + void disableAllocations() { disable_allocations = true; @@ -121,7 +153,6 @@ public: disable_allocations = false; } - void reset() { disable_allocations = false; @@ -130,12 +161,18 @@ public: outstanding_new = 0; new_called = 0; delete_called = 0; + aligned_new_called = 0; + aligned_delete_called = 0; last_new_size = 0; + last_new_align = 0; outstanding_array_new = 0; new_array_called = 0; delete_array_called = 0; + aligned_new_array_called = 0; + aligned_delete_array_called = 0; last_new_array_size = 0; + last_new_array_align = 0; } public: @@ -174,6 +211,31 @@ public: return disable_checking || n != delete_called; } + bool checkAlignedNewCalledEq(int n) const + { + return disable_checking || n == aligned_new_called; + } + + bool checkAlignedNewCalledNotEq(int n) const + { + return disable_checking || n != aligned_new_called; + } + + bool checkAlignedNewCalledGreaterThan(int n) const + { + return disable_checking || aligned_new_called > n; + } + + bool checkAlignedDeleteCalledEq(int n) const + { + return disable_checking || n == aligned_delete_called; + } + + bool checkAlignedDeleteCalledNotEq(int n) const + { + return disable_checking || n != aligned_delete_called; + } + bool checkLastNewSizeEq(std::size_t n) const { return disable_checking || n == last_new_size; @@ -184,6 +246,26 @@ public: return disable_checking || n != last_new_size; } + bool checkLastNewAlignEq(std::size_t n) const + { + return disable_checking || n == last_new_align; + } + + bool checkLastNewAlignNotEq(std::size_t n) const + { + return disable_checking || n != last_new_align; + } + + bool checkLastDeleteAlignEq(std::size_t n) const + { + return disable_checking || n == last_delete_align; + } + + bool checkLastDeleteAlignNotEq(std::size_t n) const + { + return disable_checking || n != last_delete_align; + } + bool checkOutstandingArrayNewEq(int n) const { return disable_checking || n == outstanding_array_new; @@ -214,6 +296,31 @@ public: return disable_checking || n != delete_array_called; } + bool checkAlignedNewArrayCalledEq(int n) const + { + return disable_checking || n == aligned_new_array_called; + } + + bool checkAlignedNewArrayCalledNotEq(int n) const + { + return disable_checking || n != aligned_new_array_called; + } + + bool checkAlignedNewArrayCalledGreaterThan(int n) const + { + return disable_checking || aligned_new_array_called > n; + } + + bool checkAlignedDeleteArrayCalledEq(int n) const + { + return disable_checking || n == aligned_delete_array_called; + } + + bool checkAlignedDeleteArrayCalledNotEq(int n) const + { + return disable_checking || n != aligned_delete_array_called; + } + bool checkLastNewArraySizeEq(std::size_t n) const { return disable_checking || n == last_new_array_size; @@ -223,6 +330,16 @@ public: { return disable_checking || n != last_new_array_size; } + + bool checkLastNewArrayAlignEq(std::size_t n) const + { + return disable_checking || n == last_new_array_align; + } + + bool checkLastNewArrayAlignNotEq(std::size_t n) const + { + return disable_checking || n != last_new_array_align; + } }; #ifdef DISABLE_NEW_COUNT @@ -254,22 +371,65 @@ void operator delete(void* p) TEST_NOEXCEPT std::free(p); } - void* operator new[](std::size_t s) TEST_THROW_SPEC(std::bad_alloc) { getGlobalMemCounter()->newArrayCalled(s); return operator new(s); } - void operator delete[](void* p) TEST_NOEXCEPT { getGlobalMemCounter()->deleteArrayCalled(p); operator delete(p); } -#endif // DISABLE_NEW_COUNT +#ifndef TEST_HAS_NO_ALIGNED_ALLOCATION +#if defined(_LIBCPP_MSVCRT_LIKE) || \ + (!defined(_LIBCPP_VERSION) && defined(_WIN32)) +#define USE_ALIGNED_ALLOC +#endif +void* operator new(std::size_t s, std::align_val_t av) TEST_THROW_SPEC(std::bad_alloc) { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedNewCalled(s, a); + void *ret; +#ifdef USE_ALIGNED_ALLOC + ret = _aligned_malloc(s, a); +#else + posix_memalign(&ret, a, s); +#endif + if (ret == nullptr) + detail::throw_bad_alloc_helper(); + return ret; +} + +void operator delete(void *p, std::align_val_t av) TEST_NOEXCEPT { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedDeleteCalled(p, a); + if (p) { +#ifdef USE_ALIGNED_ALLOC + ::_aligned_free(p); +#else + ::free(p); +#endif + } +} + +void* operator new[](std::size_t s, std::align_val_t av) TEST_THROW_SPEC(std::bad_alloc) { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedNewArrayCalled(s, a); + return operator new(s, av); +} + +void operator delete[](void *p, std::align_val_t av) TEST_NOEXCEPT { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedDeleteArrayCalled(p, a); + return operator delete(p, av); +} + +#endif // TEST_HAS_NO_ALIGNED_ALLOCATION + +#endif // DISABLE_NEW_COUNT struct DisableAllocationGuard { explicit DisableAllocationGuard(bool disable = true) : m_disabled(disable) @@ -295,7 +455,6 @@ private: DisableAllocationGuard& operator=(DisableAllocationGuard const&); }; - struct RequireAllocationGuard { explicit RequireAllocationGuard(std::size_t RequireAtLeast = 1) : m_req_alloc(RequireAtLeast), diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 257875a35..06800bdd3 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -157,6 +157,11 @@ #define TEST_NORETURN [[noreturn]] #endif +#if !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606L || \ + defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) +#define TEST_HAS_NO_ALIGNED_ALLOCATION +#endif + #if defined(_LIBCPP_SAFE_STATIC) #define TEST_SAFE_STATIC _LIBCPP_SAFE_STATIC #else @@ -228,6 +233,7 @@ inline void DoNotOptimize(Tp const& value) { } #endif + #if defined(__GNUC__) #pragma GCC diagnostic pop #endif From f4f3025362f07982d0d90e5436562901aa636bbb Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 05:44:48 +0000 Subject: [PATCH 049/176] Fix dynarray test failures after changing __libcpp_allocate/deallocate git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328182 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/dynarray | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/experimental/dynarray b/include/experimental/dynarray index 16193317a..cebfc208d 100644 --- a/include/experimental/dynarray +++ b/include/experimental/dynarray @@ -135,17 +135,18 @@ private: value_type * __base_; _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {} - static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count ) - { - if ( numeric_limits::max() / sizeof (value_type) <= count ) + static inline _LIBCPP_INLINE_VISIBILITY + value_type* __allocate(size_t __count) { + if (numeric_limits::max() / sizeof (value_type) <= __count) __throw_bad_array_length(); - return static_cast (_VSTD::__allocate (sizeof(value_type) * count)); + return static_cast( + _VSTD::__libcpp_allocate(sizeof(value_type) * __count, __alignof(value_type))); } - static inline _LIBCPP_INLINE_VISIBILITY void __deallocate_value( value_type* __ptr ) noexcept - { - _VSTD::__libcpp_deallocate (static_cast (__ptr)); + static inline _LIBCPP_INLINE_VISIBILITY + void __deallocate_value(value_type* __ptr ) noexcept { + _VSTD::__libcpp_deallocate(static_cast(__ptr), __alignof(value_type)); } public: From 6d7a11eb53295570453ba6a1b0935d4a7035aa5a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 06:21:07 +0000 Subject: [PATCH 050/176] Correct TEST_HAS_NO_ALIGNED_ALLOCATION macro definition git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328185 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/support/test_macros.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 06800bdd3..42eed4ce4 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -157,8 +157,9 @@ #define TEST_NORETURN [[noreturn]] #endif -#if !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606L || \ - defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) +#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ + (!(TEST_STD_VER > 14 || \ + (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L))) #define TEST_HAS_NO_ALIGNED_ALLOCATION #endif From 959c89de1f79f3f9bb7e603bb1dd96e3f8408bc9 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 07:53:47 +0000 Subject: [PATCH 051/176] commit temporary workaround for new Clang exception warning git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328186 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/libcxx/test/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 2af4a473e..24bbbd523 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -918,6 +918,11 @@ class Configuration(object): self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals') self.cxx.addWarningFlagIfSupported('-Wno-noexcept-type') self.cxx.addWarningFlagIfSupported('-Wno-aligned-allocation-unavailable') + # FIXME: Remove this work-around. It is a temporary hack to get the + # throwing debug tests passing. For example: + # * test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp + # * test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp + self.cxx.addWarningFlagIfSupported("-Wno-exceptions") # These warnings should be enabled in order to support the MSVC # team using the test suite; They enable the warnings below and # expect the test suite to be clean. From e9e128b0a656d3c0ac58fc896a7d23565b4f25c1 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 22 Mar 2018 18:27:28 +0000 Subject: [PATCH 052/176] Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328225 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ostream | 4 +--- .../memory/unique.ptr/unique.ptr.special/io.fail.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/ostream b/include/ostream index f3250a708..197636eac 100644 --- a/include/ostream +++ b/include/ostream @@ -1071,19 +1071,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) return __os << __p.get(); } -#ifndef _LIBCPP_HAS_NO_DECLTYPE template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_same&>() << declval<_Yp>())>::type>::value, + is_same&>() << declval::pointer>()))>::type>::value, basic_ostream<_CharT, _Traits>& >::type operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) { return __os << __p.get(); } -#endif template basic_ostream<_CharT, _Traits>& diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp index 48c90f7b9..54c85e943 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp @@ -24,11 +24,12 @@ #include #include -class A {}; +#include "min_allocator.h" +#include "deleter_types.h" int main() { - std::unique_ptr p(new A); + std::unique_ptr> p; std::ostringstream os; - os << p; + os << p; // expected-error {{invalid operands to binary expression}} } From b7f27d421f98e10c4cc9f10b47ec100955c3aaa7 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 19:18:08 +0000 Subject: [PATCH 053/176] Un-XFAIL a test under new GCC version; the GCC bug has been fixed git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328229 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../function.objects/comparisons/constexpr_init.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp b/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp index 6ebca1e3c..abb80d06d 100644 --- a/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp +++ b/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: gcc-7, gcc-8 +// XFAIL: gcc-7 // From b06c8f07b24c63eac7a69153a47d12893fe7dd68 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 21:28:09 +0000 Subject: [PATCH 054/176] Use DoNotOptimize to prevent new/delete elision. The new/delete tests, in particular those which test replacement functions, often fail when the optimizer is enabled because the calls to new/delete may be optimized away, regardless of their side-effects. This patch converts the tests to use DoNotOptimize in order to prevent the elision. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328245 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../delete_align_val_t_replace.pass.cpp | 11 ++++++----- .../new_align_val_t_replace.pass.cpp | 5 ++++- .../new.delete/new.delete.array/new_array.pass.cpp | 6 ++++-- .../new.delete.array/new_array_nothrow.pass.cpp | 5 ++++- .../new_array_nothrow_replace.pass.cpp | 8 ++++---- .../new.delete.array/new_array_replace.pass.cpp | 8 ++++---- ...elete_array_calls_unsized_delete_array.pass.cpp | 6 +++--- .../delete_align_val_t_replace.pass.cpp | 11 ++++++----- .../new_align_val_t_replace.pass.cpp | 5 ++++- .../new.delete.single/new_nothrow_replace.pass.cpp | 6 +++--- .../new.delete.single/new_replace.pass.cpp | 6 +++--- .../new.delete.single/sized_delete11.pass.cpp | 6 +++--- .../new.delete.single/sized_delete14.pass.cpp | 6 +++--- .../sized_delete_calls_unsized_delete.pass.cpp | 6 +++--- .../sized_delete_fsizeddeallocation.sh.cpp | 6 +++--- .../allocator.members/allocate.pass.cpp | 6 +++++- test/support/test_macros.h | 14 ++++++++++++-- 17 files changed, 74 insertions(+), 47 deletions(-) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp index 828feabd2..2175e29a0 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp @@ -69,31 +69,32 @@ void operator delete [] (void* p, std::align_val_t) TEST_NOEXCEPT struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; -B* volatile b; // Escape the memory -A* volatile a; - int main() { reset(); { - b = new B[2]; + B *b = new B[2]; + DoNotOptimize(b); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] b; + DoNotOptimize(b); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { - a = new A[2]; + A *a = new A[2]; + DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] a; + DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp index 82dc77efe..d8e08a3a0 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp @@ -53,7 +53,9 @@ void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad assert(s <= sizeof(DummyData)); assert(static_cast(a) == OverAligned); ++new_called; - return DummyData; + void *Ret = DummyData; + DoNotOptimize(Ret); + return Ret; } void operator delete[](void* p, std::align_val_t) TEST_NOEXCEPT @@ -61,6 +63,7 @@ void operator delete[](void* p, std::align_val_t) TEST_NOEXCEPT assert(new_called == 1); --new_called; assert(p == DummyData); + DoNotOptimize(p); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp index 5aecc2da0..58ff728e6 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp @@ -41,8 +41,8 @@ int main() std::set_new_handler(my_new_handler); try { - void* volatile vp = operator new[] (std::numeric_limits::max()); - ((void)vp); + void* vp = operator new[] (std::numeric_limits::max()); + DoNotOptimize(vp); assert(false); } catch (std::bad_alloc&) @@ -55,8 +55,10 @@ int main() } #endif A* ap = new A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp index c1606b27d..f29f0c09e 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp @@ -42,7 +42,8 @@ int main() try #endif { - void*volatile vp = operator new [] (std::numeric_limits::max(), std::nothrow); + void* vp = operator new [] (std::numeric_limits::max(), std::nothrow); + DoNotOptimize(vp); assert(new_handler_called == 1); assert(vp == 0); } @@ -53,8 +54,10 @@ int main() } #endif A* ap = new(std::nothrow) A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp index ba3f930c5..3d8467faa 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp @@ -36,7 +36,7 @@ void operator delete(void* p) TEST_NOEXCEPT std::free(p); } -volatile int A_constructed = 0; +int A_constructed = 0; struct A { @@ -44,15 +44,15 @@ struct A ~A() {--A_constructed;} }; -A* volatile ap; - int main() { - ap = new (std::nothrow) A[3]; + A *ap = new (std::nothrow) A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); assert(new_called); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); assert(!new_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp index 3f8122745..ad4d9f469 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp @@ -21,7 +21,7 @@ #include "test_macros.h" -volatile int new_called = 0; +int new_called = 0; void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc) { @@ -45,15 +45,15 @@ struct A ~A() {--A_constructed;} }; -A* volatile ap; - int main() { - ap = new A[3]; + A *ap = new A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); assert(new_called == 1); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); assert(new_called == 0); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp index 3925f2f5c..a988b803d 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp @@ -46,15 +46,15 @@ void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT // selected. struct A { ~A() {} }; -A *volatile x; - int main() { - x = new A[3]; + A *x = new A[3]; + DoNotOptimize(x); assert(0 == delete_called); assert(0 == delete_nothrow_called); delete [] x; + DoNotOptimize(x); assert(1 == delete_called); assert(0 == delete_nothrow_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp index d64a63300..6f1c75112 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp @@ -68,31 +68,32 @@ void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; -B* volatile bp; -A* volatile ap; - int main() { reset(); { - bp = new B; + B *bp = new B; + DoNotOptimize(bp); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete bp; + DoNotOptimize(bp); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { - ap = new A; + A *ap = new A; + DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete ap; + DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp index bace5c036..2dd4631e7 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp @@ -53,7 +53,9 @@ void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_a assert(s <= sizeof(DummyData)); assert(static_cast(a) == OverAligned); ++new_called; - return DummyData; + void *Ret = DummyData; + DoNotOptimize(Ret); + return Ret; } void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT @@ -61,6 +63,7 @@ void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT assert(new_called == 1); --new_called; assert(p == DummyData); + DoNotOptimize(DummyData); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp index 31e190151..a0e3eda57 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp @@ -44,15 +44,15 @@ struct A ~A() {A_constructed = false;} }; -A* volatile ap; - int main() { - ap = new (std::nothrow) A; + A *ap = new (std::nothrow) A; + DoNotOptimize(ap); assert(ap); assert(A_constructed); assert(new_called); delete ap; + DoNotOptimize(ap); assert(!A_constructed); assert(!new_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp index ea6c9367b..aa00fee56 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp @@ -43,15 +43,15 @@ struct A ~A() {A_constructed = false;} }; -A *volatile ap; - int main() { - ap = new A; + A *ap = new A; + DoNotOptimize(ap); assert(ap); assert(A_constructed); assert(new_called); delete ap; + DoNotOptimize(ap); assert(!A_constructed); assert(!new_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp index 3d947de42..d9e0f5ca3 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp @@ -44,16 +44,16 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } -int *volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == sized_delete_called); delete x; + DoNotOptimize(x); assert(1 == unsized_delete_called); assert(0 == sized_delete_called); assert(0 == unsized_delete_nothrow_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp index 7a76725a9..5b08eb4b8 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp @@ -49,16 +49,16 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } -int *volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == sized_delete_called); delete x; + DoNotOptimize(x); assert(0 == unsized_delete_called); assert(1 == sized_delete_called); assert(0 == unsized_delete_nothrow_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp index cb093f363..178e26db1 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp @@ -35,15 +35,15 @@ void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT std::free(p); } -int* volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == delete_called); assert(0 == delete_nothrow_called); delete x; + DoNotOptimize(x); assert(1 == delete_called); assert(0 == delete_nothrow_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp index 40de3a098..d5b610f71 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp @@ -62,16 +62,16 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } -int* volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == sized_delete_called); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); delete x; + DoNotOptimize(x); assert(1 == sized_delete_called); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp index 930da0b79..70c5e4696 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "test_macros.h" #include "count_new.hpp" @@ -59,7 +60,8 @@ void test_aligned() { assert(T::constructed == 0); globalMemCounter.last_new_size = 0; globalMemCounter.last_new_align = 0; - T* volatile ap = a.allocate(3); + T* ap = a.allocate(3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkNewCalledEq(1)); assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); @@ -79,6 +81,7 @@ void test_aligned() { globalMemCounter.last_new_size = 0; globalMemCounter.last_new_align = 0; T* volatile ap2 = a.allocate(11, (const void*)5); + DoNotOptimize(ap2); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkNewCalledEq(1)); assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); @@ -87,6 +90,7 @@ void test_aligned() { assert(T::constructed == 0); globalMemCounter.last_delete_align = 0; a.deallocate(ap2, 11); + DoNotOptimize(ap2); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(globalMemCounter.checkDeleteCalledEq(1)); assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned)); diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 42eed4ce4..848f14076 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -221,8 +221,18 @@ struct is_same { enum {value = 1}; }; #if defined(__GNUC__) || defined(__clang__) template -inline void DoNotOptimize(Tp const& value) { - asm volatile("" : : "g"(value) : "memory"); +inline +void DoNotOptimize(Tp const& value) { + asm volatile("" : : "r,m"(value) : "memory"); +} + +template +inline void DoNotOptimize(Tp& value) { +#if defined(__clang__) + asm volatile("" : "+r,m"(value) : : "memory"); +#else + asm volatile("" : "+m,r"(value) : : "memory"); +#endif } #else #include From 493b609b272b6f59e737d9ad04be71b0fc10edc2 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 22:32:55 +0000 Subject: [PATCH 055/176] Workaround GCC bug PR78489 - SFINAE order is not respected. This patch works around variant test failures which are new to GCC 8. GCC 8 either doesn't perform SFINAE in lexical order, or it doesn't halt after encountering the first failure. This causes hard error to occur instead of substitution failure. See gcc.gnu.org/PR78489 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328261 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/variant | 29 ++++++++----------- .../in_place_index_init_list_args.pass.cpp | 6 ++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/variant b/include/variant index f9098f422..6f78e2de1 100644 --- a/include/variant +++ b/include/variant @@ -1156,29 +1156,24 @@ public: : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template , - class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, - enable_if_t, int> = 0> + enable_if_t<(_Ip < sizeof...(_Types)), size_t> _Ip2 = _Ip, + class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, + enable_if_t::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant( - in_place_index_t<_Ip>, - _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) + explicit constexpr variant(in_place_index_t<_Ip>, + _Args&&... __args) + noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} - template < - size_t _Ip, - class _Up, - class... _Args, - enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, - class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, + template _Ip2 = _Ip, + class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant( - in_place_index_t<_Ip>, - initializer_list<_Up> __il, - _Args&&... __args) noexcept( - is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) + explicit constexpr variant(in_place_index_t<_Ip>, initializer_list<_Up> __il, + _Args&&... __args) + noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} template < diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp index 608cdf9d6..9d0bf55fb 100644 --- a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp +++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp @@ -73,6 +73,12 @@ void test_ctor_sfinae() { !std::is_constructible, IL>::value, ""); static_assert(!test_convertible, IL>(), ""); } + { // index not in variant + using V = std::variant; + static_assert( + !std::is_constructible, IL>::value, ""); + static_assert(!test_convertible, IL>(), ""); + } } void test_ctor_basic() { From 111f042e6c13b8987bcbe4133f48c1ac03b4a8e5 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 22 Mar 2018 22:59:02 +0000 Subject: [PATCH 056/176] [libcxx] [test] Strip trailing whitespace. NFC. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328264 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.modifiers/clear_and_shrink_db1.pass.cpp | 4 ++-- test/std/language.support/support.types/max_align_t.pass.cpp | 2 +- .../memory/default.allocator/allocator.ctor.pass.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp index b7e278b75..920c0d185 100644 --- a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp +++ b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp @@ -25,12 +25,12 @@ int main() assert(l.__invariants()); assert(s.__invariants()); - + s.__clear_and_shrink(); assert(s.__invariants()); assert(s.size() == 0); - { + { std::string::size_type cap = l.capacity(); l.__clear_and_shrink(); assert(l.__invariants()); diff --git a/test/std/language.support/support.types/max_align_t.pass.cpp b/test/std/language.support/support.types/max_align_t.pass.cpp index dc202897a..b7fe0ac64 100644 --- a/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/test/std/language.support/support.types/max_align_t.pass.cpp @@ -10,7 +10,7 @@ #include #include -// max_align_t is a trivial standard-layout type whose alignment requirement +// max_align_t is a trivial standard-layout type whose alignment requirement // is at least as great as that of every scalar type #include diff --git a/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp index 3841cb533..0afab685f 100644 --- a/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp @@ -46,5 +46,5 @@ int main() constexpr AL a3{a2}; (void) a3; } - + } From 73e00f8321b13559b3c41f6656686d980fe92fbe Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 23:01:08 +0000 Subject: [PATCH 057/176] Avoid Clang error about throwing _LIBCPP_ASSERT in noexcept function. This fixes a couple of tests which produced a warning that a 'throw' occurred in a noexcept function (by way of _LIBCPP_ASSERT). It does so by hiding the 'throw' across an opaque function boundary. This fix isn't ideal, since we still have _LIBCPP_ASSERT's in functions marked noexcept -- and this problem should be addressed in the future. However, throwing _LIBCPP_ASSERT is really only meant to allow testing of the assertions, and is not yet ready for general use. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328265 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../class.path/path.itr/iterator_db.pass.cpp | 19 +++++++++++-------- .../futures.promise/set_exception.pass.cpp | 13 +++++++------ .../set_exception_at_thread_exit.pass.cpp | 13 +++++++------ utils/libcxx/test/config.py | 5 ----- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp index aea46f10c..b8b7124ad 100644 --- a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp +++ b/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp @@ -10,13 +10,15 @@ // UNSUPPORTED: c++98, c++03 // UNSUPPORTED: libcpp-no-exceptions +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// MODULES_DEFINES: _LIBCPP_DEBUG=0 + // // class path #define _LIBCPP_DEBUG 0 -#define _LIBCPP_ASSERT(cond, msg) ((cond) ? ((void)0) : throw 42) - +#define _LIBCPP_DEBUG_USE_EXCEPTIONS #include #include #include @@ -29,17 +31,18 @@ namespace fs = std::experimental::filesystem; int main() { using namespace fs; + using ExType = std::__libcpp_debug_exception; // Test incrementing/decrementing a singular iterator { path::iterator singular; try { ++singular; assert(false); - } catch (int) {} + } catch (ExType const&) {} try { --singular; assert(false); - } catch (int) {} + } catch (ExType const&) {} } // Test decrementing the begin iterator { @@ -48,13 +51,13 @@ int main() { try { --it; assert(false); - } catch (int) {} + } catch (ExType const&) {} ++it; ++it; try { ++it; assert(false); - } catch (int) {} + } catch (ExType const&) {} } // Test incrementing the end iterator { @@ -63,12 +66,12 @@ int main() { try { ++it; assert(false); - } catch (int) {} + } catch (ExType const&) {} --it; --it; try { --it; assert(false); - } catch (int) {} + } catch (ExType const&) {} } } diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index 9efa597d7..abfbb685d 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -11,6 +11,9 @@ // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// MODULES_DEFINES: _LIBCPP_DEBUG=0 + // // class promise @@ -18,9 +21,8 @@ // void set_exception(exception_ptr p); // Test that a null exception_ptr is diagnosed. -#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42) - #define _LIBCPP_DEBUG 0 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS #include #include #include @@ -29,14 +31,14 @@ int main() { + typedef std::__libcpp_debug_exception ExType; { typedef int T; std::promise p; try { p.set_exception(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const&) { } } { @@ -45,8 +47,7 @@ int main() try { p.set_exception(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const&) { } } } diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index dca493382..6736bae97 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -11,6 +11,9 @@ // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// MODULES_DEFINES: _LIBCPP_DEBUG=0 + // // class promise @@ -18,9 +21,8 @@ // void set_exception_on_thread_exit(exception_ptr p); // Test that a null exception_ptr is diagnosed. -#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42) - #define _LIBCPP_DEBUG 0 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS #include #include #include @@ -29,14 +31,14 @@ int main() { + typedef std::__libcpp_debug_exception ExType; { typedef int T; std::promise p; try { p.set_exception_at_thread_exit(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const& value) { } } { @@ -45,8 +47,7 @@ int main() try { p.set_exception_at_thread_exit(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const& value) { } } } diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 24bbbd523..2af4a473e 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -918,11 +918,6 @@ class Configuration(object): self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals') self.cxx.addWarningFlagIfSupported('-Wno-noexcept-type') self.cxx.addWarningFlagIfSupported('-Wno-aligned-allocation-unavailable') - # FIXME: Remove this work-around. It is a temporary hack to get the - # throwing debug tests passing. For example: - # * test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp - # * test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp - self.cxx.addWarningFlagIfSupported("-Wno-exceptions") # These warnings should be enabled in order to support the MSVC # team using the test suite; They enable the warnings below and # expect the test suite to be clean. From 078131e6d2dfabdb0e69216d070f91805650640a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 23:14:20 +0000 Subject: [PATCH 058/176] Add temporary printouts to test to help debug failures. Some debian libc++ bots started having failures in the locale tests due to what I assume is a change in the locale data for fr_FR in glibc. This change prints the actual value from the test to help debugging. It should be reverted once the bots cycle. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328268 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../locale.moneypunct.byname/decimal_point.pass.cpp | 6 ++++++ .../locale.numpunct.byname/thousands_sep.pass.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp index 4051d451f..09e6e94ca 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp @@ -21,6 +21,7 @@ #include #include #include +#include // FIXME: for debugging purposes only #include "test_macros.h" #include "platform_support.h" // locale name macros @@ -119,6 +120,11 @@ int main() #endif { Fnf f(LOCALE_ru_RU_UTF_8, 1); + if (f.decimal_point() != sep) { + std::cout << "f.decimal_point() = '" << f.decimal_point() << "'\n"; + std::cout << "sep = '" << sep << "'\n"; + std::cout << std::endl; + } assert(f.decimal_point() == sep); } { diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp index 38cbcfda4..08ce35bf5 100644 --- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp +++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp @@ -19,6 +19,7 @@ #include #include +#include // FIXME: for debugging purposes only #include "test_macros.h" #include "platform_support.h" // locale name macros @@ -63,6 +64,11 @@ int main() { typedef char C; const std::numpunct& np = std::use_facet >(l); + if (np.thousands_sep() != sep) { + std::cout << "np.thousands_sep() = '" << np.thousands_sep() << "'\n"; + std::cout << "sep = '" << sep << "'\n"; + std::cout << std::endl; + } assert(np.thousands_sep() == sep); } { From 5a424a985612452d4f7a3f02422207456d54a53e Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 23 Mar 2018 23:42:30 +0000 Subject: [PATCH 059/176] Partially Revert "Workaround GCC bug PR78489 - SFINAE order is not respected." This partially reverts commit r328261. The GCC bug has been fixed in trunk and has never existed in a released version. Therefore the changes to variant are unneeded. However, the additional tests have been left in place. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328388 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/variant | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/include/variant b/include/variant index 6f78e2de1..f9098f422 100644 --- a/include/variant +++ b/include/variant @@ -1156,24 +1156,29 @@ public: : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template _Ip2 = _Ip, - class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, - enable_if_t::value, int> = 0> + class = enable_if_t<(_Ip < sizeof...(_Types)), int>, + class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, + enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant(in_place_index_t<_Ip>, - _Args&&... __args) - noexcept(is_nothrow_constructible_v<_Tp, _Args...>) + explicit constexpr variant( + in_place_index_t<_Ip>, + _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} - template _Ip2 = _Ip, - class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, + template < + size_t _Ip, + class _Up, + class... _Args, + enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, + class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant(in_place_index_t<_Ip>, initializer_list<_Up> __il, - _Args&&... __args) - noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) + explicit constexpr variant( + in_place_index_t<_Ip>, + initializer_list<_Up> __il, + _Args&&... __args) noexcept( + is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} template < From 85e9de93e25a31a4e8ddfeb5cd7d255bb83749ac Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 25 Mar 2018 03:00:42 +0000 Subject: [PATCH 060/176] avoid new/delete ellision in construct.pass.cpp git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328445 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../default.allocator/allocator.members/construct.pass.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp index 28dadd831..9ba987440 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp @@ -63,6 +63,7 @@ int main() globalMemCounter.last_new_size = 0; A* ap = a.allocate(3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); assert(A_constructed == 0); @@ -100,6 +101,7 @@ int main() assert(A_constructed == 0); a.deallocate(ap, 3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(A_constructed == 0); } @@ -111,6 +113,7 @@ int main() globalMemCounter.last_new_size = 0; move_only* ap = a.allocate(3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); assert(move_only_constructed == 0); @@ -132,6 +135,7 @@ int main() assert(move_only_constructed == 0); a.deallocate(ap, 3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(move_only_constructed == 0); } From f1471a367b35d1d1fa4fff374b771ecf2671fb34 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 26 Mar 2018 05:46:57 +0000 Subject: [PATCH 061/176] Make filesystem tests generic between experimental and std versions. As I move towards implementing std::filesystem, there is a need to make the existing tests run against both the std and experimental versions. Additionally, it's helpful to allow running the tests against other implementations of filesystem. This patch converts the test to easily target either. First, it adds a filesystem_include.hpp header which is soley responsible for selecting and including the correct implementation. Second, it converts existing tests to use this header instead of including filesystem directly. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328475 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../directory_entry.cons.pass.cpp | 3 +-- .../directory_entry.mods.pass.cpp | 3 +-- .../directory_entry.obs/comparisons.pass.cpp | 3 +-- .../directory_entry.obs/path.pass.cpp | 3 +-- .../directory_entry.obs/status.pass.cpp | 2 +- .../symlink_status.pass.cpp | 2 +- .../directory_iterator.members/copy.pass.cpp | 4 ++-- .../copy_assign.pass.cpp | 4 ++-- .../directory_iterator.members/ctor.pass.cpp | 8 ++++---- .../default_ctor.pass.cpp | 3 +-- .../increment.pass.cpp | 4 ++-- .../directory_iterator.members/move.pass.cpp | 4 ++-- .../move_assign.pass.cpp | 4 ++-- .../begin_end.pass.cpp | 4 ++-- .../class.directory_iterator/types.pass.cpp | 3 +-- .../file_status.cons.pass.cpp | 3 +-- .../file_status.mods.pass.cpp | 3 +-- .../class.file_status/file_status.obs.pass.cpp | 3 +-- .../filesystem_error.members.pass.cpp | 3 +-- .../class.path/path.itr/iterator.pass.cpp | 3 +-- .../path.member/path.append.pass.cpp | 3 +-- .../path.assign/braced_init.pass.cpp | 3 +-- .../path.member/path.assign/copy.pass.cpp | 3 +-- .../path.member/path.assign/move.pass.cpp | 3 +-- .../path.member/path.assign/source.pass.cpp | 3 +-- .../path.member/path.compare.pass.cpp | 3 +-- .../path.member/path.concat.pass.cpp | 3 +-- .../path.member/path.construct/copy.pass.cpp | 3 +-- .../path.construct/default.pass.cpp | 3 +-- .../path.member/path.construct/move.pass.cpp | 3 +-- .../path.member/path.construct/source.pass.cpp | 3 +-- .../path.member/path.decompose/empty.fail.cpp | 5 ++--- .../path.decompose/path.decompose.pass.cpp | 3 +-- .../generic_string_alloc.pass.cpp | 3 +-- .../path.generic.obs/named_overloads.pass.cpp | 3 +-- .../path.member/path.modifiers/clear.pass.cpp | 3 +-- .../path.modifiers/make_preferred.pass.cpp | 3 +-- .../path.modifiers/remove_filename.pass.cpp | 3 +-- .../path.modifiers/replace_extension.pass.cpp | 3 +-- .../path.modifiers/replace_filename.pass.cpp | 3 +-- .../path.member/path.modifiers/swap.pass.cpp | 3 +-- .../path.member/path.native.obs/c_str.pass.cpp | 3 +-- .../path.native.obs/named_overloads.pass.cpp | 3 +-- .../path.native.obs/native.pass.cpp | 3 +-- .../path.native.obs/operator_string.pass.cpp | 3 +-- .../path.native.obs/string_alloc.pass.cpp | 3 +-- .../path.nonmember/append_op.pass.cpp | 3 +-- .../path.nonmember/path.factory.pass.cpp | 3 +-- .../class.path/path.nonmember/path.io.pass.cpp | 2 +- .../path.io.unicode_bug.pass.cpp | 2 +- .../class.path/path.nonmember/swap.pass.cpp | 3 +-- .../filesystem/class.path/synop.pass.cpp | 3 +-- .../rec.dir.itr.members/copy.pass.cpp | 4 ++-- .../rec.dir.itr.members/copy_assign.pass.cpp | 4 ++-- .../rec.dir.itr.members/ctor.pass.cpp | 8 ++++---- .../rec.dir.itr.members/depth.pass.cpp | 4 ++-- .../disable_recursion_pending.pass.cpp | 4 ++-- .../rec.dir.itr.members/increment.pass.cpp | 12 ++++++------ .../rec.dir.itr.members/move.pass.cpp | 4 ++-- .../rec.dir.itr.members/move_assign.pass.cpp | 4 ++-- .../rec.dir.itr.members/pop.pass.cpp | 4 ++-- .../recursion_pending.pass.cpp | 4 ++-- .../rec.dir.itr.nonmembers/begin_end.pass.cpp | 4 ++-- .../fs.enum/enum.copy_options.pass.cpp | 3 +-- .../fs.enum/enum.directory_options.pass.cpp | 3 +-- .../filesystem/fs.enum/enum.file_type.pass.cpp | 3 +-- .../filesystem/fs.enum/enum.perms.pass.cpp | 3 +-- .../file_time_type.pass.cpp | 4 ++-- .../fs.op.absolute/absolute.pass.cpp | 4 ++-- .../fs.op.canonical/canonical.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.copy/copy.pass.cpp | 5 ++--- .../fs.op.copy_file/copy_file.pass.cpp | 5 ++--- .../fs.op.copy_symlink/copy_symlink.pass.cpp | 5 ++--- .../create_directories.pass.cpp | 5 ++--- .../create_directory.pass.cpp | 5 ++--- .../create_directory_with_attributes.pass.cpp | 5 ++--- .../create_directory_symlink.pass.cpp | 5 ++--- .../create_hard_link.pass.cpp | 5 ++--- .../create_symlink.pass.cpp | 5 ++--- .../fs.op.current_path/current_path.pass.cpp | 4 ++-- .../fs.op.equivalent/equivalent.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.exists/exists.pass.cpp | 4 ++-- .../fs.op.file_size/file_size.pass.cpp | 4 ++-- .../fs.op.hard_lk_ct/hard_link_count.pass.cpp | 4 ++-- .../fs.op.is_block_file/is_block_file.pass.cpp | 4 ++-- .../is_character_file.pass.cpp | 4 ++-- .../fs.op.is_directory/is_directory.pass.cpp | 4 ++-- .../fs.op.is_empty/is_empty.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp | 4 ++-- .../fs.op.is_other/is_other.pass.cpp | 4 ++-- .../is_regular_file.pass.cpp | 4 ++-- .../fs.op.is_socket/is_socket.pass.cpp | 4 ++-- .../fs.op.is_symlink/is_symlink.pass.cpp | 4 ++-- .../last_write_time.pass.cpp | 4 ++-- .../fs.op.permissions/permissions.pass.cpp | 5 ++--- .../fs.op.read_symlink/read_symlink.pass.cpp | 5 ++--- .../fs.op.funcs/fs.op.remove/remove.pass.cpp | 5 ++--- .../fs.op.remove_all/remove_all.pass.cpp | 5 ++--- .../fs.op.funcs/fs.op.rename/rename.pass.cpp | 5 ++--- .../fs.op.resize_file/resize_file.pass.cpp | 5 ++--- .../fs.op.funcs/fs.op.space/space.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.status/status.pass.cpp | 4 ++-- .../fs.op.status_known/status_known.pass.cpp | 4 ++-- .../symlink_status.pass.cpp | 4 ++-- .../system_complete.pass.cpp | 4 ++-- .../temp_directory_path.pass.cpp | 4 ++-- .../fs.req.macros/feature_macro.pass.cpp | 2 +- test/support/filesystem_include.hpp | 18 ++++++++++++++++++ test/support/filesystem_test_helper.hpp | 3 +-- 109 files changed, 192 insertions(+), 235 deletions(-) create mode 100644 test/support/filesystem_include.hpp diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp index 9a92f0698..8a9a1b5d3 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp @@ -18,11 +18,10 @@ // directory_entry(directory_entry&&) noexcept = default; // explicit directory_entry(const path); -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; void test_default_ctor() { diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp index 97ecbefac..13428db19 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp @@ -18,11 +18,10 @@ // void assign(path const&); // void replace_filename(path const&); -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; void test_copy_assign_operator() { diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp index 96e509300..48997ca20 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp @@ -21,11 +21,10 @@ // bool operator>=(directory_entry const&) const noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; #define CHECK_OP(Op) \ static_assert(std::is_same::value, ""); \ diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp index d228a3d92..80168ef2a 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp @@ -16,11 +16,10 @@ // const path& path() const noexcept; // operator const path&() const noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; void test_path_method() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp index 54c5172eb..f234f0c1a 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp @@ -16,7 +16,7 @@ // file_status status() const; // file_status status(error_code const&) const noexcept; -#include +#include "filesystem_include.hpp" #include #include diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp index 3a99eb671..2ed22df3b 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp @@ -16,7 +16,7 @@ // file_status symlink_status() const; // file_status symlink_status(error_code&) const noexcept; -#include +#include "filesystem_include.hpp" #include #include diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp index 5c4583391..777e6144c 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator(directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_copy_construct_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp index 0d5ebf3eb..067e6c62d 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator& operator=(directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_copy_assign_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp index 4fd60887b..6a24a52d5 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp @@ -18,7 +18,7 @@ // directory_iterator(const path& p, error_code& ec); // directory_iterator(const path& p, directory_options options, error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -27,7 +27,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_constructor_tests) @@ -86,7 +86,7 @@ TEST_CASE(test_construction_from_bad_path) TEST_CASE(access_denied_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testDir = env.make_env_path("dir1"); path const testFile = testDir / "testFile"; @@ -122,7 +122,7 @@ TEST_CASE(access_denied_test_case) TEST_CASE(access_denied_to_file_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testFile = env.make_env_path("file1"); env.create_file(testFile, 42); diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp index 94ace185a..787f3975e 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp @@ -16,13 +16,12 @@ // directory_iterator::directory_iterator() noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { { diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp index 8d888717b..ad55e05a7 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp @@ -16,7 +16,7 @@ // directory_iterator& operator++(); // directory_iterator& increment(error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,7 +26,7 @@ #include "filesystem_test_helper.hpp" #include -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_increment_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp index f6c94e18e..97a34a9bd 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator(directory_iterator&&) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_move_construct_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp index 445f05a3c..538256626 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator& operator=(directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -30,7 +30,7 @@ #pragma clang diagnostic ignored "-Wself-move" #endif -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_move_assign_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp index f93a18452..95bb78c42 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp @@ -16,7 +16,7 @@ // directory_iterator begin(directory_iterator iter) noexcept; // directory_iterator end(directory_iterator iter) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,7 +26,7 @@ #include "filesystem_test_helper.hpp" #include -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_begin_end_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp index dad278f43..ca583bedd 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp @@ -19,13 +19,12 @@ // typedef ... reference; // typedef ... iterator_category -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp index a744e659f..4c7d5e337 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp @@ -16,13 +16,12 @@ // explicit file_status() noexcept; // explicit file_status(file_type, perms prms = perms::unknown) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_convertible.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp index 8681b2dc5..5492ccde7 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp @@ -16,11 +16,10 @@ // void type(file_type) noexcept; // void permissions(perms) noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp index 4113dee45..462670fd8 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp @@ -16,11 +16,10 @@ // file_type type() const noexcept; // perms permissions(p) const noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp b/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp index 68b67ed72..e9b117a79 100644 --- a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp +++ b/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp @@ -21,13 +21,12 @@ // const path& path1() const noexcept; // const path& path2() const noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; void test_constructors() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp b/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp index 12330ebb5..e5b3c8482 100644 --- a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp @@ -19,7 +19,7 @@ // path(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -27,7 +27,6 @@ #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; template diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp index a6172d198..ca072d161 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp @@ -22,7 +22,7 @@ // path& append(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -32,7 +32,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct AppendOperatorTestcase { MultiStringType lhs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp index c5da52f65..bbf331310 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp @@ -15,14 +15,13 @@ // path& operator=(path const&); -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "count_new.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp index 5c26f8464..8b54be6ed 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp @@ -15,13 +15,12 @@ // path& operator=(path const&); -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp index 7263424ad..c5cb37fac 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp @@ -15,14 +15,13 @@ // path& operator=(path&&) noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "count_new.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp index 8c31ef51d..2e064fa48 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp @@ -22,7 +22,7 @@ // path& assign(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -33,7 +33,6 @@ #include "filesystem_test_helper.hpp" #include -namespace fs = std::experimental::filesystem; template void RunTestCase(MultiStringType const& MS) { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp index 69d08e6eb..ea3567826 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp @@ -26,7 +26,7 @@ // // size_t hash_value(path const&) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -36,7 +36,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct PathCompareTest { const char* LHS; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp index 76df0e9ee..13203d6c6 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp @@ -28,7 +28,7 @@ // path& concat(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -39,7 +39,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct ConcatOperatorTestcase { MultiStringType lhs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp index 67b8a0404..14b4b38c9 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp @@ -15,13 +15,12 @@ // path(path const&) -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp index f26504616..fddeff989 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp @@ -15,13 +15,12 @@ // path() noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp index b8ac4b307..16f89d0a2 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp @@ -15,14 +15,13 @@ // path(path&&) noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "count_new.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp index a04f35af5..e80ae45b8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp @@ -19,7 +19,7 @@ // path(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include @@ -28,7 +28,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; template void RunTestCase(MultiStringType const& MS) { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp index 7e1fea7d3..377b94e52 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp @@ -17,12 +17,11 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 -#include - +#include "filesystem_include.hpp" #include "test_macros.h" int main () { - std::experimental::filesystem::path c; + fs::path c; c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp index 267d4932c..6dd24b511 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -44,7 +44,7 @@ // iterator end() const; -#include +#include "filesystem_include.hpp" #include #include #include @@ -54,7 +54,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct PathDecomposeTestcase { std::string raw; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp index 47e94c9a2..7e329376c 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp @@ -18,7 +18,7 @@ // basic_string // generic_string(const Allocator& a = Allocator()) const; -#include +#include "filesystem_include.hpp" #include #include @@ -28,7 +28,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp index 81d068436..d3df09ed9 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp @@ -20,7 +20,7 @@ // std::u32string generic_u32string() const; -#include +#include "filesystem_include.hpp" #include #include @@ -30,7 +30,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp index 7881c9700..1d697571c 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp @@ -15,7 +15,7 @@ // void clear() noexcept -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp index 559538cf0..b09806c23 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp @@ -15,7 +15,7 @@ // path& make_preferred() -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct MakePreferredTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp index e414202bf..84cdd5214 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp @@ -15,7 +15,7 @@ // path& remove_filename() -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct RemoveFilenameTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp index 98f6e9b88..2e7d92555 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp @@ -15,7 +15,7 @@ // path& replace_extension(path const& p = path()) -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct ReplaceExtensionTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp index 66c97218c..fb7741110 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp @@ -15,7 +15,7 @@ // path& replace_filename() -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct ReplaceFilenameTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp index 04bbe3751..3aac1ed60 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp @@ -15,7 +15,7 @@ // void swap(path& rhs) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct SwapTestcase { const char* value1; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp index 796609432..f907410a8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp @@ -16,14 +16,13 @@ // const value_type* c_str() const noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp index 2a83fef9f..9034ad450 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp @@ -20,7 +20,7 @@ // std::u32string u32string() const; -#include +#include "filesystem_include.hpp" #include #include @@ -30,7 +30,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp index db1326483..35ea49346 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp @@ -15,14 +15,13 @@ // const string_type& native() const noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp index 013d26cdb..9aa1b14c8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp @@ -16,14 +16,13 @@ // operator string_type() const; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp index e98329735..503c29c32 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp @@ -18,7 +18,7 @@ // basic_string // string(const Allocator& a = Allocator()) const; -#include +#include "filesystem_include.hpp" #include #include @@ -28,7 +28,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; // the SSO is always triggered for strings of size 2. MultiStringType shortString = MKSTR("a"); diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp index 589837784..3648da57a 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp @@ -13,14 +13,13 @@ // path operator/(path const&, path const&); -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; // This is mainly tested via the member append functions. int main() diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp index 4853994b4..5d9194b4e 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp @@ -16,7 +16,7 @@ // template // path u8path(InputIter, InputIter); -#include +#include "filesystem_include.hpp" #include #include @@ -25,7 +25,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp index 8dd82a845..58e333aad 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp @@ -22,7 +22,7 @@ // operator>>(basic_istream& is, path& p) // -#include +#include "filesystem_include.hpp" #include #include #include diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp index 3a9b48b26..ff622532e 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp @@ -27,7 +27,7 @@ // passes. // XFAIL: * -#include +#include "filesystem_include.hpp" #include #include #include diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp index 8d180463a..4f7b93a05 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp @@ -13,7 +13,7 @@ // void swap(path& lhs, path& rhs) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -21,7 +21,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; // NOTE: this is tested in path.members/path.modifiers via the member swap. int main() diff --git a/test/std/experimental/filesystem/class.path/synop.pass.cpp b/test/std/experimental/filesystem/class.path/synop.pass.cpp index 883feb287..3ed0a8f19 100644 --- a/test/std/experimental/filesystem/class.path/synop.pass.cpp +++ b/test/std/experimental/filesystem/class.path/synop.pass.cpp @@ -17,13 +17,12 @@ // typedef basic_string string_type; // static constexpr value_type preferred_separator = ...; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp index 4dbd599e5..15cf50569 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp @@ -15,7 +15,7 @@ // recursive_recursive_directory_iterator(recursive_recursive_directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_copy_construct_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp index 3e9257eac..ebe4c87d0 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp @@ -15,7 +15,7 @@ // recursive_directory_iterator& operator=(recursive_directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_copy_assign_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp index 1469dae04..29a86258d 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp @@ -20,7 +20,7 @@ // recursive_directory_iterator(const path& p, directory_options options, error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -29,7 +29,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; using RDI = recursive_directory_iterator; @@ -87,7 +87,7 @@ TEST_CASE(test_construction_from_bad_path) TEST_CASE(access_denied_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testDir = env.make_env_path("dir1"); path const testFile = testDir / "testFile"; @@ -124,7 +124,7 @@ TEST_CASE(access_denied_test_case) TEST_CASE(access_denied_to_file_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testFile = env.make_env_path("file1"); env.create_file(testFile, 42); diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp index 676e6f27c..d27194abe 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp @@ -15,7 +15,7 @@ // int depth() const -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_depth_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp index 387c6145b..e385624bc 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp @@ -15,7 +15,7 @@ // void disable_recursion_pending(); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_disable_recursion_pending_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index 87c10c499..d2a5b8c18 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -16,7 +16,7 @@ // recursive_directory_iterator& operator++(); // recursive_directory_iterator& increment(error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -25,7 +25,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_increment_tests) @@ -140,7 +140,7 @@ TEST_CASE(test_follow_symlinks) TEST_CASE(access_denied_on_recursion_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), @@ -239,7 +239,7 @@ TEST_CASE(access_denied_on_recursion_test_case) // See llvm.org/PR35078 TEST_CASE(test_PR35078) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), @@ -309,7 +309,7 @@ TEST_CASE(test_PR35078) // See llvm.org/PR35078 TEST_CASE(test_PR35078_with_symlink) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), @@ -393,7 +393,7 @@ TEST_CASE(test_PR35078_with_symlink) // See llvm.org/PR35078 TEST_CASE(test_PR35078_with_symlink_file) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp index 16dde66d2..6fe26d5ed 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp @@ -15,7 +15,7 @@ // recursive_directory_iterator(recursive_directory_iterator&&) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_move_construct_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp index 915d00267..fc6d05cb0 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp @@ -15,7 +15,7 @@ // recursive_directory_iterator& operator=(recursive_directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -30,7 +30,7 @@ #pragma clang diagnostic ignored "-Wself-move" #endif -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_move_assign_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp index befa30484..39e0f4f57 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp @@ -16,7 +16,7 @@ // void pop(); // void pop(error_code& ec); -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_pop_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp index 5a3bdd9d4..36453a279 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp @@ -15,7 +15,7 @@ // bool recursion_pending() const; -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_recursion_pending_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp index ca5117f0e..8d9f14dfe 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp @@ -16,7 +16,7 @@ // recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; // recursive_directory_iterator end(recursive_directory_iterator iter) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,7 +26,7 @@ #include "filesystem_test_helper.hpp" #include -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_begin_end_tests) diff --git a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp index 22f0cb845..4e3a33ce3 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp @@ -13,14 +13,13 @@ // enum class copy_options; -#include +#include "filesystem_include.hpp" #include #include #include "check_bitmask_types.hpp" #include "test_macros.h" -namespace fs = std::experimental::filesystem; constexpr fs::copy_options ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp index 7dbf7b288..d866c0b45 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp @@ -13,7 +13,7 @@ // enum class directory_options; -#include +#include "filesystem_include.hpp" #include #include #include @@ -21,7 +21,6 @@ #include "test_macros.h" #include "check_bitmask_types.hpp" -namespace fs = std::experimental::filesystem; constexpr fs::directory_options ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp index ab94ad287..6b6e069ff 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp @@ -13,13 +13,12 @@ // enum class file_type; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; constexpr fs::file_type ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp index c0b14ba4b..bfc769f55 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp @@ -13,7 +13,7 @@ // enum class perms; -#include +#include "filesystem_include.hpp" #include #include #include @@ -21,7 +21,6 @@ #include "test_macros.h" #include "check_bitmask_types.hpp" -namespace fs = std::experimental::filesystem; constexpr fs::perms ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp index 447fb46e8..62a0e74a1 100644 --- a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp +++ b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp @@ -13,7 +13,7 @@ // typedef TrivialClock file_time_type; -#include +#include "filesystem_include.hpp" #include #include @@ -25,7 +25,7 @@ typedef std::chrono::time_point ExpectedTimePoint; int main() { static_assert(std::is_same< - std::experimental::filesystem::file_time_type, + fs::file_time_type, ExpectedTimePoint >::value, ""); } diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp index 28e945b68..97d168a4a 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp @@ -13,7 +13,7 @@ // path absolute(const path& p, const path& base=current_path()); -#include +#include "filesystem_include.hpp" #include #include @@ -21,7 +21,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_absolute_path_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp index 407f5b111..0872b7b30 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp @@ -15,7 +15,7 @@ // path canonical(const path& p, error_code& ec); // path canonical(const path& p, const path& base, error_code& ec); -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_canonical_path_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp index 8f44e0d5a..ce853b636 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp @@ -17,7 +17,7 @@ // void copy(const path& from, const path& to, copy_options options, // error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,8 +26,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; using CO = fs::copy_options; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index fe5f00128..33b3ba9b5 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -17,7 +17,7 @@ // bool copy_file(const path& from, const path& to, copy_options options, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,8 +26,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; using CO = fs::copy_options; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp index fe4729806..2530bc9b6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp @@ -15,7 +15,7 @@ // void copy_symlink(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,8 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_copy_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp index c7d9339df..e7962941c 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp @@ -14,7 +14,7 @@ // bool create_directories(const path& p); // bool create_directories(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,8 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_directories_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp index 5fce217bc..4bc30c2b3 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp @@ -16,7 +16,7 @@ // bool create_directory(const path& p, const path& attr); // bool create_directory(const path& p, const path& attr, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -27,8 +27,7 @@ #include #include -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; fs::perms read_umask() { mode_t old_mask = umask(0); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp index c32bdd2d1..d0fff583a 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp @@ -14,7 +14,7 @@ // bool create_directory(const path& p, const path& attr); // bool create_directory(const path& p, const path& attr, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,8 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_directory_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp index 85a3b6cb3..e7cba97dd 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp @@ -15,15 +15,14 @@ // void create_directory_symlink(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_directory_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp index 7aefece46..7dbc705f4 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp @@ -15,14 +15,13 @@ // void create_hard_link(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_hard_link_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp index d261d987a..46519ad77 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp @@ -15,15 +15,14 @@ // void create_symlink(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp index 9d004ab85..82ba91c0f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp @@ -16,7 +16,7 @@ // void current_path(path const&); // void current_path(path const&, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_current_path_path_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp index a3591e026..3381f64d5 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp @@ -14,7 +14,7 @@ // bool equivalent(path const& lhs, path const& rhs); // bool equivalent(path const& lhs, path const& rhs, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(equivalent_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp index 2b9f57e7e..4b6ed9642 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp @@ -15,7 +15,7 @@ // bool exists(path const& p); // bool exists(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(exists_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp index 460e42dd1..1f7b87ae8 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp @@ -14,7 +14,7 @@ // uintmax_t file_size(const path& p); // uintmax_t file_size(const path& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(file_size_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp index 6b542a5b6..f90e3f772 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp @@ -14,7 +14,7 @@ // uintmax_t hard_link_count(const path& p); // uintmax_t hard_link_count(const path& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(hard_link_count_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp index dee28aa5b..c27565e5f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp @@ -15,7 +15,7 @@ // bool is_block_file(path const& p); // bool is_block_file(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_block_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp index 2de42bf20..546881920 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp @@ -15,7 +15,7 @@ // bool is_character_file(path const& p); // bool is_character_file(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_character_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp index d6ecb1a1e..3270fcc80 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp @@ -15,7 +15,7 @@ // bool is_directory(path const& p); // bool is_directory(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_directory_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp index 2da163c33..ffe60a823 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp @@ -14,7 +14,7 @@ // bool is_empty(path const& p); // bool is_empty(path const& p, std::error_code& ec); -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_empty_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp index 44892f65d..9c56f7356 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp @@ -15,7 +15,7 @@ // bool is_fifo(path const& p); // bool is_fifo(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_fifo_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp index e86b66b4e..d01268a73 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp @@ -15,7 +15,7 @@ // bool is_other(path const& p); // bool is_other(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_other_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp index be68dcfc3..96e027d2c 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp @@ -15,7 +15,7 @@ // bool is_regular_file(path const& p); // bool is_regular_file(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_regular_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp index 49fd402eb..1593d6a3b 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp @@ -15,7 +15,7 @@ // bool is_socket(path const& p); // bool is_socket(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_socket_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp index 3de002978..97cd0a3d0 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp @@ -15,7 +15,7 @@ // bool is_symlink(path const& p); // bool is_symlink(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp index 0ca82b21f..b842b4a18 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -18,7 +18,7 @@ // std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -31,7 +31,7 @@ #include #include -using namespace std::experimental::filesystem; +using namespace fs; std::pair GetTimes(path const& p) { diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 794aeb992..1082a62fa 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -15,14 +15,13 @@ // void permissions(const path& p, perms prms, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; using PR = fs::perms; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp index d69e95ce5..8011da343 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp @@ -14,14 +14,13 @@ // path read_symlink(const path& p); // path read_symlink(const path& p, error_code& ec); -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_read_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp index 2fdb4ad47..2b5f52c75 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp @@ -14,14 +14,13 @@ // bool remove(const path& p); // bool remove(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_remove_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp index 64c5c88c8..99935f44b 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp @@ -14,14 +14,13 @@ // uintmax_t remove_all(const path& p); // uintmax_t remove_all(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_remove_all_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp index e265c7af6..f20d73fcc 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp @@ -14,14 +14,13 @@ // void rename(const path& old_p, const path& new_p); // void rename(const path& old_p, const path& new_p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_rename_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp index f7c2ee14e..38596cd4c 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp @@ -14,14 +14,13 @@ // void resize_file(const path& p, uintmax_t new_size); // void resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_resize_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp index 8f241810f..4f617cd66 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp @@ -14,14 +14,14 @@ // space_info space(const path& p); // space_info space(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; bool EqualDelta(std::uintmax_t x, std::uintmax_t y, std::uintmax_t delta) { if (x >= y) { diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp index fdc3d2b4a..997f318f7 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp @@ -14,13 +14,13 @@ // file_status status(const path& p); // file_status status(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_status_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp index 169c5be9d..ed6733fb6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp @@ -13,7 +13,7 @@ // bool status_known(file_status s) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -21,7 +21,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(status_known_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp index 647504f6e..9db83fbc3 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp @@ -14,13 +14,13 @@ // file_status symlink_status(const path& p); // file_status symlink_status(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_symlink_status_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp index 634184e24..b4fb1f19a 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp @@ -17,7 +17,7 @@ // Note: For POSIX based operating systems, 'system_complete(p)' has the // same semantics as 'absolute(p, current_path())'. -#include +#include "filesystem_include.hpp" #include #include @@ -25,7 +25,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_system_complete_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp index 021dd7fc8..1942bd8b4 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -14,7 +14,7 @@ // path temp_directory_path(); // path temp_directory_path(error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; void PutEnv(std::string var, std::string value) { assert(::setenv(var.c_str(), value.c_str(), /* overwrite */ 1) == 0); diff --git a/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp b/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp index d57dff4a7..42dfe9480 100644 --- a/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp +++ b/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp @@ -13,7 +13,7 @@ // #define __cpp_lib_experimental_filesystem 201406L -#include +#include "filesystem_include.hpp" #ifndef __cpp_lib_experimental_filesystem #error Filesystem feature test macro is not defined (__cpp_lib_experimental_filesystem) diff --git a/test/support/filesystem_include.hpp b/test/support/filesystem_include.hpp new file mode 100644 index 000000000..228e710f3 --- /dev/null +++ b/test/support/filesystem_include.hpp @@ -0,0 +1,18 @@ +#ifndef TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP +#define TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP + +#include +// Test against std::filesystem for STL's other than libc++ +#ifndef _LIBCPP_VERSION +#define TEST_INCLUDE_STD_FILESYSTEM +#endif + +#ifdef TEST_INCLUDE_STD_FILESYSTEM +#include +namespace fs = std::filesystem; +#else +#include +namespace fs = std::experimental::filesystem; +#endif + +#endif diff --git a/test/support/filesystem_test_helper.hpp b/test/support/filesystem_test_helper.hpp index 755be9035..622a60d1c 100644 --- a/test/support/filesystem_test_helper.hpp +++ b/test/support/filesystem_test_helper.hpp @@ -1,7 +1,7 @@ #ifndef FILESYSTEM_TEST_HELPER_HPP #define FILESYSTEM_TEST_HELPER_HPP -#include +#include "filesystem_include.hpp" #include #include // for printf #include @@ -9,7 +9,6 @@ #include #include -namespace fs = std::experimental::filesystem; // static test helpers From f2c93738b886428c46476c36dfa38296aef1b2ef Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 26 Mar 2018 06:23:55 +0000 Subject: [PATCH 062/176] Implement filesystem::perm_options specified in NB comments. The NB comments for filesystem changed permissions and added a new enum `perm_options` which control how the permissions are applied. This implements than NB resolution git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328476 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/filesystem | 64 ++++++++++++--- src/experimental/filesystem/operations.cpp | 19 +++-- .../rec.dir.itr.members/increment.pass.cpp | 12 +-- .../filesystem/fs.enum/enum.perms.pass.cpp | 5 +- .../create_directory_with_attributes.pass.cpp | 2 +- .../fs.op.permissions/permissions.pass.cpp | 77 +++++++++++-------- 6 files changed, 119 insertions(+), 60 deletions(-) diff --git a/include/experimental/filesystem b/include/experimental/filesystem index cdfe9e254..47cc0c5aa 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -68,6 +68,7 @@ enum class file_type; enum class perms; + enum class perm_options; enum class copy_options; enum class directory_options; @@ -178,8 +179,11 @@ void last_write_time(const path& p, file_time_type new_time, error_code& ec) _NOEXCEPT; - void permissions(const path& p, perms prms); - void permissions(const path& p, perms prms, error_code& ec) _NOEXCEPT; + void permissions(const path& p, perms prms, + perm_options opts=perm_options::replace); + void permissions(const path& p, perms prms, error_code& ec) noexcept; + void permissions(const path& p, perms prms, perm_options opts, + error_code& ec); path read_symlink(const path& p); path read_symlink(const path& p, error_code& ec); @@ -290,10 +294,6 @@ enum class _LIBCPP_ENUM_VIS perms : unsigned sticky_bit = 01000, mask = 07777, unknown = 0xFFFF, - - add_perms = 0x10000, - remove_perms = 0x20000, - symlink_nofollow = 0x40000 }; _LIBCPP_INLINE_VISIBILITY @@ -324,6 +324,41 @@ _LIBCPP_INLINE_VISIBILITY inline perms& operator^=(perms& _LHS, perms _RHS) { return _LHS = _LHS ^ _RHS; } +enum class _LIBCPP_ENUM_VIS perm_options : unsigned char { + replace = 1, + add = 2, + remove = 4, + nofollow = 8 +}; + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator&(perm_options _LHS, perm_options _RHS) +{ return static_cast(static_cast(_LHS) & static_cast(_RHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator|(perm_options _LHS, perm_options _RHS) +{ return static_cast(static_cast(_LHS) | static_cast(_RHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator^(perm_options _LHS, perm_options _RHS) +{ return static_cast(static_cast(_LHS) ^ static_cast(_RHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator~(perm_options _LHS) +{ return static_cast(~static_cast(_LHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) +{ return _LHS = _LHS & _RHS; } + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) +{ return _LHS = _LHS | _RHS; } + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) +{ return _LHS = _LHS ^ _RHS; } + enum class _LIBCPP_ENUM_VIS copy_options : unsigned short { none = 0, @@ -1286,7 +1321,7 @@ _LIBCPP_FUNC_VIS void __last_write_time(const path& p, file_time_type new_time, error_code *ec=nullptr); _LIBCPP_FUNC_VIS -void __permissions(const path& p, perms prms, error_code *ec=nullptr); +void __permissions(const path&, perms, perm_options, error_code* = nullptr); _LIBCPP_FUNC_VIS path __read_symlink(const path& p, error_code *ec=nullptr); _LIBCPP_FUNC_VIS @@ -1664,13 +1699,20 @@ void last_write_time(const path& __p, file_time_type __t, error_code& __ec) _NOE } inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms) { - __permissions(__p, __prms); +void permissions(const path& __p, perms __prms, + perm_options __opts = perm_options::replace) { + __permissions(__p, __prms, __opts); } inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms, error_code& __ec) { - __permissions(__p, __prms, &__ec); +void permissions(const path& __p, perms __prms, error_code& __ec) _NOEXCEPT { + __permissions(__p, __prms, perm_options::replace, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY +void permissions(const path& __p, perms __prms, perm_options __opts, + error_code& __ec) { + __permissions(__p, __prms, __opts, &__ec); } inline _LIBCPP_INLINE_VISIBILITY diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index bd173893c..b52022ac3 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -178,7 +178,7 @@ bool copy_file_impl(const path& from, const path& to, perms from_perms, ec, "copy_file", from, to); return false; } - __permissions(to, from_perms, ec); + __permissions(to, from_perms, perm_options::replace, ec); // TODO what if permissions fails? return true; } @@ -635,14 +635,17 @@ void __last_write_time(const path& p, file_time_type new_time, } -void __permissions(const path& p, perms prms, std::error_code *ec) +void __permissions(const path& p, perms prms, perm_options opts, + std::error_code *ec) { - - const bool resolve_symlinks = !bool(perms::symlink_nofollow & prms); - const bool add_perms = bool(perms::add_perms & prms); - const bool remove_perms = bool(perms::remove_perms & prms); - _LIBCPP_ASSERT(!(add_perms && remove_perms), - "Both add_perms and remove_perms are set"); + auto has_opt = [&](perm_options o) { return bool(o & opts); }; + const bool resolve_symlinks = !has_opt(perm_options::nofollow); + const bool add_perms = has_opt(perm_options::add); + const bool remove_perms = has_opt(perm_options::remove); + _LIBCPP_ASSERT( + (add_perms + remove_perms + has_opt(perm_options::replace)) == 1, + "One and only one of the perm_options constants replace, add, or remove " + "is present in opts"); bool set_sym_perms = false; prms &= perms::mask; diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index d2a5b8c18..1699a414a 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -255,8 +255,8 @@ TEST_CASE(test_PR35078) // Change the permissions so we can no longer iterate permissions(permDeniedDir, - perms::remove_perms|perms::group_exec - |perms::owner_exec|perms::others_exec); + perms::group_exec|perms::owner_exec|perms::others_exec, + perm_options::remove); const std::error_code eacess_ec = std::make_error_code(std::errc::permission_denied); @@ -329,8 +329,8 @@ TEST_CASE(test_PR35078_with_symlink) // Change the permissions so we can no longer iterate permissions(permDeniedDir, - perms::remove_perms|perms::group_exec - |perms::owner_exec|perms::others_exec); + perms::group_exec|perms::owner_exec|perms::others_exec, + perm_options::remove); const std::error_code eacess_ec = std::make_error_code(std::errc::permission_denied); @@ -413,8 +413,8 @@ TEST_CASE(test_PR35078_with_symlink_file) // Change the permissions so we can no longer iterate permissions(permDeniedDir, - perms::remove_perms|perms::group_exec - |perms::owner_exec|perms::others_exec); + perms::group_exec|perms::owner_exec|perms::others_exec, + perm_options::remove); const std::error_code eacess_ec = std::make_error_code(std::errc::permission_denied); diff --git a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp index bfc769f55..7cd8f6779 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp @@ -59,9 +59,6 @@ int main() { E::set_gid == ME(02000) && E::sticky_bit == ME(01000) && E::mask == ME(07777) && - E::unknown == ME(0xFFFF) && - E::add_perms == ME(0x10000) && - E::remove_perms == ME(0x20000) && - E::symlink_nofollow == ME(0x40000), + E::unknown == ME(0xFFFF), "Expected enumeration values do not match"); } diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp index d0fff583a..8ec22f1f9 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp @@ -60,7 +60,7 @@ TEST_CASE(create_directory_one_level) { scoped_test_env env; // Remove setgid which mkdir would inherit - permissions(env.test_root, perms::remove_perms | perms::set_gid); + permissions(env.test_root, perms::set_gid, perm_options::remove); const path dir = env.make_env_path("dir1"); const path attr_dir = env.create_dir("dir2"); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 1082a62fa..3783f5f34 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -11,8 +11,11 @@ // -// void permissions(const path& p, perms prms); +// void permissions(const path& p, perms prms, +// perm_options opts = perm_options::replace); // void permissions(const path& p, perms prms, std::error_code& ec) noexcept; +// void permissions(const path& p, perms prms, perm_options opts, std::error_code); + #include "filesystem_include.hpp" @@ -30,17 +33,19 @@ TEST_SUITE(filesystem_permissions_test_suite) TEST_CASE(test_signatures) { const path p; ((void)p); - const perms opts{}; ((void)opts); + const perms pr{}; ((void)pr); + const perm_options opts{}; ((void)opts); std::error_code ec; ((void)ec); - ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts)); - // Not noexcept because of narrow contract - LIBCPP_ONLY( - ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec))); + ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr)); + ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts)); + ASSERT_NOEXCEPT(fs::permissions(p, pr, ec)); + ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts, ec)); } TEST_CASE(test_error_reporting) { - auto checkThrow = [](path const& f, fs::perms opts, const std::error_code& ec) + auto checkThrow = [](path const& f, fs::perms opts, + const std::error_code& ec) { #ifndef TEST_HAS_NO_EXCEPTIONS try { @@ -61,15 +66,17 @@ TEST_CASE(test_error_reporting) const path dne = env.make_env_path("dne"); const path dne_sym = env.create_symlink(dne, "dne_sym"); { // !exists - std::error_code ec; + std::error_code ec = GetTestEC(); fs::permissions(dne, fs::perms{}, ec); TEST_REQUIRE(ec); + TEST_CHECK(ec != GetTestEC()); TEST_CHECK(checkThrow(dne, fs::perms{}, ec)); } { - std::error_code ec; + std::error_code ec = GetTestEC(); fs::permissions(dne_sym, fs::perms{}, ec); TEST_REQUIRE(ec); + TEST_CHECK(ec != GetTestEC()); TEST_CHECK(checkThrow(dne_sym, fs::perms{}, ec)); } } @@ -81,42 +88,51 @@ TEST_CASE(basic_permissions_test) const path dir = env.create_dir("dir1"); const path file_for_sym = env.create_file("file2", 42); const path sym = env.create_symlink(file_for_sym, "sym"); - const perms AP = perms::add_perms; - const perms RP = perms::remove_perms; - const perms NF = perms::symlink_nofollow; + const perm_options AP = perm_options::add; + const perm_options RP = perm_options::remove; + const perm_options NF = perm_options::nofollow; struct TestCase { path p; perms set_perms; perms expected; + perm_options opts = perm_options::replace; } cases[] = { // test file {file, perms::none, perms::none}, {file, perms::owner_all, perms::owner_all}, - {file, perms::group_all | AP, perms::owner_all | perms::group_all}, - {file, perms::group_all | RP, perms::owner_all}, + {file, perms::group_all, perms::owner_all | perms::group_all, AP}, + {file, perms::group_all, perms::owner_all, RP}, // test directory {dir, perms::none, perms::none}, {dir, perms::owner_all, perms::owner_all}, - {dir, perms::group_all | AP, perms::owner_all | perms::group_all}, - {dir, perms::group_all | RP, perms::owner_all}, + {dir, perms::group_all, perms::owner_all | perms::group_all, AP}, + {dir, perms::group_all, perms::owner_all, RP}, // test symlink without symlink_nofollow {sym, perms::none, perms::none}, {sym, perms::owner_all, perms::owner_all}, - {sym, perms::group_all | AP, perms::owner_all | perms::group_all}, - {sym, perms::group_all | RP , perms::owner_all}, + {sym, perms::group_all, perms::owner_all | perms::group_all, AP}, + {sym, perms::group_all, perms::owner_all, RP}, // test non-symlink with symlink_nofollow. The last test on file/dir // will have set their permissions to perms::owner_all - {file, perms::group_all | AP | NF, perms::owner_all | perms::group_all}, - {dir, perms::group_all | AP | NF, perms::owner_all | perms::group_all} + {file, perms::group_all, perms::owner_all | perms::group_all, AP | NF}, + {dir, perms::group_all, perms::owner_all | perms::group_all, AP | NF} }; for (auto const& TC : cases) { TEST_CHECK(status(TC.p).permissions() != TC.expected); - // Set the error code to ensure it's cleared. - std::error_code ec = std::make_error_code(std::errc::bad_address); - permissions(TC.p, TC.set_perms, ec); - TEST_CHECK(!ec); - auto pp = status(TC.p).permissions(); - TEST_CHECK(pp == TC.expected); + { + std::error_code ec = GetTestEC(); + permissions(TC.p, TC.set_perms, TC.opts, ec); + TEST_CHECK(!ec); + auto pp = status(TC.p).permissions(); + TEST_CHECK(pp == TC.expected); + } + if (TC.opts == perm_options::replace) { + std::error_code ec = GetTestEC(); + permissions(TC.p, TC.set_perms, ec); + TEST_CHECK(!ec); + auto pp = status(TC.p).permissions(); + TEST_CHECK(pp == TC.expected); + } } } @@ -130,10 +146,11 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) struct TestCase { perms set_perms; perms expected; // only expected on platform that support symlink perms. + perm_options opts = perm_options::replace; } cases[] = { {perms::owner_all, perms::owner_all}, - {perms::group_all | perms::add_perms, perms::owner_all | perms::group_all}, - {perms::owner_all | perms::remove_perms, perms::group_all}, + {perms::group_all, perms::owner_all | perms::group_all, perm_options::add}, + {perms::owner_all, perms::group_all, perm_options::remove}, }; for (auto const& TC : cases) { #if defined(__APPLE__) || defined(__FreeBSD__) @@ -148,8 +165,8 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) const auto expected_link_perms = symlink_status(sym).permissions(); std::error_code expected_ec = std::make_error_code(std::errc::operation_not_supported); #endif - std::error_code ec = std::make_error_code(std::errc::bad_address); - permissions(sym, TC.set_perms | perms::symlink_nofollow, ec); + std::error_code ec = GetTestEC(); + permissions(sym, TC.set_perms, TC.opts | perm_options::nofollow, ec); TEST_CHECK(ec == expected_ec); TEST_CHECK(status(file).permissions() == file_perms); TEST_CHECK(symlink_status(sym).permissions() == expected_link_perms); From 245b3a06a17b95cd11ef9d59e74d35095d5b7c14 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 26 Mar 2018 07:06:25 +0000 Subject: [PATCH 063/176] Fix test case initialization issues in permissions test git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328477 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../fs.op.funcs/fs.op.permissions/permissions.pass.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 3783f5f34..65d8d7164 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -95,7 +95,10 @@ TEST_CASE(basic_permissions_test) path p; perms set_perms; perms expected; - perm_options opts = perm_options::replace; + perm_options opts; + TestCase(path xp, perms xperms, perms xexpect, + perm_options xopts = perm_options::replace) + : p(xp), set_perms(xperms), expected(xexpect), opts(xopts) {} } cases[] = { // test file {file, perms::none, perms::none}, @@ -147,6 +150,9 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) perms set_perms; perms expected; // only expected on platform that support symlink perms. perm_options opts = perm_options::replace; + TestCase(perms xperms, perms xexpect, + perm_options xopts = perm_options::replace) + : set_perms(xperms), expected(xexpect), opts(xopts) {} } cases[] = { {perms::owner_all, perms::owner_all}, {perms::group_all, perms::owner_all | perms::group_all, perm_options::add}, From f382e530159b42de9120ddecaf57d540471f5962 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 29 Mar 2018 01:18:53 +0000 Subject: [PATCH 064/176] Fix PR36914 - num_get::get(unsigned) incorrectly handles negative numbers. This patch corrects num_get for unsigned types to support strings with a leading `-` character. According to the standard the number should be parsed as an unsigned integer and then negated. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328751 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/locale | 15 +- .../test_min_max.pass.cpp | 23 +-- .../test_neg_one.pass.cpp | 159 ++++++++++++++++++ 3 files changed, 180 insertions(+), 17 deletions(-) create mode 100644 test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp diff --git a/include/locale b/include/locale index a86645d2c..52885b768 100644 --- a/include/locale +++ b/include/locale @@ -768,10 +768,10 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, { if (__a != __a_end) { - if (*__a == '-') - { - __err = ios_base::failbit; - return 0; + const bool __negate = *__a == '-'; + if (__negate && ++__a == __a_end) { + __err = ios_base::failbit; + return 0; } typename remove_reference::type __save_errno = errno; errno = 0; @@ -785,13 +785,14 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, __err = ios_base::failbit; return 0; } - else if (__current_errno == ERANGE || - numeric_limits<_Tp>::max() < __ll) + else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) { __err = ios_base::failbit; return numeric_limits<_Tp>::max(); } - return static_cast<_Tp>(__ll); + _Tp __res = static_cast<_Tp>(__ll); + if (__negate) __res = -__res; + return __res; } __err = ios_base::failbit; return 0; diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp index 6ba5a89e6..e2218fffb 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp @@ -15,9 +15,17 @@ using namespace std; +template +bool check_stream_failed(std::string const& val) { + istringstream ss(val); + T result; + return !(ss >> result); +} + template void check_limits() { + const bool is_unsigned = std::is_unsigned::value; T minv = numeric_limits::min(); T maxv = numeric_limits::max(); @@ -36,17 +44,12 @@ void check_limits() assert(new_minv == minv); assert(new_maxv == maxv); - if(mins == "0") - mins = "-1"; - else - mins[mins.size() - 1]++; - maxs[maxs.size() - 1]++; - - istringstream maxoss2(maxs), minoss2(mins); - - assert(! (maxoss2 >> new_maxv)); - assert(! (minoss2 >> new_minv)); + assert(check_stream_failed(maxs)); + if (!is_unsigned) { + mins[mins.size() - 1]++; + assert(check_stream_failed(mins)); + } } int main(void) diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp new file mode 100644 index 000000000..fa0641f61 --- /dev/null +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp @@ -0,0 +1,159 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// class num_get + +// iter_type get(iter_type in, iter_type end, ios_base&, +// ios_base::iostate& err, unsigned int& v) const; + +#include +#include +#include +#include +#include +#include +#include "test_iterators.h" + +typedef std::num_get > F; + +class my_facet + : public F +{ +public: + explicit my_facet(std::size_t refs = 0) + : F(refs) {} +}; + +template +std::string make_neg_string(T value) { + std::ostringstream ss; + assert(ss << value); + std::string res = ss.str(); + return '-' + res; +} + +template +void test_neg_one() { + const my_facet f(1); + std::ios ios(0); + T v = static_cast(42); + { + const char str[] = "-1"; + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+sizeof(str)), + ios, err, v); + assert(iter.base() == str+sizeof(str)-1); + assert(err == ios.goodbit); + assert(v == T(-1)); + } + v = 42; + { + const char str[] = "-"; + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+sizeof(str)), + ios, err, v); + assert(iter.base() == str+sizeof(str)-1); + assert(err == ios.failbit); + assert(v == 0); + } +} + +template +void test_negate() { + typedef typename std::make_signed::type SignedT; + const my_facet f(1); + std::ios ios(0); + T v = 42; + { + T value = std::numeric_limits::max(); + ++value; + std::string std_str = make_neg_string(value); + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.goodbit); + T expected = -value; + assert(v == expected); + } + v = 42; + { + T value = std::numeric_limits::max(); + ++value; + ++value; + std::string std_str = make_neg_string(value); + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.goodbit); + T expected = -value; + assert(v == expected); + } + v = 42; + { + T value = std::numeric_limits::max(); + std::string std_str = make_neg_string(value); + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.goodbit); + T expected = -value; + assert(v == expected); + } + v = 42; + { + std::string std_str = make_neg_string(std::numeric_limits::max()); + std_str.back()++; + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.failbit); + assert(v == T(-1)); + } +} + +int main(void) +{ + test_neg_one(); + test_neg_one(); + test_neg_one(); + test_neg_one(); + test_neg_one(); + test_neg_one(); + + test_negate(); + test_negate(); + test_negate(); + test_negate(); +} From 3e005cc5834a4b9773db07ed52bf29470798c5e1 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 29 Mar 2018 03:30:00 +0000 Subject: [PATCH 065/176] Move libc++ pair/tuple assign test to libcxx/ test directory. Libc++ implements the pair& operator=(pair) assignment operator using a single template that handles assignment from all tuple-like types. This patch moves the test for that to the libcxx test directory since it's non-standard. It also adds additional tests to the std/.../pair directory to test the standard behavior this template implements. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328758 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../pairs.pair/assign_tuple_like.pass.cpp} | 52 +++---------------- .../pairs.pair/assign_const_pair_U_V.pass.cpp | 22 ++++++++ .../pairs.pair/assign_rv_pair_U_V.pass.cpp | 16 ++++++ 3 files changed, 46 insertions(+), 44 deletions(-) rename test/{std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp => libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp} (67%) diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp similarity index 67% rename from test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp rename to test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp index ef7bebcf5..0e0117e4e 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp +++ b/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp @@ -21,58 +21,22 @@ #include #include +#include "archetypes.hpp" + // Clang warns about missing braces when initializing std::array. #if defined(__clang__) #pragma clang diagnostic ignored "-Wmissing-braces" #endif -struct CountingType { - static int constructed; - static int copy_constructed; - static int move_constructed; - static int assigned; - static int copy_assigned; - static int move_assigned; - static void reset() { - constructed = copy_constructed = move_constructed = 0; - assigned = copy_assigned = move_assigned = 0; - } - CountingType() : value(0) { ++constructed; } - CountingType(int v) : value(v) { ++constructed; } - CountingType(CountingType const& o) : value(o.value) { ++constructed; ++copy_constructed; } - CountingType(CountingType&& o) : value(o.value) { ++constructed; ++move_constructed; o.value = -1;} - - CountingType& operator=(CountingType const& o) { - ++assigned; - ++copy_assigned; - value = o.value; - return *this; - } - CountingType& operator=(CountingType&& o) { - ++assigned; - ++move_assigned; - value = o.value; - o.value = -1; - return *this; - } - int value; -}; -int CountingType::constructed; -int CountingType::copy_constructed; -int CountingType::move_constructed; -int CountingType::assigned; -int CountingType::copy_assigned; -int CountingType::move_assigned; - int main() { - using C = CountingType; + using C = TestTypes::TestType; { using P = std::pair; using T = std::tuple; T t(42, C{42}); P p(101, C{101}); - C::reset(); + C::reset_constructors(); p = t; assert(C::constructed == 0); assert(C::assigned == 1); @@ -86,7 +50,7 @@ int main() using T = std::tuple; T t(42, -42); P p(101, 101); - C::reset(); + C::reset_constructors(); p = std::move(t); assert(C::constructed == 0); assert(C::assigned == 1); @@ -100,7 +64,7 @@ int main() using T = std::array; T t = {42, -42}; P p{101, 101}; - C::reset(); + C::reset_constructors(); p = t; assert(C::constructed == 0); assert(C::assigned == 2); @@ -114,7 +78,7 @@ int main() using T = std::array; T t = {42, -42}; P p{101, 101}; - C::reset(); + C::reset_constructors(); p = t; assert(C::constructed == 0); assert(C::assigned == 2); @@ -128,7 +92,7 @@ int main() using T = std::array; T t = {42, -42}; P p{101, 101}; - C::reset(); + C::reset_constructors(); p = std::move(t); assert(C::constructed == 0); assert(C::assigned == 2); diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp index 132443f66..3ee6f0755 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp @@ -16,6 +16,11 @@ #include #include +#include "test_macros.h" +#if TEST_STD_VER >= 11 +#include "archetypes.hpp" +#endif + int main() { { @@ -27,4 +32,21 @@ int main() assert(p2.first == 3); assert(p2.second == 4); } +#if TEST_STD_VER >= 11 + { + using C = TestTypes::TestType; + using P = std::pair; + using T = std::pair; + const T t(42, -42); + P p(101, 101); + C::reset_constructors(); + p = t; + assert(C::constructed == 0); + assert(C::assigned == 1); + assert(C::copy_assigned == 1); + assert(C::move_assigned == 0atu); + assert(p.first == 42); + assert(p.second.value == -42); + } +#endif } diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp index 76dfc3f65..b7a89a844 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp @@ -18,6 +18,7 @@ #include #include #include +#include struct Base { @@ -40,4 +41,19 @@ int main() assert(p2.first == nullptr); assert(p2.second == 4); } + { + using C = TestTypes::TestType; + using P = std::pair; + using T = std::pair; + T t(42, -42); + P p(101, 101); + C::reset_constructors(); + p = std::move(t); + assert(C::constructed == 0); + assert(C::assigned == 1); + assert(C::copy_assigned == 0); + assert(C::move_assigned == 1); + assert(p.first == 42); + assert(p.second.value == -42); + } } From 4e177b91d0a4e6f3a1c7779309f4c02707ae3b69 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 29 Mar 2018 03:44:01 +0000 Subject: [PATCH 066/176] fix typo in align_const_pair_U_V.pass.cpp git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328760 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp index 3ee6f0755..90722c393 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp @@ -44,7 +44,7 @@ int main() assert(C::constructed == 0); assert(C::assigned == 1); assert(C::copy_assigned == 1); - assert(C::move_assigned == 0atu); + assert(C::move_assigned == 0); assert(p.first == 42); assert(p.second.value == -42); } From ead2a5495298faa7f52f54956fd3cb04c62ff6bd Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Mon, 2 Apr 2018 22:09:57 +0000 Subject: [PATCH 067/176] [libcxx] Disable testing with system lib for 2 tests verifying debug mode. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329023 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../thread/futures/futures.promise/set_exception.pass.cpp | 3 +++ .../futures.promise/set_exception_at_thread_exit.pass.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index abfbb685d..805aee138 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -14,6 +14,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS // MODULES_DEFINES: _LIBCPP_DEBUG=0 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // class promise diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index 6736bae97..88061bb5f 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -14,6 +14,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS // MODULES_DEFINES: _LIBCPP_DEBUG=0 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // class promise From 1e34c76d3374164cff168bd571f61387c3b0d3f3 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 2 Apr 2018 23:03:41 +0000 Subject: [PATCH 068/176] Implement filesystem NB comments, relative paths, and related issues. This is a fairly large patch that implements all of the filesystem NB comments and the relative paths changes (ex. adding weakly_canonical). These issues and papers are all interrelated so their implementation couldn't be split up nicely. This patch upgrades to match the C++17 spec and not the published experimental TS spec. Some of the changes in this patch are both API and ABI breaking, however libc++ makes no guarantee about stability for experimental implementations. The major changes in this patch are: * Implement NB comments for filesystem (P0492R2), including: * Implement `perm_options` enum as part of NB comments, and update the `permissions` function to match. * Implement changes to `remove_filename` and `replace_filename` * Implement changes to `path::stem()` and `path::extension()` which support splitting examples like `.profile`. * Change path iteration to return an empty path instead of '.' for trailing separators. * Change `operator/=` to handle absolute paths on the RHS. * Change `absolute` to no longer accept a current path argument. * Implement relative paths according to NB comments (P0219r1) * Combine `path.cpp` and `operations.cpp` since some path functions require access to the operations internals, and some fs operations require access to the path parser. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329028 91177308-0d34-0410-b5e6-96231b3b80d8 --- benchmarks/CMakeLists.txt | 2 +- benchmarks/GenerateInput.hpp | 6 +- benchmarks/filesystem.bench.cpp | 55 +- include/experimental/filesystem | 176 +++-- src/experimental/filesystem/operations.cpp | 685 +++++++++++++++++- src/experimental/filesystem/path.cpp | 448 ------------ .../path.member/path.append.pass.cpp | 70 -- .../class.path/path.itr/iterator.pass.cpp | 4 +- .../path.member/path.append.pass.cpp | 72 +- .../path.member/path.compare.pass.cpp | 17 +- .../path.member/path.decompose/empty.fail.cpp | 1 + .../path.decompose/path.decompose.pass.cpp | 108 +-- .../path.gen/lexically_normal.pass.cpp | 142 ++++ .../lexically_relative_and_proximate.pass.cpp | 89 +++ .../generic_string_alloc.pass.cpp | 1 - .../path.generic.obs/named_overloads.pass.cpp | 1 - .../path.modifiers/remove_filename.pass.cpp | 46 +- .../path.modifiers/replace_filename.pass.cpp | 15 +- .../fs.enum/enum.perm_options.pass.cpp | 48 ++ .../fs.op.absolute/absolute.pass.cpp | 95 +-- .../fs.op.canonical/canonical.pass.cpp | 56 +- .../last_write_time.pass.cpp | 2 - .../fs.op.proximate/proximate.pass.cpp | 125 ++++ .../fs.op.relative/relative.pass.cpp | 78 ++ .../system_complete.pass.cpp | 58 -- .../weakly_canonical.pass.cpp | 76 ++ test/support/filesystem_test_helper.hpp | 5 +- test/support/verbose_assert.h | 222 ++++++ www/cxx1z_status.html | 4 +- www/cxx2a_status.html | 2 +- 30 files changed, 1810 insertions(+), 899 deletions(-) delete mode 100644 src/experimental/filesystem/path.cpp delete mode 100644 test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp create mode 100644 test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_normal.pass.cpp create mode 100644 test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.enum/enum.perm_options.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.proximate/proximate.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.relative/relative.pass.cpp delete mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp create mode 100644 test/support/verbose_assert.h diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 8a154d86f..f557d4aea 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -68,7 +68,7 @@ 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 - -std=c++14 -O2 + -std=c++17 -O2 -I${BENCHMARK_LIBCXX_INSTALL}/include -I${LIBCXX_SOURCE_DIR}/test/support ) diff --git a/benchmarks/GenerateInput.hpp b/benchmarks/GenerateInput.hpp index 9d5adac4a..8c97f5881 100644 --- a/benchmarks/GenerateInput.hpp +++ b/benchmarks/GenerateInput.hpp @@ -29,14 +29,16 @@ inline std::default_random_engine& getRandomEngine() { return RandEngine; } + inline char getRandomChar() { std::uniform_int_distribution<> LettersDist(0, LettersSize-1); return Letters[LettersDist(getRandomEngine())]; } template -inline IntT getRandomInteger() { - std::uniform_int_distribution dist; +inline IntT getRandomInteger(IntT Min = 0, + IntT Max = std::numeric_limits::max()) { + std::uniform_int_distribution dist(Min, Max); return dist(getRandomEngine()); } diff --git a/benchmarks/filesystem.bench.cpp b/benchmarks/filesystem.bench.cpp index 677198035..3e4956059 100644 --- a/benchmarks/filesystem.bench.cpp +++ b/benchmarks/filesystem.bench.cpp @@ -1,17 +1,14 @@ -#include - #include "benchmark/benchmark.h" #include "GenerateInput.hpp" #include "test_iterators.h" - -namespace fs = std::experimental::filesystem; +#include "filesystem_include.hpp" static const size_t TestNumInputs = 1024; template void BM_PathConstructString(benchmark::State &st, GenInputs gen) { - using namespace fs; + using fs::path; const auto in = gen(st.range(0)); path PP; for (auto& Part : in) @@ -21,14 +18,15 @@ void BM_PathConstructString(benchmark::State &st, GenInputs gen) { const path P(PP.native()); benchmark::DoNotOptimize(P.native().data()); } + st.SetComplexityN(st.range(0)); } BENCHMARK_CAPTURE(BM_PathConstructString, large_string, - getRandomStringInputs)->Arg(TestNumInputs); + getRandomStringInputs)->Range(8, TestNumInputs)->Complexity(); template void BM_PathConstructCStr(benchmark::State &st, GenInputs gen) { - using namespace fs; + using fs::path; const auto in = gen(st.range(0)); path PP; for (auto& Part : in) @@ -45,7 +43,7 @@ BENCHMARK_CAPTURE(BM_PathConstructCStr, large_string, template