Bug 9283 - __attribute__((visibility ("hidden"))) not supported for class/struct
Summary: __attribute__((visibility ("hidden"))) not supported for class/struct
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P3 enhancement
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: patch
: 9332 13905 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-01-12 10:46 UTC by Dirk Mueller
Modified: 2014-02-16 13:13 UTC (History)
4 users (show)

See Also:
Host: i486-suse-linux-gnu
Target: i486-suse-linux-gnu
Build: i486-suse-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-11-15 20:52:27


Attachments
patch (3.50 KB, patch)
2004-02-20 07:41 UTC, Brian Ryner
Details | Diff
Adding class/struct visibility and -fvisibility command line arg (9.66 KB, patch)
2004-04-06 22:27 UTC, Niall Douglas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Mueller 2003-01-12 10:46:00 UTC
Unfortunately gcc does not support the visibility attribute to be applied to class'es and struct's. 

This should allow to toggle the visibility default for complete classes (including their typeinfo and vtables), 
unless individual methods / variables overwrite visibility. Without such support, the support for visibility
is not very useful to big C++ projects.

Release:
3.2.1 (SuSE Linux)

Environment:
System: Linux matrix 2.4.19-4GB #1 Thu Nov 14 09:55:36 UTC 2002 i686 unknown
Architecture: i686

host: i486-suse-linux-gnu
build: i486-suse-linux-gnu
target: i486-suse-linux-gnu
configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux

How-To-Repeat:

Given this test application: 

=== Cut ===
class __attribute__( ( visibility ( "hidden" ) ) )  MyClass {
public:
  MyClass();

  int classmember;

};

MyClass::MyClass() {}

int main() {
  MyClass f;
  return 0;
}
=== Cut ===

and compiling it with a compiler with visibility hidden support (gcc 3.3-devel i.e.): 

