public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28409]  New: extern "C" and anonymous namespace
@ 2006-07-17 10:26 jakub at redhat dot com
  2006-07-17 12:09 ` [Bug c++/28409] [4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jakub at redhat dot com @ 2006-07-17 10:26 UTC (permalink / raw)
  To: gcc-bugs

namespace
{
        extern "C" int shouldIbevisible()
        {
                return 101;
        }
}

extern "C" int Iamvisible()
{
        return 101;
}

Is shouldIbevisible supposed to be a visible symbol outside of the current
compilation unit, so that other cu that does say
extern "C" int shouldIbevisible();
int foo () { return shouldIbevisible(); }
would link with it?  If yes, we need to change determine_visibility and
push_namespace_with_attribs to take DECL_EXTERN_C_FUNCTION_P into account.


-- 
           Summary: extern "C" and anonymous namespace
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at redhat dot com


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


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

* [Bug c++/28409] [4.2 Regression] extern "C" and anonymous namespace
  2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
@ 2006-07-17 12:09 ` pinskia at gcc dot gnu dot org
  2006-07-19  0:47 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-17 12:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-07-17 12:09 -------
Here is a self contained testcase which fails at -O1 and above because
shouldIbevisible is not emitted:
namespace
{
        extern "C" int shouldIbevisible()
        {
                return 0;
        }
}

namespace t
{
extern "C" int shouldIbevisible(void);
}

int main(void)
{
        return t::shouldIbevisible();
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |link-failure
   Last reconfirmed|0000-00-00 00:00:00         |2006-07-17 12:09:41
               date|                            |
            Summary|extern "C" and anonymous    |[4.2 Regression] extern "C"
                   |namespace                   |and anonymous namespace
   Target Milestone|---                         |4.2.0


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


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

* [Bug c++/28409] [4.2 Regression] extern "C" and anonymous namespace
  2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
  2006-07-17 12:09 ` [Bug c++/28409] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-07-19  0:47 ` mmitchel at gcc dot gnu dot org
  2006-07-20 15:55 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-07-19  0:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mmitchel at gcc dot gnu dot org  2006-07-19 00:46 -------
Yes, extern "C" should make the function have external linkage in the object
file.  Namespaces have no impact on extern "C" functions, except from the point
of view of lexical scoping.  


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/28409] [4.2 Regression] extern "C" and anonymous namespace
  2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
  2006-07-17 12:09 ` [Bug c++/28409] [4.2 Regression] " pinskia at gcc dot gnu dot org
  2006-07-19  0:47 ` mmitchel at gcc dot gnu dot org
@ 2006-07-20 15:55 ` jason at gcc dot gnu dot org
  2006-07-20 16:03 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-20 15:55 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-07-17 12:09:41         |2006-07-20 15:55:23
               date|                            |


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


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

* [Bug c++/28409] [4.2 Regression] extern "C" and anonymous namespace
  2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
                   ` (2 preceding siblings ...)
  2006-07-20 15:55 ` jason at gcc dot gnu dot org
@ 2006-07-20 16:03 ` jason at gcc dot gnu dot org
  2006-07-20 16:20 ` jason at gcc dot gnu dot org
  2006-08-28 12:31 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-20 16:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2006-07-20 16:03 -------
Subject: Bug 28409

Author: jason
Date: Thu Jul 20 16:02:57 2006
New Revision: 115622

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115622
Log:
        PR c++/28407
        * cp/decl.c (grokvardecl): Set DECL_THIS_STATIC on file-scope
        const variables with implicit internal linkage.
        * cp/tree.c (decl_linkage): Only return lk_external if it's set.

        PR c++/28409
        * cp/decl2.c (constrain_visibility): Ignore the anonymous namespace 
        for extern C decls.
        (VISIBILITY_STATIC): Rename to VISIBILITY_ANON.

        Don't override explicit visibility.
        * cp/decl2.c (constrain_visibility): Remove specified and reason
        parameters.  Don't touch decls that already have explicit visibility.
        (determine_visibility): Do copy DECL_VISIBILITY_SPECIFIED from
        template.
        (determine_visibility_from_class): Reverse sense of
        DECL_VISIBILITY_SPECIFIED test for target-specific visibility rules.
        (constrain_class_visibility): Only complain about member visibility
        if the member type is another class.  Don't change visibility of the
        current class.
        * tree.c (remove_attribute): New fn.
        * tree.h: Declare it.

Added:
    trunk/gcc/testsuite/g++.dg/ext/visibility/template6.C
    trunk/gcc/testsuite/g++.dg/lookup/anon5.C
    trunk/gcc/testsuite/g++.dg/template/anon4.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/tree.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/g++.dg/ext/visibility/warn2.C
    trunk/gcc/testsuite/g++.dg/ext/visibility/warn3.C
    trunk/gcc/tree.c
    trunk/gcc/tree.h


-- 


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


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

* [Bug c++/28409] [4.2 Regression] extern "C" and anonymous namespace
  2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
                   ` (3 preceding siblings ...)
  2006-07-20 16:03 ` jason at gcc dot gnu dot org
@ 2006-07-20 16:20 ` jason at gcc dot gnu dot org
  2006-08-28 12:31 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-07-20 16:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2006-07-20 16:20 -------
