[PATCH][libcxx] add visibility for swap forward declaration

Marshall Clow mclow.lists at gmail.com
Tue Feb 24 04:49:29 PST 2015


> On Feb 23, 2015, at 7:08 PM, Steven Wu <stevenwu at apple.com> wrote:
> 
> Hi Marshall
> 
> This patch added a visibility declaration for the forward declaration you added in r225285.
> The forward declared the swap function has no visibility and it might failed to compiler when user tries to change default visibility. For example:
> #pragma GCC visibility push(default)
> #include <utility>
> #pragma GCC visibility pop
> In this case, forward declaration and definition will not have the same visibility and the program will failed to compile.
> This can be fixed by adding the same visibly to the forward declaration.
> 
> diff --git a/include/utility b/include/utility
> index 2cb1018..96db60a 100644
> --- a/include/utility
> +++ b/include/utility
> @@ -204,6 +204,7 @@ operator>=(const _Tp& __x, const _Tp& __y)
> 
> // forward
> template<class _Tp, size_t _Np>
> +inline _LIBCPP_INLINE_VISIBILITY
> void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
> 
> template <class _ForwardIterator1, class _ForwardIterator2>

Committed revision 230330.
Thanks!

— Marshall






More information about the cfe-commits mailing list