dim created this revision. dim added reviewers: mclow.lists, EricWF. dim added subscribers: emaste, cfe-commits.
When I compile <map> as part of clang, with -pedantic enabled, I get the following warnings: In file included from /usr/include/c++/v1/map:442: /usr/include/c++/v1/__tree:874:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #if _LIBCPP_STD_VER <= 11 ^ /usr/include/c++/v1/__tree:877:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #endif ^ /usr/include/c++/v1/__tree:1392:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #if _LIBCPP_STD_VER <= 11 ^ /usr/include/c++/v1/__tree:1395:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #endif ^ This is because the `#if`s are within the parameter list of a `_NOEXCEPT_()` macro invocation. EricWF fixed something similar in rL242623, by moving the `#if` outside the macro invocation. https://reviews.llvm.org/D23961 Files: include/__tree Index: include/__tree =================================================================== --- include/__tree +++ include/__tree @@ -1111,14 +1111,15 @@ void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable<value_compare>::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_compare>::value); +#endif #ifndef _LIBCPP_CXX03_LANG template <class _Key, class ..._Args> @@ -1797,13 +1798,15 @@ template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable<value_compare>::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_compare>::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_);
Index: include/__tree =================================================================== --- include/__tree +++ include/__tree @@ -1111,14 +1111,15 @@ void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable<value_compare>::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_compare>::value); +#endif #ifndef _LIBCPP_CXX03_LANG template <class _Key, class ..._Args> @@ -1797,13 +1798,15 @@ template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable<value_compare>::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_compare>::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits