Hi,

Some time ago, I reported PR 13688, which is about building Firefox with
libc++ (usually in C++11 mode).  Firefox uses visibility pragmas for
various reasons, one of which boils down to:

  #pragma GCC visibility push(default)
  #include <iterator>

Since Rafael suggested the most probable solution of the PR is to
correct libc++, and I agree, I took a shot at making most of the
visibility declarations consistent.  A patch for this is attached.

My testcase is to compile all the libc++ headers, preceding this with a
#pragma GCC visibility push(default).  See the attached .cpp file.

In a follow-up post, I will attempt to do the same for when the first
line of the testcase is #pragma GCC visibility push(hidden).  This leads
to a whole bunch of other errors, which have only been partially solved
by the fix for PR 13662.

-Dimitry
Index: include/system_error
===================================================================
--- include/system_error	(revision 163535)
+++ include/system_error	(working copy)
@@ -359,7 +359,7 @@ class error_code;
 
 // class error_category
 
-class __do_message;
+class _LIBCPP_HIDDEN __do_message;
 
 class _LIBCPP_VISIBLE error_category
 {
@@ -387,7 +387,7 @@ class _LIBCPP_VISIBLE error_category
     _LIBCPP_ALWAYS_INLINE
     bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
 
-    friend class __do_message;
+    friend class _LIBCPP_HIDDEN __do_message;
 };
 
 class _LIBCPP_HIDDEN __do_message
Index: include/type_traits
===================================================================
--- include/type_traits	(revision 163535)
+++ include/type_traits	(working copy)
@@ -2829,11 +2829,13 @@ __invoke(__any, _Args&& ...__args)
 // bullets 1 and 2
 
 template <class _Fp, class _A0, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
     -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));
 
 template <class _Fp, class _A0, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
     -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));
@@ -2841,11 +2843,13 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
 // bullets 3 and 4
 
 template <class _Fp, class _A0>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0)
     -> decltype(_VSTD::forward<_A0>(__a0).*__f);
 
 template <class _Fp, class _A0>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0)
     -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
@@ -2853,6 +2857,7 @@ __invoke(_Fp&& __f, _A0&& __a0)
 // bullet 5
 
 template <class _Fp, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _Args&& ...__args)
     -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));
Index: include/thread
===================================================================
--- include/thread	(revision 163535)
+++ include/thread	(working copy)
@@ -179,7 +179,7 @@ class __thread_id;
 namespace this_thread
 {
 
-__thread_id get_id() _NOEXCEPT;
+_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
 
 }  // this_thread
 
Index: include/mutex
===================================================================
--- include/mutex	(revision 163535)
+++ include/mutex	(working copy)
@@ -430,12 +430,14 @@ struct once_flag;
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
 template<class _Callable, class... _Args>
-  void call_once(once_flag&, _Callable&&, _Args&&...);
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable&&, _Args&&...);
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
 
 template<class _Callable>
-  void call_once(once_flag&, _Callable);
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable);
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
Index: include/random
===================================================================
--- include/random	(revision 163535)
+++ include/random	(working copy)
@@ -1817,6 +1817,7 @@ class linear_congruential_engine;
 
 template <class _CharT, class _Traits,
           class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+_LIBCPP_INLINE_VISIBILITY
 basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
@@ -2035,6 +2036,7 @@ operator==(const mersenne_twister_engine<_UI, _Wp,
 template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
           _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
@@ -2433,6 +2435,7 @@ operator==(
     const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
 
 template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(
     const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
Index: include/queue
===================================================================
--- include/queue	(revision 163535)
+++ include/queue	(working copy)
@@ -180,10 +180,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _Tp, class _Container> class queue;
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
 
Index: include/__locale
===================================================================
--- include/__locale	(revision 163535)
+++ include/__locale	(working copy)
@@ -33,9 +33,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 class locale;
 
-template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
-template <class _Facet> const _Facet& use_facet(const locale&);
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+bool
+has_facet(const locale&) _NOEXCEPT;
 
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+const _Facet&
+use_facet(const locale&);
+
 class _LIBCPP_VISIBLE locale
 {
 public:
Index: include/iterator
===================================================================
--- include/iterator	(revision 163535)
+++ include/iterator	(working copy)
@@ -1009,43 +1009,52 @@ make_move_iterator(const _Iter& __i)
 template <class _Iter> class __wrap_iter;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 typename __wrap_iter<_Iter1>::difference_type
 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter>
+_LIBCPP_INLINE_VISIBILITY
 __wrap_iter<_Iter>
 operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
 
-template <class _Ip, class _Op> _Op copy(_Ip, _Ip, _Op);
-template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
-template <class _Ip, class _Op> _Op move(_Ip, _Ip, _Op);
-template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_trivially_copy_assignable<_Tp>::value,
@@ -1313,34 +1322,42 @@ operator+(typename __wrap_iter<_Iter>::difference_
 template <class _Container, class _Iter> class __debug_iter;
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 typename __debug_iter<_Container, _Iter1>::difference_type
 operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter>
+_LIBCPP_INLINE_VISIBILITY
 __debug_iter<_Container, _Iter>
 operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
 
Index: include/stack
===================================================================
--- include/stack	(revision 163535)
+++ include/stack	(working copy)
@@ -94,10 +94,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _Tp, class _Container> class stack;
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
 
Index: include/valarray
===================================================================
--- include/valarray	(revision 163535)
+++ include/valarray	(working copy)
@@ -388,18 +388,22 @@ template <class _Tp> class mask_array;
 template <class _Tp> class indirect_array;
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 begin(valarray<_Tp>& __v);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 const _Tp*
 begin(const valarray<_Tp>& __v);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 end(valarray<_Tp>& __v);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 const _Tp*
 end(const valarray<_Tp>& __v);
 
Index: include/__tuple
===================================================================
--- include/__tuple	(revision 163535)
+++ include/__tuple	(working copy)
@@ -79,38 +79,47 @@ template <class _T1, class _T2> struct __tuple_lik
 template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
 
 template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, tuple<_Tp...> >::type&
 get(tuple<_Tp...>&) _NOEXCEPT;
 
 template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
 get(const tuple<_Tp...>&) _NOEXCEPT;
 
 template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
 get(tuple<_Tp...>&&) _NOEXCEPT;
 
 template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
 get(pair<_T1, _T2>&) _NOEXCEPT;
 
 template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
 get(const pair<_T1, _T2>&) _NOEXCEPT;
 
 template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
 get(pair<_T1, _T2>&&) _NOEXCEPT;
 
 template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
 _Tp&
 get(array<_Tp, _Size>&) _NOEXCEPT;
 
 template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
 const _Tp&
 get(const array<_Tp, _Size>&) _NOEXCEPT;
 
 template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
 _Tp&&
 get(array<_Tp, _Size>&&) _NOEXCEPT;
 
#pragma GCC visibility push(default)
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <cassert>
#include <ccomplex>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <codecvt>
#include <complex>
#include <condition_variable>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctgmath>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <deque>
#include <exception>
#include <ext/hash_map>
#include <ext/hash_set>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <strstream>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to