[libcxx] r300602 - Cleanup _LIBCPP_HAS_NO_<c++11-feature> macro uses in std::stack.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 18 14:16:26 PDT 2017


Author: ericwf
Date: Tue Apr 18 16:16:26 2017
New Revision: 300602

URL: http://llvm.org/viewvc/llvm-project?rev=300602&view=rev
Log:
Cleanup _LIBCPP_HAS_NO_<c++11-feature> macro uses in std::stack.

Modified:
    libcxx/trunk/include/stack
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
    libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp

Modified: libcxx/trunk/include/stack
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stack?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/include/stack (original)
+++ libcxx/trunk/include/stack Tue Apr 18 16:16:26 2017
@@ -126,29 +126,28 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     stack(const stack& __q) : c(__q.c) {}
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
+    stack& operator=(const stack& __q) {c = __q.c; return *this;}
+
+
+#ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     stack(stack&& __q)
         _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
         : c(_VSTD::move(__q.c)) {}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
     _LIBCPP_INLINE_VISIBILITY
-    stack& operator=(const stack& __q) {c = __q.c; return *this;}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    _LIBCPP_INLINE_VISIBILITY
     stack& operator=(stack&& __q)
         _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
         {c = _VSTD::move(__q.c); return *this;}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
     _LIBCPP_INLINE_VISIBILITY
-    explicit stack(const container_type& __c) : c(__c) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    _LIBCPP_INLINE_VISIBILITY
     explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
+
+    _LIBCPP_INLINE_VISIBILITY
+    explicit stack(const container_type& __c) : c(__c) {}
+
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         explicit stack(const _Alloc& __a,
@@ -167,7 +166,7 @@ public:
               typename enable_if<uses_allocator<container_type,
                                                 _Alloc>::value>::type* = 0)
             : c(__s.c, __a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         stack(container_type&& __c, const _Alloc& __a,
@@ -180,7 +179,7 @@ public:
               typename enable_if<uses_allocator<container_type,
                                                 _Alloc>::value>::type* = 0)
             : c(_VSTD::move(__s.c), __a) {}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
     _LIBCPP_INLINE_VISIBILITY
     bool empty()     const      {return c.empty();}
@@ -193,10 +192,10 @@ public:
 
     _LIBCPP_INLINE_VISIBILITY
     void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+
     template <class... _Args>
         _LIBCPP_INLINE_VISIBILITY
 #if _LIBCPP_STD_VER > 14
@@ -206,8 +205,8 @@ public:
         void      emplace(_Args&&... __args)
         {        c.emplace_back(_VSTD::forward<_Args>(__args)...);}
 #endif
-#endif  // _LIBCPP_HAS_NO_VARIADICS
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
+
     _LIBCPP_INLINE_VISIBILITY
     void pop() {c.pop_back();}
 

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp Tue Apr 18 16:16:26 2017
@@ -15,6 +15,7 @@
 #include <stack>
 #include <cassert>
 
+#include "test_macros.h"
 #include "test_allocator.h"
 
 struct test
@@ -24,10 +25,10 @@ struct test
 
     explicit test(const test_allocator<int>& a) : base(a) {}
     test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
     test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
     test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
     test_allocator<int> get_allocator() {return c.get_allocator();}
 };
 

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp Tue Apr 18 16:16:26 2017
@@ -16,6 +16,7 @@
 #include <cassert>
 #include <cstddef>
 
+#include "test_macros.h"
 #include "test_allocator.h"
 
 template <class C>
@@ -37,10 +38,10 @@ struct test
 
     explicit test(const test_allocator<int>& a) : base(a) {}
     test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
     test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
     test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
     test_allocator<int> get_allocator() {return c.get_allocator();}
 };
 

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // template <class Alloc>
@@ -18,7 +20,6 @@
 #include "test_allocator.h"
 #include "MoveOnly.h"
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 template <class C>
 C
@@ -47,13 +48,10 @@ struct test
     allocator_type get_allocator() {return this->c.get_allocator();}
 };
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 int main()
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
     assert(q.get_allocator() == test_allocator<MoveOnly>(4));
     assert(q.size() == 5);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // template <class Alloc>
@@ -18,7 +20,6 @@
 #include "test_allocator.h"
 #include "MoveOnly.h"
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 template <class C>
 C
@@ -47,14 +48,11 @@ struct test
     allocator_type get_allocator() {return this->c.get_allocator();}
 };
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 int main()
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
     test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
     assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
     assert(q2.size() == 5);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // stack(stack&& q);
@@ -16,7 +18,6 @@
 
 #include "MoveOnly.h"
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 template <class C>
 C
@@ -28,14 +29,11 @@ make(int n)
     return c;
 }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 int main()
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
     std::stack<MoveOnly> q2 = std::move(q);
     assert(q2.size() == 5);
     assert(q.empty());
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // explicit stack(container_type&& c);
@@ -16,7 +18,6 @@
 
 #include "MoveOnly.h"
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 template <class C>
 C
@@ -28,12 +29,9 @@ make(int n)
     return c;
 }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 int main()
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
     assert(q.size() == 5);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // stack()
@@ -24,10 +26,8 @@
 
 int main()
 {
-#if defined(_LIBCPP_VERSION)
     {
         typedef std::stack<MoveOnly> C;
         static_assert(std::is_nothrow_default_constructible<C>::value, "");
     }
-#endif // _LIBCPP_VERSION
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // stack(stack&&)
@@ -24,10 +26,8 @@
 
 int main()
 {
-#if defined(_LIBCPP_VERSION)
     {
         typedef std::stack<MoveOnly> C;
         static_assert(std::is_nothrow_move_constructible<C>::value, "");
     }
-#endif // _LIBCPP_VERSION
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // stack& operator=(stack&& q);
@@ -16,7 +18,6 @@
 
 #include "MoveOnly.h"
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 template <class C>
 C
@@ -28,15 +29,12 @@ make(int n)
     return c;
 }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 int main()
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
     std::stack<MoveOnly> q2;
     q2 = std::move(q);
     assert(q2.size() == 5);
     assert(q.empty());
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp Tue Apr 18 16:16:26 2017
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03
+
 // <stack>
 
 // void push(value_type&& v);
@@ -18,7 +20,6 @@
 
 int main()
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     std::stack<MoveOnly> q;
     q.push(MoveOnly(1));
     assert(q.size() == 1);
@@ -29,5 +30,4 @@ int main()
     q.push(MoveOnly(3));
     assert(q.size() == 3);
     assert(q.top() == MoveOnly(3));
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }




More information about the cfe-commits mailing list