# g++ --shared -o libtest.so test.cc
test.cc:7: warning: `visibility' attribute does not apply to types
# nm -B -C -g libtest.so  | grep MyC
000006ea T MyClass::MyClass[in-charge]()
000006e4 T MyClass::MyClass[not-in-charge]()

shows that the symbols are still exported.
Comment 1 Dirk Mueller 2003-01-12 10:46:00 UTC
Fix:

Please make it apply to types. It should simply copy the definition to all declared functions
and variables, unless they have a custom attribute.
Comment 2 Andrew Pinski 2003-05-26 22:18:58 UTC
Can you try this on a more recent version of gcc, 3.3?
Comment 3 Dirk Mueller 2003-05-26 22:52:09 UTC
its not implemented in 3.3. or current 3.4 
Comment 4 Andrew Pinski 2004-01-29 03:25:01 UTC
*** Bug 13905 has been marked as a duplicate of this bug. ***
Comment 5 Giovanni Bajo 2004-01-30 02:52:37 UTC
*** Bug 13905 has been marked as a duplicate of this bug. ***
Comment 6 Niall Douglas 2004-01-30 20:51:07 UTC
From bug #13905 which I posted I'd like to add the following:

This idea of Dirk's is good but I think he's coming at it the wrong way. Instead 
of labouriously specifying things as hidden individually and hoping to not 
forget any, the *default* should be hidden and you specify things as exported 
individually - here if you forget you get a link error.

Not uncoincidentally, I'm wishing to leverage the same semantics as Windows so 
that the macros commonly used on cross-platform applications merely need to be 
redefined from __declspec(dllexport) to __attribute__ ((visibility("export")) 
and no further code changes are required.

To allow this to happen, GCC would need an extra command line option to set the 
default visibility of all symbols:

-fvisibility=external
-fvisibility=default
-fvisibility=protected
-fvisibility=hidden
-fvisibility=internal

These are chosen for compatibility with Intel's C++ compiler which already 
offers the ability to mark all symbols as default non-exported in ELF output.

Why this approach is better than Dirk's: much cleaner ELF images output. Faster 
dynamic linking times as less symbols are exported. Much more scope for GCC to 
optimise object files as it now knows what RTTI info it can discard as well as 
improved COMDAT folding etc.

I in particular suffer from this as GCC generates binaries nearly twice as big 
than MSVC for identical code :( (I think it's the RTTI info for all the 
templates plus not being able to COMDAT fold most of the symbols)

References: http://people.redhat.com/drepper/dsohowto.pdf

Cheers,
Niall
Comment 7 Dirk Mueller 2004-02-01 15:52:36 UTC
Niall, it seems you didn't understand the purpose of the bugreport. The major 
problem right now is that you cannot change the visibility for all members 
of a class with one statement from default.  
 
Wether that is "default == hidden" and  "overwrite == visible" or  
"default == visible" and "overwrite == hidden" doesn't matter, since both 
variants need the very same level of support in the compiler, which  
currently does not exist.  
 
Of course our long term plan is it to be able to default to 
visibility==hidden, but right now thats not possible because of a missing 
feature which this wishlist item requests.  
 
I don't actually want to argue with you which default visibility is right 
or wrong. If you want to have that changed, then please open a separate 
bugreport, because it is not the topic of this one :) 
 
 
Comment 8 Niall Douglas 2004-02-01 17:29:15 UTC
(In reply to comment #7)
> Niall, it seems you didn't understand the purpose of the bugreport. The major 
> problem right now is that you cannot change the visibility for all members 
> of a class with one statement from default.

No I absolutely agree with that.

> Wether that is "default == hidden" and  "overwrite == visible" or  
> "default == visible" and "overwrite == hidden" doesn't matter, since both 
> variants need the very same level of support in the compiler, which  
> currently does not exist.

Precisely my point.

> Of course our long term plan is it to be able to default to 
> visibility==hidden, but right now thats not possible because of a missing 
> feature which this wishlist item requests.

What I was trying to bring was the need for maintaining a compatible syntax with 
MSVC eg; making it "class Foo __attribute__ (("hidden"))" would banjax the tens 
of millions of lines of code which could be converted to use your feature by 
adjusting some macro definitions. Now you seem to know this because of how you 
framed your example, but I have noticed an alarming negativity in this list 
about interoperability features with MSVC just because it's a Microsoft product.

> I don't actually want to argue with you which default visibility is right 
> or wrong. If you want to have that changed, then please open a separate 
> bugreport, because it is not the topic of this one :) 

My original bug report was #13905 which I was told was too similar to yours and 
they closed it (many times). I did point out on that bug that what I proposed 
slightly exceeded what you did, but they told me go post an outline of the 
differences to this bug report, which I did.

My apologies if this didn't come across as I intended it. BTW I feel that 
default visibility is the right of each user to choose, I feel tools are there 
to create choice and flexibility and thus both avenues should be available. Free 
software is about being better than proprietary and a large part of that is 
being interoperable with him when he is trying to wreck us with dirty tactics!

Cheers,
Niall
Comment 9 Brian Ryner 2004-02-20 07:41:29 UTC
Created attachment 5775 [details]
patch

I posted this patch to the gcc-patches list earlier today (something seems to
be wrong with the list or the list archives though, it's not showing up there).



gcc/
2004-02-18  Brian Ryner  <bryner@brianryner.com>
	PR c++/9283
	* c-common.c (parse_visibility): Split out visibility string parsing
	into its own function.
	(handle_visibility_attribute): Use it.
	* c-common.h: Declare.

gcc/cp/
2004-02-18  Brian Ryner  <bryner@brianryner.com>
	PR c++/9283
	* class.c (build_vtable): Apply class visibility to vtable.
	(check_field_decls): Apply class visibility to static data members.
	(check_methods): Apply class visibility to methods.
	(finish_struct): Handle visibility attribute on a class prior to
	calling decl_attributes.
	(pushclass): Initialize visibility and visibility_overrides.
	(add_visibility_override): New function to add a decl to the list
	of members that explicitly set visibility.
	(current_class_visibility): Accessor for current class's visibility.
	* cp-tree.h (add_visibility_override): Declare.
	(current_class_visibility): Declare.
	* decl2.c (cplus_decl_attributes): Call add_visibility_override
	for members that have a visibility attribute.
	* rtti.c (get_tinfo_decl): Apply class visibility to typeinfo.
	(tinfo_base_init): Apply class visibility to typeinfo.
Comment 10 Giovanni Bajo 2004-02-20 16:22:06 UTC
The (new) posting is here:
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01833.html

Comment 11 Niall Douglas 2004-02-20 19:33:40 UTC
Can you change this line in your patch:

+   current_class_stack[current_class_depth].visibility = VISIBILITY_DEFAULT;

Make this:

+   current_class_stack[current_class_depth].visibility = 
compilation_unit_visibility;

... and then declare where the command line args are parsed a:

static enum symbol_visibility compilation_unit_visibility = VISIBILITY_DEFAULT;

This makes it easier to add the -fvisibility=X command line switches to GCC 
later on.

Cheers,
Niall
Comment 12 Niall Douglas 2004-04-04 17:40:06 UTC
(In reply to comment #11)
> This makes it easier to add the -fvisibility=X command line switches to GCC 
> later on.

This is to let you all know that I have taken Brian Ryner's patch and used it to 
implement a further patch against GCC v3.4 CVS adding the -fvisibility 
functionality I previously described with appropriate documentation patching 
too. I am currently testing my patch though I should be finished by tonight.

Using my new patch, I have reduced the dynamic symbol table of my library, 
TnFOX, from 16342 symbols down to 9590 with no special measures and no problems. 
Furthermore the binary size has dropped as my patch marks many more symbols as 
local and thus their access code can be optimised.

I am just about to embark on compiling the Boost.Python based python bindings 
for TnFOX. They previously had >250,000 symbols and took six minutes for 
anything linked against them to load - even after applying a filtering version 
script, I could only get it down to ~76,000 which at least linked in less than 
ten seconds. With my new GCC, I am expecting to reduce this to less than 1000 
symbols with a substantial reduction of binary size (it's currently 130Mb) as 
lots of RTTI can be elided.

I'll get back to you when I have built the bindings (it takes nine hours).

Cheers,
Niall
Comment 13 Niall Douglas 2004-04-06 22:27:42 UTC
Created attachment 6046 [details]
Adding class/struct visibility and -fvisibility command line arg
Comment 14 Niall Douglas 2004-04-06 22:34:21 UTC
Please find attached a patch against GCC CVS 20040324 adding the -fvisibility 
command line arg, documentation for the same, class/struct visibility setting 
and improved symbol locality setting which gives better code quality.

I have tested this against the regression suite and the test results were 
identical to an unpatched version.

I have also compiled my library and Boost.Python based python bindings with 
excellent success. My BPL bindings were ~21Mb smaller and load in seconds rather 
than minutes. The exported symbol table dropped from >200,000 symbols to only 
~19,000 with doing nothing other than using -fvisibility=hidden and 
__attribute__ ((visibility("default"))) wherever __declspec(dllexport) was being 
used on MSVC. I am very happy with the results.

Cheers,
Niall
Comment 15 Markus Gyger 2004-04-07 07:03:30 UTC
> Adding class/struct visibility and -fvisibility command line arg

Note also the corresponding established command line option -xldscope of Sun's
compilers, mentioned in Bug 14489.
Comment 16 Niall Douglas 2004-04-07 22:17:00 UTC
(In reply to comment #15)
> > Adding class/struct visibility and -fvisibility command line arg
> 
> Note also the corresponding established command line option -xldscope of Sun's
> compilers, mentioned in Bug 14489.

I chose -fvisibility because that's what Intel's C++ compiler for Linux uses. 
Never used a Sun box in anger, so I'm not very familiar with that platform.

Cheers,
Niall
Comment 17 Brian Ryner 2004-04-18 02:25:31 UTC
I posted a new patch here based on earlier review comments:

http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00240.html

I like the idea of moving forward on -fvisibility as well, but we need a way to
address the fact that current DSO header files on unix don't normally specify
default visibility.  Intel's compiler has additional options, such as:

-fvisibility-default=<file>
              Space separated symbols listed in the <file> argument will get
              visibility set to default

This type of file could be generated by running nm over the shared libraries you
plan to link against.  Unfortunately I haven't been able to figure out how to
get the symbol name for a decl (exactly as it would be output in the assembly),
to compare against a list of symbols generated with nm.

Niall, I assume you just changed the relevant system headers to specify default
visibility?  I think we'd be causing a lot of headaches if we tried to force all
library maintainers to do this.
Comment 18 Niall Douglas 2004-04-18 03:20:56 UTC
(In reply to comment #17)
> I posted a new patch here based on earlier review comments:
> 
> http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00240.html

I'll see if your revisions can offer any suggestions to what I did to your 
patch. However, I substantially changed how symbol visibility is applied which I 
think does depend on the class stack eg; if a class is hidden but contains a 
class which is default but that class contains another class which is hidden.

I also changed how visibility is taken into account when making a symbol local 
which lets the compiler and optimiser work better. Basically anything which 
doesn't have default visibility is made local. I also made all inlineable code 
always the -fvisibility setting no matter what and a few other things.

> I like the idea of moving forward on -fvisibility as well, but we need a way 
to
> address the fact that current DSO header files on unix don't normally specify
> default visibility. 

I don't believe this can be done past what the GNU ld version scripts already 
do. DSO interface specification is something which requires a human to manually 
graft through the interface definitions and do the needful. Things like glibc 
show what I mean and anyone from a Windows background will also know what I 
mean.

This isn't as bad as it sounds. Anything which can run on Windows already has 
the macro support code. If you get this feature into GCC now, code will start 
moving in the right way anyway. It's simply the right way to go, especially for 
template heavy C++. I wouldn't sweat trying to make the perfect solution right 
here and now, if we get the feature out there the feedback will guide us the 
right way.

> Niall, I assume you just changed the relevant system headers to specify 
default
> visibility?  I think we'd be causing a lot of headaches if we tried to force 
all
> library maintainers to do this.

No, I modified the function which creates a new decl to simply set the 
visibility to whatever the command line arg specified. This causes all decls to 
be that visibility by default which is just what we want. There are no knock-on 
effects of this patch on any other part of GCC, I took special care to ensure 
this. The patch should just drop in will no ill side effects.

I put together a web page explaining why this patch is such a good idea at http:
//www.nedprod.com/programs/gccvisibility.html. However Ulrich Drepper got there 
well before me at http://www.nedprod.com/programs/dsohowto.pdf.

Cheers,
Niall
Comment 19 Brian Ryner 2004-04-18 04:19:35 UTC
I had filed bug 15000 regarding -fvisibility in an effort not to morph this bug
into that.  I'll respond to this comment over there.
Comment 20 Niall Douglas 2004-05-17 18:32:54 UTC
As it's been causing some confusion, bug 15000 wholly includes the feature(s)
provided by this bug report. Therefore you should consult both reports.

Niall
Comment 21 GCC Commits 2004-07-25 22:52:30 UTC
Subject: Bug 9283

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	giovannibajo@gcc.gnu.org	2004-07-25 22:52:22

Modified files:
	gcc            : ChangeLog c-common.c c-decl.c c-opts.c 
	                 c-pragma.c c-pragma.h c.opt common.opt flags.h 
	                 opts.c tree.c tree.h varasm.c 
	gcc/cp         : ChangeLog class.c cp-tree.h decl.c method.c 
	                 optimize.c rtti.c 
	gcc/doc        : invoke.texi 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext/visibility: 
	                                     fvisibility-inlines-hidden.C 
	                                     fvisibility-override1.C 
	                                     fvisibility-override2.C 
	                                     fvisibility.C memfuncts.C 
	                                     noPLT.C pragma-override1.C 
	                                     pragma-override2.C pragma.C 
	                                     staticmemfuncts.C virtual.C 
	                                     visibility-1.C 
	                                     visibility-2.C 
	                                     visibility-3.C 
	                                     visibility-4.C 
	                                     visibility-5.C 
	                                     visibility-6.C 
	                                     visibility-7.C 
	gcc/testsuite/gcc.dg: visibility-9.c visibility-a.c 
Removed files:
	gcc/testsuite/g++.dg/ext: visibility-1.C visibility-2.C 
	                          visibility-3.C visibility-4.C 
	                          visibility-5.C visibility-6.C 
	                          visibility-7.C 

Log message:
	PR c++/9283
	PR c++/15000
	* c-common.c (c_common_attribute_table): Allow
	handle_visibility_attribute to be called for types.
	(handle_visibility_attribute) When given a type, set the visibility
	bits on the TYPE_NAME.  When given a decl, don't set no_add_attrs
	so that we can check later whether the attribute was present. Added
	warning if attribute applied to non class type.
	* c-decl.c (diagnose_mismatched_decls): Updated rules for merging
	decls and checking that they are consistent.
	* common.opt: Added -fvisibility.
	* c.opt, c-opts.c: Added -fvisibility-inlines-hidden.
	* c-pragma.h, c-pragma.c: Added handle_pragma_visibility().
	* flags.h, tree.h: Added assorted support defines for overall patch
	* opts.c: Added parsing support for -fvisibility.
	* tree.c (build_decl): Set visibility for all decls to be whatever
	is in force at that time.
	* varasm.c (default_binds_local_p_1): Reworked logic determining
	when to make a symbol locally bound.
	* doc/invoke.texi: Added documentation for -fvisibility and
	-fvisibility-inlines-hidden.
	
	PR c++/15000
	PR c++/9283
	* class.c (check_field_decls): Apply hidden visibility if
	-fvisibility-inlines-hidden and inlined unless otherwise specified
	(build_vtable): Set vtable visibility to class visibility.
	(check_field_decls): Default static member visibility to class
	visibility.
	(check_methods): Default method visibility to class visibility.
	* cp-tree.h: Added CLASSTYPE_VISIBILITY and
	CLASSTYPE_VISIBILITY_SPECIFIED macro.
	* decl.c (duplicate_decls): New logic for merging definition decls
	with declaration decls. Added ignore & warning when non default
	applied to global operator new or delete.
	* method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED
	wherever VISIBILITY was changed
	* rtti.c (get_tinfo_decl): Set typeinfo visibility to class
	visibility.
	(tinfo_base_init): Set typeinfo name visibility to class visibility.
	
	PR c++/9283
	PR c++/15000
	* gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests.
	* g++.dg/ext/visibility/: New directory.
	* g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C
	g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C,
	g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C,
	g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/.
	* g++.dg/ext/visibility/fvisibility.C,
	g++.dg/ext/visibility/fvisibility-inlines-hidden.C,
	g++.dg/ext/visibility/fvisibility-override1.C
	g++.dg/ext/visibility/fvisibility-override2.C
	g++.dg/ext/visibility/memfuncts.C
	g++.dg/ext/visibility/noPLT.C
	g++.dg/ext/visibility/pragma.C
	g++.dg/ext/visibility/pragma-override1.C
	g++.dg/ext/visibility/pragma-override2.C
	g++.dg/ext/visibility/staticmemfuncts.C
	g++.dg/ext/visibility/virtual.C: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4685&r2=2.4686
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.541&r2=1.542
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.545&r2=1.546
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&r1=1.122&r2=1.123
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.c.diff?cvsroot=gcc&r1=1.73&r2=1.74
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.h.diff?cvsroot=gcc&r1=1.40&r2=1.41
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c.opt.diff?cvsroot=gcc&r1=1.30&r2=1.31
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/common.opt.diff?cvsroot=gcc&r1=1.41&r2=1.42
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flags.h.diff?cvsroot=gcc&r1=1.145&r2=1.146
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/opts.c.diff?cvsroot=gcc&r1=1.74&r2=1.75
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.404&r2=1.405
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.572&r2=1.573
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&r1=1.435&r2=1.436
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4244&r2=1.4245
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.644&r2=1.645
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1023&r2=1.1024
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1262&r2=1.1263
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.303&r2=1.304
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/optimize.c.diff?cvsroot=gcc&r1=1.111&r2=1.112
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&r1=1.190&r2=1.191
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.491&r2=1.492
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4051&r2=1.4052
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-1.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-2.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-3.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-4.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-5.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-6.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-7.C.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/noPLT.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/virtual.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-9.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-a.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 22 Andrew Pinski 2004-07-25 23:36:59 UTC
Fixed in 3.5.0.
Comment 23 GCC Commits 2004-08-17 03:06:39 UTC
Subject: Bug 9283

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	csl-arm-branch
Changes by:	mmitchel@gcc.gnu.org	2004-08-17 03:06:33

Modified files:
	gcc            : ChangeLog.csl-arm c-common.c c-decl.c c-opts.c 
	                 c-pragma.c c-pragma.h c.opt common.opt flags.h 
	                 opts.c tree.c tree.h varasm.c 
	gcc/cp         : class.c cp-tree.h decl.c method.c optimize.c 
	                 rtti.c 
	gcc/doc        : invoke.texi 
Added files:
	gcc/testsuite/g++.dg/ext/visibility: 
	                                     fvisibility-inlines-hidden.C 
	                                     fvisibility-override1.C 
	                                     fvisibility-override2.C 
	                                     fvisibility.C memfuncts.C 
	                                     noPLT.C pragma-override1.C 
	                                     pragma-override2.C pragma.C 
	                                     staticmemfuncts.C virtual.C 
	                                     visibility-1.C 
	                                     visibility-2.C 
	                                     visibility-3.C 
	                                     visibility-4.C 
	                                     visibility-5.C 
	                                     visibility-6.C 
	                                     visibility-7.C 
	gcc/testsuite/gcc.dg: visibility-9.c visibility-a.c 
Removed files:
	gcc/testsuite/g++.dg/ext: visibility-1.C visibility-2.C 
	                          visibility-3.C visibility-4.C 
	                          visibility-5.C visibility-6.C 
	                          visibility-7.C 

Log message:
	Backport:
	2004-07-26  Niall Douglas  <s_fsfeurope2@nedprod.com>
	Brian Ryner  <bryner@brianryner.com>
	PR c++/9283
	PR c++/15000
	* c-common.c (c_common_attribute_table): Allow
	handle_visibility_attribute to be called for types.
	(handle_visibility_attribute) When given a type, set the visibility
	bits on the TYPE_NAME.  When given a decl, don't set no_add_attrs
	so that we can check later whether the attribute was present. Added
	warning if attribute applied to non class type.
	* c-decl.c (diagnose_mismatched_decls): Updated rules for merging
	decls and checking that they are consistent.
	* common.opt: Added -fvisibility.
	* c.opt, c-opts.c: Added -fvisibility-inlines-hidden.
	* c-pragma.h, c-pragma.c: Added handle_pragma_visibility().
	* flags.h, tree.h: Added assorted support defines for overall patch
	* opts.c: Added parsing support for -fvisibility.
	* tree.c (build_decl): Set visibility for all decls to be whatever
	is in force at that time.
	* varasm.c (default_binds_local_p_1): Reworked logic determining
	when to make a symbol locally bound.
	* doc/invoke.texi: Added documentation for -fvisibility and
	-fvisibility-inlines-hidden.
	
	2004-07-26  Niall Douglas  <s_fsfeurope2@nedprod.com>
	Brian Ryner  <bryner@brianryner.com>
	PR c++/15000
	PR c++/9283
	* class.c (check_field_decls): Apply hidden visibility if
	-fvisibility-inlines-hidden and inlined unless otherwise specified
	(build_vtable): Set vtable visibility to class visibility.
	(check_field_decls): Default static member visibility to class
	visibility.
	(check_methods): Default method visibility to class visibility.
	* cp-tree.h: Added CLASSTYPE_VISIBILITY and
	CLASSTYPE_VISIBILITY_SPECIFIED macro.
	* decl.c (duplicate_decls): New logic for merging definition decls
	with declaration decls. Added ignore & warning when non default
	applied to global operator new or delete.
	* method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED
	wherever VISIBILITY was changed
	* rtti.c (get_tinfo_decl): Set typeinfo visibility to class
	visibility.
	(tinfo_base_init): Set typeinfo name visibility to class visibility.
	
	2004-07-26  Niall Douglas  <s_fsfeurope2@nedprod.com>
	Brian Ryner  <bryner@brianryner.com>
	PR c++/9283
	PR c++/15000
	* gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests.
	* g++.dg/ext/visibility/: New directory.
	* g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C
	g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C,
	g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C,
	g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/.
	* g++.dg/ext/visibility/fvisibility.C,
	g++.dg/ext/visibility/fvisibility-inlines-hidden.C,
	g++.dg/ext/visibility/fvisibility-override1.C
	g++.dg/ext/visibility/fvisibility-override2.C
	g++.dg/ext/visibility/memfuncts.C
	g++.dg/ext/visibility/noPLT.C
	g++.dg/ext/visibility/pragma.C
	g++.dg/ext/visibility/pragma-override1.C
	g++.dg/ext/visibility/pragma-override2.C
	g++.dg/ext/visibility/staticmemfuncts.C
	g++.dg/ext/visibility/virtual.C: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.csl-arm.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.4&r2=1.1.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.465.4.5&r2=1.465.4.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.455.4.4&r2=1.455.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.91.4.2&r2=1.91.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.64.4.3&r2=1.64.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.h.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.36.6.1&r2=1.36.6.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c.opt.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.17.6.1&r2=1.17.6.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/common.opt.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.20.4.3&r2=1.20.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flags.h.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.126.4.3&r2=1.126.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/opts.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.44.4.5&r2=1.44.4.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.336.4.3&r2=1.336.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.450.2.3&r2=1.450.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.395.2.4&r2=1.395.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.581.2.5&r2=1.581.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.930.2.5&r2=1.930.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1150.2.8&r2=1.1150.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.270.2.5&r2=1.270.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/optimize.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.101.4.3&r2=1.101.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.175.4.3&r2=1.175.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.356.2.10&r2=1.356.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-1.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-2.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-3.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-4.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-5.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-6.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-7.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/noPLT.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/virtual.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-9.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-a.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=NONE&r2=1.1.8.1

Comment 24 GCC Commits 2004-09-01 16:21:10 UTC
Subject: Bug 9283

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-rhl-branch
Changes by:	jakub@gcc.gnu.org	2004-09-01 16:21:00

Modified files:
	gcc            : ChangeLog varasm.c tree.h tree.c flags.h 
	                 c-opts.c c-pragma.h c-common.c c-decl.c c.opt 
	                 common.opt opts.c c-pragma.c 
	gcc/cp         : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/cp         : class.c optimize.c method.c decl.c rtti.c 
	                 cp-tree.h 
	gcc/doc        : invoke.texi 
Added files:
	gcc/testsuite/gcc.dg: visibility-9.c visibility-a.c 
	gcc/testsuite/g++.dg/ext/visibility: visibility-5.C virtual.C 
	                                     visibility-1.C 
	                                     visibility-7.C 
	                                     visibility-2.C 
	                                     staticmemfuncts.C 
	                                     pragma-override1.C 
	                                     fvisibility-override1.C 
	                                     fvisibility.C noPLT.C 
	                                     fvisibility-inlines-hidden.C 
	                                     pragma-override2.C 
	                                     visibility-6.C 
	                                     visibility-4.C pragma.C 
	                                     visibility-3.C memfuncts.C 
	                                     fvisibility-override2.C 
Removed files:
	gcc/testsuite/g++.dg/ext: visibility-5.C visibility-1.C 
	                          visibility-7.C visibility-2.C 
	                          visibility-6.C visibility-4.C 
	                          visibility-3.C 

Log message:
	2004-07-26  Niall Douglas  <s_fsfeurope2@nedprod.com>
	Brian Ryner  <bryner@brianryner.com>
	
	PR c++/9283
	PR c++/15000
	* c-common.c (c_common_attribute_table): Allow
	handle_visibility_attribute to be called for types.
	(handle_visibility_attribute) When given a type, set the visibility
	bits on the TYPE_NAME.  When given a decl, don't set no_add_attrs
	so that we can check later whether the attribute was present. Added
	warning if attribute applied to non class type.
	* c-decl.c (diagnose_mismatched_decls): Updated rules for merging
	decls and checking that they are consistent.
	* common.opt: Added -fvisibility.
	* c.opt, c-opts.c: Added -fvisibility-inlines-hidden.
	* c-pragma.h, c-pragma.c: Added handle_pragma_visibility().
	* flags.h, tree.h: Added assorted support defines for overall patch
	* opts.c: Added parsing support for -fvisibility.
	* tree.c (build_decl): Set visibility for all decls to be whatever
	is in force at that time.
	* varasm.c (default_binds_local_p_1): Reworked logic determining
	when to make a symbol locally bound.
	* doc/invoke.texi: Added documentation for -fvisibility and
	-fvisibility-inlines-hidden.
	cp/
	PR c++/15000
	PR c++/9283
	* class.c (check_field_decls): Apply hidden visibility if
	-fvisibility-inlines-hidden and inlined unless otherwise specified
	(build_vtable): Set vtable visibility to class visibility.
	(check_field_decls): Default static member visibility to class
	visibility.
	(check_methods): Default method visibility to class visibility.
	* cp-tree.h: Added CLASSTYPE_VISIBILITY and
	CLASSTYPE_VISIBILITY_SPECIFIED macro.
	* decl.c (duplicate_decls): New logic for merging definition decls
	with declaration decls. Added ignore & warning when non default
	applied to global operator new or delete.
	* method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED
	wherever VISIBILITY was changed
	* rtti.c (get_tinfo_decl): Set typeinfo visibility to class
	visibility.
	(tinfo_base_init): Set typeinfo name visibility to class visibility.
	testsuite/
	PR c++/9283
	PR c++/15000
	* gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests.
	* g++.dg/ext/visibility/: New directory.
	* g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C
	g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C,
	g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C,
	g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/.
	* g++.dg/ext/visibility/fvisibility.C,
	g++.dg/ext/visibility/fvisibility-inlines-hidden.C,
	g++.dg/ext/visibility/fvisibility-override1.C
	g++.dg/ext/visibility/fvisibility-override2.C
	g++.dg/ext/visibility/memfuncts.C
	g++.dg/ext/visibility/noPLT.C
	g++.dg/ext/visibility/pragma.C
	g++.dg/ext/visibility/pragma-override1.C
	g++.dg/ext/visibility/pragma-override2.C
	g++.dg/ext/visibility/staticmemfuncts.C
	g++.dg/ext/visibility/virtual.C: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=2.2326.2.399.2.34&r2=2.2326.2.399.2.35
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.405.2.3.2.1&r2=1.405.2.3.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.458.2.4.2.2&r2=1.458.2.4.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.342.2.3.2.2&r2=1.342.2.3.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flags.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.127.4.1&r2=1.127.4.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.96.4.7&r2=1.96.4.7.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.36.12.2&r2=1.36.12.2.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.476.4.6.2.2&r2=1.476.4.6.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.470.4.13.2.3&r2=1.470.4.13.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c.opt.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.17.12.2&r2=1.17.12.2.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/common.opt.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.24.4.1&r2=1.24.4.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/opts.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.51.4.3&r2=1.51.4.3.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pragma.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.66.2.1.2.1&r2=1.66.2.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.3892.2.99.2.8&r2=1.3892.2.99.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.3389.2.170.2.17&r2=1.3389.2.170.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.595.4.7.2.2&r2=1.595.4.7.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/optimize.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.103.4.2&r2=1.103.4.2.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.275.4.3.2.1&r2=1.275.4.3.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1174.2.19.2.4&r2=1.1174.2.19.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.176.4.3.2.1&r2=1.176.4.3.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.946.4.11.2.3&r2=1.946.4.11.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.390.2.24.2.5&r2=1.390.2.24.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-9.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/visibility-a.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility-3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/virtual.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/noPLT.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/pragma.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.2.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.12.1

Comment 25 Jackie Rosen 2014-02-16 13:13:12 UTC Comment hidden (spam)