Bug 9332 - __attribute__ ((visibility("hidden")) should apply to classes
Summary: __attribute__ ((visibility("hidden")) should apply to classes
Status: RESOLVED DUPLICATE of bug 9283
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.3
: P3 enhancement
Target Milestone: ---
Assignee: Christian Ehrhardt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-15 11:06 UTC by Dirk Mueller
Modified: 2003-06-12 00:03 UTC (History)
3 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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Mueller 2003-01-15 11:06:01 UTC
gcc should allow to apply the visibility attribute to classes and other complex
types. It should behave as if the visibility attribute was specified on each member
function and variable, unless one of them "overwrites" the setting by specifying a custom
visibility. 

This feature is necessary to easily control the amount of exported symbols in bigger
C/C++ projects.

Release:
3.3

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:

try to compile this example file: 

#include <stdio.h>

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

    static int member;
};

int MyClass::member;

MyClass::MyClass()
{ }

int main()
{
    MyClass f;
    printf( "%d",MyClass::member );
    return 0;
}

#g++ -Wall test.cc
test.cc:9: warning: `visibility' attribute does not apply to types
Comment 1 Dirk Mueller 2003-01-15 11:06:01 UTC
Fix:
  see above.
Comment 2 dmuell 2003-01-22 21:06:20 UTC
From: Dirk Mueller <dmuell@gmx.net>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: middle-end/9332: __attribute__ ((visibility("hidden")) should apply to classes
Date: Wed, 22 Jan 2003 21:06:20 +0100

 On Mit, 15 Jan 2003, gcc-gnats@gcc.gnu.org wrote:
 
 can you please merge this report with c++/9282 ? I've reported it twice 
 because somehow GNATS was broken inbetween. 
 
 Thanks,
 
 
 -- 
 Dirk
Comment 3 Christian Ehrhardt 2003-01-22 23:33:04 UTC
*** This bug has been marked as a duplicate of 9283 ***