This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34331] New: __attribute((externally_visible))) should work on class declaration
- From: "bruce_pedersen at altera dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2007 23:56:45 -0000
- Subject: [Bug c++/34331] New: __attribute((externally_visible))) should work on class declaration
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When applied to a class declaration, "__attribute((externally_visible))" should
act as if it were applied to each function or data member in the class -- just
like '__attribute((visibility("protected")))' works in GCC4.2.1. This would
allow using the "-fwhole-program -fvisibility=hidden" optimizations when
creating C++ shared-object files. In particular, one should be able to do:
#define DLLEXPORT __attribute(externally_visible,visibility("protected")))
#define DLLIMPORT __attribute(externally_visible,visibility("default")))
class DLLEXPORT FOO {
FOO();
void foo_func();
..etc.
};
In GCC4.2.1, the above code will issue a warning, ignore the
"externally_visible" attribute, and the above class functions will not be
exported (and possibly not even implemented) in the *.so file when
-fwhole-program is used.
The arguments for allowing the "externally_visible" attribute on the class
declaration (as opposed to forcing users to put in on every class member) are
the same as those for allowing the "visibility" attribute there as well: ease
of use and syntax-compatibility with other major compilers.
--
Summary: __attribute((externally_visible))) should work on class
declaration
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bruce_pedersen at altera dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34331