Author: ericwf Date: Tue Apr 18 20:02:49 2017 New Revision: 300637 URL: http://llvm.org/viewvc/llvm-project?rev=300637&view=rev Log: Cleanup _LIBCPP_HAS_NO_<c++11-feature> in support headers and final tests
Modified: libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp libcxx/trunk/test/libcxx/strings/iterators.exceptions.pass.cpp libcxx/trunk/test/libcxx/strings/iterators.noexcept.pass.cpp libcxx/trunk/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp libcxx/trunk/test/support/Counter.h libcxx/trunk/test/support/MoveOnly.h libcxx/trunk/test/support/allocators.h libcxx/trunk/test/support/nasty_containers.hpp libcxx/trunk/test/support/tracked_value.h Modified: libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp (original) +++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp Tue Apr 18 20:02:49 2017 @@ -13,6 +13,7 @@ #include <vector> #include <cassert> +#include "test_macros.h" #include "asan_testing.h" class X { @@ -70,7 +71,7 @@ void test_push_back() { } void test_emplace_back() { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 std::vector<X> v; v.reserve(2); v.push_back(X(2)); @@ -83,7 +84,7 @@ void test_emplace_back() { } assert(v.size() == 1); assert(is_contiguous_container_asan_correct(v)); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } void test_insert_range() { @@ -121,7 +122,7 @@ void test_insert() { } void test_emplace() { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 std::vector<X> v; v.reserve(3); v.insert(v.end(), X(1)); @@ -135,7 +136,7 @@ void test_emplace() { } assert(v.size() == 2); assert(is_contiguous_container_asan_correct(v)); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } void test_insert_range2() { Modified: libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp (original) +++ libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp Tue Apr 18 20:02:49 2017 @@ -179,7 +179,7 @@ int main() static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::const_iterator> ::value), ""); Modified: libcxx/trunk/test/libcxx/strings/iterators.exceptions.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/strings/iterators.exceptions.pass.cpp?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/strings/iterators.exceptions.pass.cpp (original) +++ libcxx/trunk/test/libcxx/strings/iterators.exceptions.pass.cpp Tue Apr 18 20:02:49 2017 @@ -80,7 +80,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), ""); Modified: libcxx/trunk/test/libcxx/strings/iterators.noexcept.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/strings/iterators.noexcept.pass.cpp?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/strings/iterators.noexcept.pass.cpp (original) +++ libcxx/trunk/test/libcxx/strings/iterators.noexcept.pass.cpp Tue Apr 18 20:02:49 2017 @@ -28,6 +28,7 @@ #include <vector> #include <initializer_list> +#include "test_macros.h" #include "test_iterators.h" int main() @@ -72,7 +73,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), ""); Modified: libcxx/trunk/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp Tue Apr 18 20:02:49 2017 @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // type_traits // extension @@ -16,7 +18,6 @@ #include <type_traits> -#ifndef _LIBCPP_HAS_NO_CONSTEXPR struct A { @@ -54,11 +55,9 @@ struct J constexpr J* operator&() const &&; }; -#endif // _LIBCPP_HAS_NO_CONSTEXPR int main() { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR static_assert(std::__has_operator_addressof<int>::value == false, ""); static_assert(std::__has_operator_addressof<A>::value == false, ""); static_assert(std::__has_operator_addressof<B>::value == true, ""); @@ -67,5 +66,4 @@ int main() static_assert(std::__has_operator_addressof<G>::value == true, ""); static_assert(std::__has_operator_addressof<H>::value == true, ""); static_assert(std::__has_operator_addressof<J>::value == true, ""); -#endif // _LIBCPP_HAS_NO_CONSTEXPR } Modified: libcxx/trunk/test/support/Counter.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/Counter.h?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/support/Counter.h (original) +++ libcxx/trunk/test/support/Counter.h Tue Apr 18 20:02:49 2017 @@ -12,6 +12,8 @@ #include <functional> // for std::hash +#include "test_macros.h" + struct Counter_base { static int gConstructed; }; template <typename T> @@ -22,7 +24,7 @@ public: Counter(const T &data) : data_(data) { ++gConstructed; } Counter(const Counter& rhs) : data_(rhs.data_) { ++gConstructed; } Counter& operator=(const Counter& rhs) { ++gConstructed; data_ = rhs.data_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 Counter(Counter&& rhs) : data_(std::move(rhs.data_)) { ++gConstructed; } Counter& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; } #endif Modified: libcxx/trunk/test/support/MoveOnly.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/MoveOnly.h?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/support/MoveOnly.h (original) +++ libcxx/trunk/test/support/MoveOnly.h Tue Apr 18 20:02:49 2017 @@ -12,7 +12,7 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 #include <cstddef> #include <functional> @@ -49,6 +49,6 @@ struct hash<MoveOnly> } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 #endif // MOVEONLY_H Modified: libcxx/trunk/test/support/allocators.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/allocators.h?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/support/allocators.h (original) +++ libcxx/trunk/test/support/allocators.h Tue Apr 18 20:02:49 2017 @@ -15,7 +15,7 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 template <class T> class A1 @@ -186,6 +186,6 @@ bool operator!=(const A3<T>& x, const A3 return !(x == y); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 #endif // ALLOCATORS_H Modified: libcxx/trunk/test/support/nasty_containers.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/nasty_containers.hpp?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/support/nasty_containers.hpp (original) +++ libcxx/trunk/test/support/nasty_containers.hpp Tue Apr 18 20:02:49 2017 @@ -39,7 +39,7 @@ public: explicit nasty_vector(size_type n) : v_(n) {} nasty_vector(size_type n, const value_type& value) : v_(n, value) {} template <class InputIterator> nasty_vector(InputIterator first, InputIterator last) : v_(first, last) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 nasty_vector(std::initializer_list<value_type> il) : v_(il) {} #endif ~nasty_vector() {} @@ -47,7 +47,7 @@ public: template <class InputIterator> void assign(InputIterator first, InputIterator last) { v_.assign(first, last); } void assign(size_type n, const value_type& u) { v_.assign(n, u); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 void assign(std::initializer_list<value_type> il) { v_.assign(il); } #endif @@ -87,24 +87,20 @@ public: const value_type* data() const TEST_NOEXCEPT { return v_.data(); } void push_back(const value_type& x) { v_.push_back(x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 void push_back(value_type&& x) { v_.push_back(std::forward<value_type&&>(x)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS template <class... Args> void emplace_back(Args&&... args) { v_.emplace_back(std::forward<Args>(args)...); } #endif -#endif void pop_back() { v_.pop_back(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class... Args> iterator emplace(const_iterator pos, Args&&... args) { return v_.emplace(pos, std::forward<Args>(args)...); } #endif -#endif iterator insert(const_iterator pos, const value_type& x) { return v_.insert(pos, x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, value_type&& x) { return v_.insert(pos, std::forward<value_type>(x)); } #endif iterator insert(const_iterator pos, size_type n, const value_type& x) { return v_.insert(pos, n, x); } @@ -112,7 +108,7 @@ public: iterator insert(const_iterator pos, InputIterator first, InputIterator last) { return v_.insert(pos, first, last); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return v_.insert(pos, il); } #endif @@ -166,19 +162,19 @@ public: nasty_list(size_type n, const value_type& value) : l_(n,value) {} template <class Iter> nasty_list(Iter first, Iter last) : l_(first, last) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 nasty_list(std::initializer_list<value_type> il) : l_(il) {} #endif ~nasty_list() {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 nasty_list& operator=(std::initializer_list<value_type> il) { l_ = il; return *this; } #endif template <class Iter> void assign(Iter first, Iter last) { l_.assign(first, last); } void assign(size_type n, const value_type& t) { l_.assign(n, t); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 void assign(std::initializer_list<value_type> il) { l_.assign(il); } #endif @@ -209,28 +205,24 @@ public: void push_front(const value_type& x) { l_.push_front(x); } void push_back(const value_type& x) { l_.push_back(x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 void push_back(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); } void push_front(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS template <class... Args> void emplace_back(Args&&... args) { l_.emplace_back(std::forward<Args>(args)...); } template <class... Args> void emplace_front(Args&&... args) { l_.emplace_front(std::forward<Args>(args)...); } #endif -#endif void pop_front() { l_.pop_front(); } void pop_back() { l_.pop_back(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class... Args> iterator emplace(const_iterator pos, Args&&... args) { return l_.emplace(pos, std::forward<Args>(args)...); } #endif -#endif iterator insert(const_iterator pos, const value_type& x) { return l_.insert(pos, x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, value_type&& x) { return l_.insert(pos, std::forward<value_type>(x)); } #endif iterator insert(const_iterator pos, size_type n, const value_type& x) { return l_.insert(pos, n, x); } @@ -238,7 +230,7 @@ public: iterator insert(const_iterator pos, InputIterator first, InputIterator last) { return l_.insert(pos, first, last); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return l_.insert(pos, il); } #endif Modified: libcxx/trunk/test/support/tracked_value.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/tracked_value.h?rev=300637&r1=300636&r2=300637&view=diff ============================================================================== --- libcxx/trunk/test/support/tracked_value.h (original) +++ libcxx/trunk/test/support/tracked_value.h Tue Apr 18 20:02:49 2017 @@ -11,6 +11,8 @@ #include <cassert> +#include "test_macros.h" + struct TrackedValue { enum State { CONSTRUCTED, MOVED_FROM, DESTROYED }; State state; @@ -22,7 +24,7 @@ struct TrackedValue { assert(t.state != State::DESTROYED && "copying a destroyed object"); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 TrackedValue(TrackedValue&& t) : state(State::CONSTRUCTED) { assert(t.state != State::MOVED_FROM && "double moving from an object"); assert(t.state != State::DESTROYED && "moving from a destroyed object"); @@ -38,7 +40,7 @@ struct TrackedValue { return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 TrackedValue& operator=(TrackedValue&& t) { assert(state != State::DESTROYED && "move assigning into destroyed object"); assert(t.state != State::MOVED_FROM && "double moving from an object"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits