From: Eric Botcazou Date: Fri, 7 May 2004 06:58:00 +0000 (+0200) Subject: re PR c++/14962 (g++ ignores #pragma redefine_extname) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92ff0c419aee64c757481517b44043dbe7c6b501;p=gcc.git re PR c++/14962 (g++ ignores #pragma redefine_extname) PR c++/14962 * c-pragma.c (handle_pragma_redefine_extname): Only change the assembler name of FUNCTION_DECLs and VAR_DECLs. From-SVN: r81610 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dacb3ca5d45..edad48cad9d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-05-07 Eric Botcazou + + PR c++/14962 + * c-pragma.c (handle_pragma_redefine_extname): Only change + the assembler name of FUNCTION_DECLs and VAR_DECLs. + 2004-05-07 Uros Bizjak * optabs.h (enum optab_index): Add new OTI_log1p. diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index c9e15056e78..10c8caea35d 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -377,7 +377,8 @@ handle_pragma_redefine_extname (cpp_reader *dummy ATTRIBUTE_UNUSED) warning ("junk at end of #pragma redefine_extname"); decl = identifier_global_value (oldname); - if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') + if (decl && (TREE_CODE (decl) == FUNCTION_DECL + || TREE_CODE (decl) == VAR_DECL)) { if (DECL_ASSEMBLER_NAME_SET_P (decl) && DECL_ASSEMBLER_NAME (decl) != newname) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f569390496..cb5a6b8fa80 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-05-07 Eric Botcazou + + * g++.dg/other/pragma-re-2.C: New test. + 2004-05-07 Uros Bizjak * gcc.dg/i386-387-1.c: Add new test for __builtin_fmod. diff --git a/gcc/testsuite/g++.dg/other/pragma-re-2.C b/gcc/testsuite/g++.dg/other/pragma-re-2.C new file mode 100644 index 00000000000..44d1b50f699 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pragma-re-2.C @@ -0,0 +1,25 @@ +/* PR c++/14962 */ +/* Originator: */ + +/* { dg-do compile { target *-*-solaris* } } */ +/* { dg-final { scan-assembler "new_name" } } */ +/* { dg-final { scan-assembler-not "old_name" } } */ + +#ifndef __PRAGMA_REDEFINE_EXTNAME +#error +#endif + +extern "C" { + +struct old_name { int i; }; + +#pragma redefine_extname old_name new_name + +int old_name(void); + +} + +int foo(void) +{ + return old_name(); +}