diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -533,6 +533,16 @@ # Thus, we do nothing and hope we don't accidentally include any of the C++ # headers add_compile_flags_if_supported(-nostdinc++) +add_compile_flags_if_supported(-fcolor-diagnostics) + +option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE) +if (${FORCE_COLORED_OUTPUT}) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options (-fdiagnostics-color=always) + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options (-fcolor-diagnostics) + endif () +endif () # Hide all inline function definitions which have not explicitly been marked # visible. This prevents new definitions for inline functions from appearing in diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -1502,11 +1502,12 @@ #endif // _LIBCPP_CXX03_LANG template -void +decltype(auto) forward_list<_Tp, _Alloc>::remove(const value_type& __v) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing iterator __e = end(); + __VSTD::size_type __rm = 0; for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) { if (__i.__get_begin()->__next_->__value_ == __v) @@ -1515,6 +1516,7 @@ for (; __j != __e && *__j == __v; ++__j) ; __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); + ++__rm; if (__j == __e) break; __i = __j; @@ -1522,15 +1524,21 @@ else ++__i; } +#if _LIBCPP_STD_VER > 17 + return __rm; +#else + (void) __rm; +#endif } template template -void +decltype(auto) forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing iterator __e = end(); + __VSTD::size_type __rm = 0; for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) { if (__pred(__i.__get_begin()->__next_->__value_)) @@ -1539,6 +1547,7 @@ for (; __j != __e && __pred(*__j); ++__j) ; __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); + ++__rm; if (__j == __e) break; __i = __j; @@ -1546,6 +1555,11 @@ else ++__i; } +#if _LIBCPP_STD_VER > 17 + return __rm; +#else + (void) __rm; +#endif } template diff --git a/libcxx/include/numeric b/libcxx/include/numeric --- a/libcxx/include/numeric +++ b/libcxx/include/numeric @@ -143,7 +143,9 @@ #include <__config> #include +#if _LIBCPP_STD_VER > 17 #include // for numeric_limits +#endif #include #include // for isnormal #include @@ -172,8 +174,13 @@ _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { - for (; __first != __last; ++__first) + for (; __first != __last; ++__first) { +#if _LIBCPP_STD_VER > 17 + __init = __binary_op(_VSTD::move(__init), *__first); +#else __init = __binary_op(__init, *__first); +#endif + } return __init; } @@ -222,8 +229,13 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { - for (; __first1 != __last1; ++__first1, (void) ++__first2) + for (; __first1 != __last1; ++__first1, (void) ++__first2) { +#if _LIBCPP_STD_VER > 17 + __init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); +#else __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); +#endif + } return __init; } @@ -292,8 +304,13 @@ *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { +#if _LIBCPP_STD_VER > 17 + __t = __binary_op(_VSTD::move(__t), *__first); + *__result = __t; +#else __t = __binary_op(__t, *__first); *__result = __t; +#endif } } return __result; @@ -442,7 +459,11 @@ for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); +#if _LIBCPP_STD_VER > 17 + *__result = __binary_op(__t2, _VSTD::move(__t1)); +#else *__result = __binary_op(__t2, __t1); +#endif __t1 = _VSTD::move(__t2); } }