diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h --- a/libcxx/include/__algorithm/stable_sort.h +++ b/libcxx/include/__algorithm/stable_sort.h @@ -38,14 +38,14 @@ { if (__first1 == __last1) { - for (; __first2 != __last2; ++__first2, ++__result, (void)__d.template __incr()) + for (; __first2 != __last2; ++__first2, (void) ++__result, __d.template __incr()) ::new ((void*)__result) value_type(_VSTD::move(*__first2)); __h.release(); return; } if (__first2 == __last2) { - for (; __first1 != __last1; ++__first1, ++__result, (void)__d.template __incr()) + for (; __first1 != __last1; ++__first1, (void) ++__result, __d.template __incr()) ::new ((void*)__result) value_type(_VSTD::move(*__first1)); __h.release(); return; diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -2348,7 +2348,7 @@ size_type __chash = __constrain_hash(__cp->__hash(), __nbc); __bucket_list_[__chash] = __pp; size_type __phash = __chash; - for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr; + for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) { __chash = __constrain_hash(__cp->__hash(), __nbc); @@ -2758,7 +2758,7 @@ { for (__np = __np->__next_; __np != nullptr && __constrain_hash(__np->__hash(), __bc) == __n; - __np = __np->__next_, ++__r) + __np = __np->__next_, (void) ++__r) ; } return __r; diff --git a/libcxx/include/__memory/uninitialized_algorithms.h b/libcxx/include/__memory/uninitialized_algorithms.h --- a/libcxx/include/__memory/uninitialized_algorithms.h +++ b/libcxx/include/__memory/uninitialized_algorithms.h @@ -145,7 +145,7 @@ #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif - for (; __n > 0; (void)++__idx, --__n) + for (; __n > 0; ++__idx, (void) --__n) ::new ((void*)_VSTD::addressof(*__idx)) _Vt; return __idx; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -183,7 +183,7 @@ #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif - for (; __n > 0; (void)++__idx, --__n) + for (; __n > 0; ++__idx, (void) --__n) ::new ((void*)_VSTD::addressof(*__idx)) _Vt(); return __idx; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -203,7 +203,7 @@ #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif - for (; __first != __last; (void)++__idx, ++__first) + for (; __first != __last; ++__idx, (void) ++__first) ::new ((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); return __idx; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -223,7 +223,7 @@ #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif - for (; __n > 0; ++__idx, (void)++__first, --__n) + for (; __n > 0; ++__idx, (void) ++__first, --__n) ::new ((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); return {__first, __idx}; #ifndef _LIBCPP_NO_EXCEPTIONS diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer --- a/libcxx/include/__split_buffer +++ b/libcxx/include/__split_buffer @@ -239,7 +239,7 @@ size_type __old_cap = __end_cap() - __first_; size_type __new_cap = _VSTD::max(2 * __old_cap, 8); __split_buffer __buf(__new_cap, 0, __a); - for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_) + for (pointer __p = __begin_; __p != __end_; ++__p, (void) ++__buf.__end_) __alloc_traits::construct(__buf.__alloc(), _VSTD::__to_address(__buf.__end_), _VSTD::move(*__p)); swap(__buf); @@ -259,7 +259,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) { _ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last)); - for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) { + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void) ++__first) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), *__first); } diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2214,7 +2214,7 @@ size_type __de = __base::size() - __pos; if (__n > __de) { - for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size()) + for (size_type __m = __n - __de; __m; --__m, (void) ++__i, ++__base::size()) __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v); __n = __de; } @@ -2317,7 +2317,7 @@ if (__n > 0) { iterator __oen = __old_end - __n; - for (iterator __j = __oen; __j != __old_end; ++__i, ++__j, ++__base::size()) + for (iterator __j = __oen; __j != __old_end; ++__i, (void) ++__j, ++__base::size()) __alloc_traits::construct(__a, _VSTD::addressof(*__i), _VSTD::move(*__j)); if (__n < __de) __old_end = _VSTD::move_backward(__old_end - __de, __oen, __old_end); diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -1408,7 +1408,7 @@ { iterator __i = begin(); iterator __e = end(); - for (; __f != __l && __i != __e; ++__f, ++__i) + for (; __f != __l && __i != __e; ++__f, (void) ++__i) *__i = *__f; if (__i == __e) insert(__e, __f, __l); @@ -1425,7 +1425,7 @@ { iterator __i = begin(); iterator __e = end(); - for (; __n > 0 && __i != __e; --__n, ++__i) + for (; __n > 0 && __i != __e; --__n, (void) ++__i) *__i = __x; if (__i == __e) insert(__e, __n, __x); @@ -1495,7 +1495,7 @@ try { #endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, ++__e, ++__ds) + for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); @@ -1561,7 +1561,7 @@ try { #endif // _LIBCPP_NO_EXCEPTIONS - for (++__f; __f != __l; ++__f, (void) ++__e, (void) ++__ds) + for (++__f; __f != __l; ++__f, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); @@ -1909,7 +1909,7 @@ try { #endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, ++__e, ++__ds) + for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); @@ -1967,7 +1967,7 @@ try { #endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, ++__e, ++__ds) + for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); @@ -2244,7 +2244,7 @@ { size_type __ds = 1; iterator __m2 = _VSTD::next(__f2); - for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds) + for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void) ++__ds) ; base::__sz() += __ds; __c.__sz() -= __ds; diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -2525,7 +2525,7 @@ __grow_by(__cap, __n - __cap, __sz, 0, __sz); } pointer __p = __get_pointer(); - for (; __first != __last; ++__first, ++__p) + for (; __first != __last; ++__p, (void) ++__first) traits_type::assign(*__p, *__first); traits_type::assign(*__p, value_type()); __set_size(__n); @@ -2703,7 +2703,7 @@ if (__cap - __sz < __n) __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0); pointer __p = __get_pointer() + __sz; - for (; __first != __last; ++__p, ++__first) + for (; __first != __last; ++__p, (void) ++__first) traits_type::assign(*__p, *__first); traits_type::assign(*__p, value_type()); __set_size(__sz + __n); @@ -2881,7 +2881,7 @@ __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); - for (__p += __ip; __first != __last; ++__p, ++__first) + for (__p += __ip; __first != __last; ++__p, (void) ++__first) traits_type::assign(*__p, *__first); } else diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -1063,7 +1063,7 @@ { _ConstructTransaction __tx(*this, __n); const_pointer __new_end = __tx.__new_end_; - for (pointer __pos = __tx.__pos_; __pos != __new_end; ++__pos, __tx.__pos_ = __pos) { + for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__pos)); } } @@ -1081,7 +1081,7 @@ { _ConstructTransaction __tx(*this, __n); const_pointer __new_end = __tx.__new_end_; - for (pointer __pos = __tx.__pos_; __pos != __new_end; ++__pos, __tx.__pos_ = __pos) { + for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__pos), __x); } } @@ -1775,7 +1775,7 @@ pointer __i = __from_s + __n; _ConstructTransaction __tx(*this, __from_e - __i); for (pointer __pos = __tx.__pos_; __i < __from_e; - ++__i, ++__pos, __tx.__pos_ = __pos) { + ++__i, (void) ++__pos, __tx.__pos_ = __pos) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__pos), _VSTD::move(*__i)); diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp @@ -246,7 +246,7 @@ c.insert(c.end(), std::move_iterator(&mo), std::move_iterator(&mo+1)); } int j = 0; - for (CI i = c.begin(); i != c.end(); ++i, ++j) + for (CI i = c.begin(); i != c.end(); ++i, (void) ++j) assert(*i == MoveOnly(j)); { MoveOnly mo(1); @@ -254,7 +254,7 @@ c.insert(c.end(), std::move_iterator(I(&mo)), std::move_iterator(I(&mo+1))); } j = 0; - for (CI i = c.begin(); i != c.end(); ++i, ++j) + for (CI i = c.begin(); i != c.end(); ++i, (void) ++j) assert(*i == MoveOnly(j)); #endif } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp @@ -54,11 +54,11 @@ assert(c1.size() == c1_osize + 1); assert(static_cast(distance(c1.begin(), c1.end())) == c1.size()); i = c1.begin(); - for (int j = 0; j < P; ++j, ++i) + for (int j = 0; j < P; ++j, (void) ++i) assert(*i == MoveOnly(j)); assert(*i == MoveOnly(x)); ++i; - for (int j = P; static_cast(j) < c1_osize; ++j, ++i) + for (int j = P; static_cast(j) < c1_osize; ++j, (void) ++i) assert(*i == MoveOnly(j)); } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp @@ -53,7 +53,7 @@ { C c = make(size, rng[j]); typename C::const_iterator it = c.begin(); - for (int i = 0; i < size; ++i, ++it) + for (int i = 0; i < size; ++i, (void) ++it) assert(*it == MoveOnly(i)); } } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp @@ -55,7 +55,7 @@ I i = c1.begin(); assert(*i == MoveOnly(x)); ++i; - for (int j = 0; static_cast(j) < c1_osize; ++j, ++i) + for (int j = 0; static_cast(j) < c1_osize; ++j, (void) ++i) assert(*i == MoveOnly(j)); } diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp @@ -34,7 +34,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(10)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == n); assert(n == 10); assert(c1.get_allocator() == A(10)); @@ -51,7 +51,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(11)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == n); assert(n == 10); assert(c1.get_allocator() == A(11)); @@ -68,7 +68,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(10)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == 10+n); assert(n == 4); assert(c1.get_allocator() == A(10)); @@ -85,7 +85,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(11)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == 10+n); assert(n == 4); assert(c1.get_allocator() == A(11)); @@ -103,7 +103,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(10)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == n); assert(n == 10); assert(c1.get_allocator() == A(10)); @@ -120,7 +120,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(11)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == n); assert(n == 10); assert(c1.get_allocator() == A(10)); @@ -137,7 +137,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(10)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == 10+n); assert(n == 4); assert(c1.get_allocator() == A(10)); @@ -154,7 +154,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A(11)); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == 10+n); assert(n == 4); assert(c1.get_allocator() == A(10)); @@ -171,7 +171,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A()); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == n); assert(n == 10); assert(c1.get_allocator() == A()); @@ -188,7 +188,7 @@ C c1(I(std::begin(t1)), I(std::end(t1)), A()); c1 = std::move(c0); int n = 0; - for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n) + for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n) assert(*i == 10+n); assert(n == 4); assert(c1.get_allocator() == A()); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp @@ -32,7 +32,7 @@ C c0(I(std::begin(t)), I(std::end(t)), A(10)); C c = std::move(c0); int n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); assert(c0.empty()); @@ -47,7 +47,7 @@ C c0(I(std::begin(t)), I(std::end(t)), A(10)); C c = std::move(c0); int n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); assert(c0.empty()); @@ -62,7 +62,7 @@ C c0(I(std::begin(t)), I(std::end(t)), A()); C c = std::move(c0); int n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); assert(c0.empty()); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp @@ -32,7 +32,7 @@ C c0(I(std::begin(t)), I(std::end(t)), A(10)); C c(std::move(c0), A(10)); unsigned n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n) assert(*i == n); assert(n == static_cast(std::end(t) - std::begin(t))); assert(c0.empty()); @@ -47,7 +47,7 @@ C c0(I(std::begin(t)), I(std::end(t)), A(10)); C c(std::move(c0), A(9)); unsigned n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n) assert(*i == n); assert(n == static_cast(std::end(t) - std::begin(t))); assert(!c0.empty()); @@ -62,7 +62,7 @@ C c0(I(std::begin(t)), I(std::end(t)), A()); C c(std::move(c0), A()); unsigned n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n) assert(*i == n); assert(n == static_cast(std::end(t) - std::begin(t))); assert(c0.empty()); diff --git a/libcxx/test/support/MoveOnly.h b/libcxx/test/support/MoveOnly.h --- a/libcxx/test/support/MoveOnly.h +++ b/libcxx/test/support/MoveOnly.h @@ -48,6 +48,9 @@ { return MoveOnly{data_ + x.data_}; } TEST_CONSTEXPR_CXX14 MoveOnly operator*(const MoveOnly& x) const { return MoveOnly{data_ * x.data_}; } + + template + friend void operator,(T t, U u) = delete; }; namespace std {