fixed


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/28409] [4.2 Regression] extern "C" and anonymous namespace
  2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
                   ` (4 preceding siblings ...)
  2006-07-20 16:20 ` jason at gcc dot gnu dot org
@ 2006-08-28 12:31 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-08-28 12:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2006-08-28 12:31 -------
Subject: Bug 28409

Author: jakub
Date: Mon Aug 28 12:31:26 2006
New Revision: 116507

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116507
Log:
2006-07-20  Jason Merrill  <jason@redhat.com>

        * tree.c (remove_attribute): New fn.

        PR c++/28407
        * decl.c (grokvardecl): Set DECL_THIS_STATIC on file-scope
        const variables with implicit internal linkage.
        * tree.c (decl_linkage): Only return lk_external if it's set.

        PR c++/28409
        * decl2.c (constrain_visibility): Ignore the anonymous namespace 
        for extern "C" decls.
        (VISIBILITY_STATIC): Rename to VISIBILITY_ANON.

        * decl2.c (constrain_visibility): Remove specified and reason 
        parameters.  Don't touch decls that already have explicit visibility.
        (determine_visibility): Do copy DECL_VISIBILITY_SPECIFIED from 
        template.
        (determine_visibility_from_class): Reverse sense of 
        DECL_VISIBILITY_SPECIFIED test for target-specific visibility rules.
        (constrain_class_visibility): Only complain about member visibility
        if the member type is another class.  Don't change visibility of the
        current class.

Added:
   
branches/redhat/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/visibility/template6.C
    branches/redhat/gcc-4_1-branch/gcc/testsuite/g++.dg/lookup/anon5.C
    branches/redhat/gcc-4_1-branch/gcc/testsuite/g++.dg/template/anon4.C
Modified:
    branches/redhat/gcc-4_1-branch/gcc/ChangeLog
    branches/redhat/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/redhat/gcc-4_1-branch/gcc/cp/decl.c
    branches/redhat/gcc-4_1-branch/gcc/cp/decl2.c
    branches/redhat/gcc-4_1-branch/gcc/cp/pt.c
    branches/redhat/gcc-4_1-branch/gcc/cp/tree.c
    branches/redhat/gcc-4_1-branch/gcc/doc/extend.texi
    branches/redhat/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/visibility/warn2.C
    branches/redhat/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/visibility/warn3.C
    branches/redhat/gcc-4_1-branch/gcc/tree.c
    branches/redhat/gcc-4_1-branch/gcc/tree.h


-- 


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


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

end of thread, other threads:[~2006-08-28 12:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-17 10:26 [Bug c++/28409] New: extern "C" and anonymous namespace jakub at redhat dot com
2006-07-17 12:09 ` [Bug c++/28409] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-07-19  0:47 ` mmitchel at gcc dot gnu dot org
2006-07-20 15:55 ` jason at gcc dot gnu dot org
2006-07-20 16:03 ` jason at gcc dot gnu dot org
2006-07-20 16:20 ` jason at gcc dot gnu dot org
2006-08-28 12:31 ` jakub 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).