This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH to C++ visibility for 21764 and 19238


On Mon, Mar 20, 2006 at 10:19:02PM -0500, Jason Merrill wrote:
> The problem in 19238 was that the existing code in determine_visibility 
> failed to consider function scope decls.  It also failed to consider 
> nested classes, so I fixed that, too.
> 
> I implemented the request in 21764 by making
> 
> namespace foo __attribute ((visibility ("hidden")))
> {
>   ...
> }
> 
> equivalent to
> 
> #pragma GCC visibility push(hidden)
> namespace foo
> {
>   ...
> }
> #pragma GCC visibility pop
> 
> So a subsequent namespace extension will not be affected by it.  This 
> seems like the right choice for namespaces, since separate 
> namespace-declarations are independent; other options lead to odd 
> effects from order of inclusion.

Do we check for buggy user code with mismatched push/pop across
this namespace declaration?  This seems like an awful thing to
have to track down without compiler help.

And I'm not sure this extension is useful at all without ...

> + namespace foo __attribute ((visibility ("hidden")))
> + {
> +   int f() { }
> +   void g();
> +   template <typename T> void t() { }
> +   class A
> +   {
> +     void m ();
> +   };
> + }
> + 
> + namespace foo
> + {
> +   void h() {}
> + }

... h being hidden?

Inclusion order is surely fixed by making sure that a header that
defines namespace foo is included before any other reference to
foo in the other headers.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]