public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24668]  New: visibility attributes on namespaces
@ 2005-11-04  6:54 bkoz at gcc dot gnu dot org
  2005-11-04  6:56 ` [Bug c++/24668] " bkoz at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2005-11-04  6:54 UTC (permalink / raw)
  To: gcc-bugs

In addition to the current ability to put visibility attributes on file and
class scope, the ability to put visibility attributes on namespace scope is
desired.

The syntax is straight forward extension of existing visibility attribute
options.

namespace test __attribute__ ((visibility("hidden")))
{
  struct c1 
  {
    static int s;
    virtual void foo() { }
  };

  int c1::s;
}

Is an example.

What does this mean? For definitions within namespace scope, set the symbol
visibility to the nearest enclosing namespace attribute. Declarations are
unaffected.

Nested namespaces have the same semantics as nested classes. Ie, enclosing
scope. Therefore:

#define VIS_default __attribute__ ((visibility("default")))
#define VIS_hidden __attribute__ ((visibility("hidden")))

  struct c1 
  {
    static int s;
    virtual void foo() { }

    struct c2 
    {
      static int s;
      virtual void foo() { }
    } VIS_default;
  } VIS_hidden;

namespace test1 VIS_hidden
{
  struct c1 
  {
    static int s;
    virtual void foo() { }
  };

  int c1::s;

  namespace test2 VIS_default
  {
    struct c2 
    {
      static int s;
      virtual void foo() { }
    };

    int c2::s;
  }
}

In the above, struct c2 and test1::test2::c2 both have default visibility,
whereas c1 and test1::c1 both have hidden visibility.

Interactions between file, namespace, and class scope are handled sanely. Ie,
the same deal, nearest enclosing scope.

ie:

#pragma GCC visibility push(hidden)

namespace test1 VIS_default
{
  struct c1 
  {
    static int s;
    virtual void foo() { }
  };

  int c1::s;

  struct c2 
  {
    static int s;
    virtual void foo() { }
  } VIS_hidden;

  int c2::s;
}

#pragma GCC visibility pop

In the above, c1 would be default, c2 would be hidden.


-- 
           Summary: visibility attributes on namespaces
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/24668] visibility attributes on namespaces
  2005-11-04  6:54 [Bug c++/24668] New: visibility attributes on namespaces bkoz at gcc dot gnu dot org
@ 2005-11-04  6:56 ` bkoz at gcc dot gnu dot org
  2005-11-04 11:06 ` pluto at agmk dot net
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2005-11-04  6:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

bkoz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/24668] visibility attributes on namespaces
  2005-11-04  6:54 [Bug c++/24668] New: visibility attributes on namespaces bkoz at gcc dot gnu dot org
  2005-11-04  6:56 ` [Bug c++/24668] " bkoz at gcc dot gnu dot org
@ 2005-11-04 11:06 ` pluto at agmk dot net
  2005-11-04 13:05 ` pinskia at gcc dot gnu dot org
  2005-11-04 17:06 ` bkoz at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pluto at agmk dot net @ 2005-11-04 11:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pluto at agmk dot net  2005-11-04 11:06 -------
what about PR21764 (linked in PR19664)?
duplication?


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/24668] visibility attributes on namespaces
  2005-11-04  6:54 [Bug c++/24668] New: visibility attributes on namespaces bkoz at gcc dot gnu dot org
  2005-11-04  6:56 ` [Bug c++/24668] " bkoz at gcc dot gnu dot org
  2005-11-04 11:06 ` pluto at agmk dot net
@ 2005-11-04 13:05 ` pinskia at gcc dot gnu dot org
  2005-11-04 17:06 ` bkoz at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-04 13:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-11-04 13:05 -------
This is a dup of bug 21764 as far as I can see.

*** This bug has been marked as a duplicate of 21764 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/24668] visibility attributes on namespaces
  2005-11-04  6:54 [Bug c++/24668] New: visibility attributes on namespaces bkoz at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-11-04 13:05 ` pinskia at gcc dot gnu dot org
@ 2005-11-04 17:06 ` bkoz at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2005-11-04 17:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bkoz at gcc dot gnu dot org  2005-11-04 17:06 -------

Agh. Sorry, I had not realized that I'd filed this six months ago.


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-11-04 17:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-04  6:54 [Bug c++/24668] New: visibility attributes on namespaces bkoz at gcc dot gnu dot org
2005-11-04  6:56 ` [Bug c++/24668] " bkoz at gcc dot gnu dot org
2005-11-04 11:06 ` pluto at agmk dot net
2005-11-04 13:05 ` pinskia at gcc dot gnu dot org
2005-11-04 17:06 ` bkoz at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).