This is the mail archive of the gcc-bugs@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]

[Bug other/15000] Support setting the default symbol visibility for ELF


------- Additional Comments From bryner at brianryner dot com  2004-05-05 08:26 -------
(In reply to comment #24)
> It's definitely the case that attributes for classes are processed inside 
> outwards so I've reverted back to the old patch which works in the opposite 
> direction. I should have a new patch with the #pragma and nested classes 
> inheriting visibility by tonight.

The old patch also works "inside outwards".  That is, prehandle_attributes is
not going to be called for a class until the entire class has been parsed, which
implies that a nested class has already been finished off.  After the class
attributes are handled, it iterates over the member decls again (i.e.
check_field_decls) which allows the class attributes to be taken into account
for each member decl.

One reason for that, I think, is that attributes can come at the end of a
declaration, like this example from the documentation:

struct foo {
  int x;
  char a, b, c, d;
} __attribute__((packed));

You can see that in the analogous situation for visibility:

struct foo {
  struct bar {
     ...
  };
} __attribute__((visibility ("hidden")));

it would not be possible to know the outer class visibility when processing
foo::bar.

So I see a couple of ways to address this:

1. Say that the visibility attribute can only be at the beginning of a
class/struct declaration, and arrange to handle that attribute _before_ we begin
parsing class members.  I don't think there is any existing mechanism for
handling attributes at this stage, so we'd have to create something new.

2. Recursively reset DECL_VISIBILITY for members of inner classes once we reach
the end of a top-level class definition.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15000


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