From f8563f32068aa0207a0751f47b689492375a38e7 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 27 Aug 2016 19:32:03 +0000 Subject: [PATCH] Avoid embedded preprocessor directives in __tree Similar to rL242623, move C++ version checks outside of _NOEXCEPT_() macro invocation argument lists, to avoid "embedding a directive within macro arguments has undefined behavior" warnings. Differential Revision: https://reviews.llvm.org/D23961 llvm-svn: 279926 --- libcxx/include/__tree | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libcxx/include/__tree b/libcxx/include/__tree index b560bf0..f3f68b5 100644 --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -1111,14 +1111,15 @@ public: void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ); - +#else + _NOEXCEPT_(__is_nothrow_swappable::value); +#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1797,13 +1798,15 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT template void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ) +#else + _NOEXCEPT_(__is_nothrow_swappable::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_); -- 2.7.4