Preview: PATCH to overhaul C++ visibility handling

Jason Merrill jason@redhat.com
Mon Jun 26 01:17:00 GMT 2006


Jason Merrill wrote:
> This patch reimplements large chunks of the visibility handling in GCC 
> to improve handling of type visibility.  Notable changes:
> 
> Visibility restrictions are propagated from class to members (26905), 
> and from template arguments to instantiations (26612).
> 
> We now give an error if a declaration has higher visibility than its 
> type, or if a class has higher visibility than one of its non-static 
> data member types.
> 
> Declarations in the anonymous namespace, or declarations which use types 
> from the anonymous namespace, etc. are now local to the file (21581, 
> 25915).
> 
> An explicit visibility attribute on a class must come between the 
> class-key and the name, not after the closing brace.

Fixes 26905.

> Attributes are now allowed on elaborated-type-specifiers that only 
> declare the type (21675), and after the 'enum' keyword in enum definitons.

More fixes in the current patch:

Implicit template instantiations are not affected by #pragma visibility 
(27000), nor are type_info nodes (26984).

The visibility attribute is respected on explicit template 
instantiations (17470).

Non-inline specializations of inline functions are not affected by 
-fvisibility-inlines-hidden (19134).

I'm planning to look at 20218 and 23756 soon; they have to do with the 
backend's use of visibility, this patch deals with setting the 
visibility properly.  Any other visibility bug reports I'm missing?

Tested on x86_64-pc-linux-gnu.  I'd like to apply this patch for 4.2, 
since it fixes the various issues that make visibility support useless 
for C++.  Perhaps leaving out the bits to make the anonymous namespace 
imply TREE_PUBLIC = 0 for now; that code seems the most risky, and 
orthogonal to the actual visibility support.  Mark?

Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vis5.patch
Type: text/x-patch
Size: 73320 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060626/858fb5d8/attachment.bin>


More information about the Gcc-patches mailing list