public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30112]  New: pragma redefine_extname fails when namespaces are involved
@ 2006-12-07 18:45 marc dot glisse at normalesup dot org
  2006-12-12 18:42 ` [Bug c++/30112] " marc dot glisse at normalesup dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: marc dot glisse at normalesup dot org @ 2006-12-07 18:45 UTC (permalink / raw)
  To: gcc-bugs

If I compile the following piece of code with g++ -c, and examine the resulting
object file, it references symbols "myfoo" and "bar", so the second pragma
failed because of the namespace.

extern "C" {
#pragma redefine_extname foo myfoo
    void foo(double);
    namespace A {
#pragma redefine_extname bar mybar
        void bar(double);
    }
}
void f(double x){foo(x);A::bar(x);}

A relevant example is wcsftime when __cplusplus is 199711L.


-- 
           Summary: pragma redefine_extname fails when namespaces are
                    involved
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marc dot glisse at normalesup dot org
  GCC host triplet: i386-pc-solaris2.10


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


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
  2006-12-07 18:45 [Bug c++/30112] New: pragma redefine_extname fails when namespaces are involved marc dot glisse at normalesup dot org
@ 2006-12-12 18:42 ` marc dot glisse at normalesup dot org
  2007-01-08 14:27 ` marc dot glisse at normalesup dot org
  2007-02-22 16:20 ` marc dot glisse at normalesup dot org
  2 siblings, 0 replies; 10+ messages in thread
From: marc dot glisse at normalesup dot org @ 2006-12-12 18:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from marc dot glisse at normalesup dot org  2006-12-12 18:40 -------
In gcc/cp/decl.c, I see:

  if (global_scope_p (current_binding_level))
    asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree);

So if I understand correctly (it is the first time I have a look at the gcc
internals), there is an explicit test that means the renaming function is only
called for the global namespace. Simply removing the test (and so always
executing the next line) seems to solve my problem, but I don't know if it
breaks other things or slows everything down.


-- 


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


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
  2006-12-07 18:45 [Bug c++/30112] New: pragma redefine_extname fails when namespaces are involved marc dot glisse at normalesup dot org
  2006-12-12 18:42 ` [Bug c++/30112] " marc dot glisse at normalesup dot org
@ 2007-01-08 14:27 ` marc dot glisse at normalesup dot org
  2007-02-22 16:20 ` marc dot glisse at normalesup dot org
  2 siblings, 0 replies; 10+ messages in thread
From: marc dot glisse at normalesup dot org @ 2007-01-08 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from marc dot glisse at normalesup dot org  2007-01-08 14:27 -------
Created an attachment (id=12870)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12870&action=view)
patch to call the renaming function in any namespace


-- 


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


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
  2006-12-07 18:45 [Bug c++/30112] New: pragma redefine_extname fails when namespaces are involved marc dot glisse at normalesup dot org
  2006-12-12 18:42 ` [Bug c++/30112] " marc dot glisse at normalesup dot org
  2007-01-08 14:27 ` marc dot glisse at normalesup dot org
@ 2007-02-22 16:20 ` marc dot glisse at normalesup dot org
  2 siblings, 0 replies; 10+ messages in thread
From: marc dot glisse at normalesup dot org @ 2007-02-22 16:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from marc dot glisse at normalesup dot org  2007-02-22 16:20 -------
Actually, the patch is not sufficient. With the patch, it works if the function
is in the global namespace or the pragma is before the declaration (or both),
but not for a function in the std namespace where the pragma is after the
declaration, as is the case for wcsftime in solaris iso/wchar_iso.h.

The little I understand: it seems that in c-pragma.c, for some reason,
identifier_global_value(oldname) returns 0 in this case, so the renaming is not
done.


-- 


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


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
       [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-07-22 20:01 ` jason at gcc dot gnu.org
@ 2011-07-22 20:07 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-22 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-22 20:07:04 UTC ---
Fixed for 4.7.


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
       [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-07-21 15:50 ` paolo.carlini at oracle dot com
@ 2011-07-22 20:01 ` jason at gcc dot gnu.org
  2011-07-22 20:07 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-22 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-22 19:59:51 UTC ---
Author: jason
Date: Fri Jul 22 19:59:49 2011
New Revision: 176650

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176650
Log:
    PR c++/30112
gcc/c-family/
    * c-common.h: Declare c_linkage_bindings.
    * c-pragma.c (handle_pragma_redefine_extname): Use it.
gcc/
    * c-decl.c (c_linkage_bindings): Define.
gcc/cp/
    * decl.c (cp_finish_decl): Apply pragma redefine_extname in
    other namespaces as well.
    * name-lookup.c (c_linkage_bindings): Define.
    (lookup_extern_c_fun_in_all_ns): Rename from
    lookup_extern_c_fun_binding_in_all_ns.  Return tree.
    (pushdecl_maybe_friend_1): Adjust.  Copy DECL_ASSEMBLER_NAME.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-family/c-pragma.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/other/pragma-re-1.C


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
       [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-07-21 15:43 ` jason at gcc dot gnu.org
@ 2011-07-21 15:50 ` paolo.carlini at oracle dot com
  2011-07-22 20:01 ` jason at gcc dot gnu.org
  2011-07-22 20:07 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-21 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-21 15:49:16 UTC ---
Agreed (indeed, I saw both in Bugzilla but never figured out which one you
preferred ;)


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
       [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
  2011-07-21 12:12 ` paolo.carlini at oracle dot com
  2011-07-21 15:08 ` jason at gcc dot gnu.org
@ 2011-07-21 15:43 ` jason at gcc dot gnu.org
  2011-07-21 15:50 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-21 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jason at redhat dot com     |

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-21 15:41:52 UTC ---
Incidentally, when adding me to the CC list of a PR, please use
jason@gcc.gnu.org rather than jason@redhat.com.


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
       [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
  2011-07-21 12:12 ` paolo.carlini at oracle dot com
@ 2011-07-21 15:08 ` jason at gcc dot gnu.org
  2011-07-21 15:43 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-21 15:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.07.21 15:06:46
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug c++/30112] pragma redefine_extname fails when namespaces are involved
       [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
@ 2011-07-21 12:12 ` paolo.carlini at oracle dot com
  2011-07-21 15:08 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-21 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-21 12:11:37 UTC ---
Jason, I gather this is blocking libstdc++/1773, which we would really like to
finally fix, can you have a look? Thanks in advance.


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

end of thread, other threads:[~2011-07-22 20:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-07 18:45 [Bug c++/30112] New: pragma redefine_extname fails when namespaces are involved marc dot glisse at normalesup dot org
2006-12-12 18:42 ` [Bug c++/30112] " marc dot glisse at normalesup dot org
2007-01-08 14:27 ` marc dot glisse at normalesup dot org
2007-02-22 16:20 ` marc dot glisse at normalesup dot org
     [not found] <bug-30112-4@http.gcc.gnu.org/bugzilla/>
2011-07-21 12:12 ` paolo.carlini at oracle dot com
2011-07-21 15:08 ` jason at gcc dot gnu.org
2011-07-21 15:43 ` jason at gcc dot gnu.org
2011-07-21 15:50 ` paolo.carlini at oracle dot com
2011-07-22 20:01 ` jason at gcc dot gnu.org
2011-07-22 20:07 ` jason at gcc dot gnu.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).