From 1ae57298f9397b3a8476060f57045838847af293 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 22 Sep 2004 02:24:06 +0000 Subject: [PATCH] c-decl.c (implicitly_declare): Call maybe_apply_renaming_pragma. * c-decl.c (implicitly_declare): Call maybe_apply_renaming_pragma. (finish_decl): Likewise. From-SVN: r87840 --- gcc/ChangeLog | 5 +++++ gcc/c-decl.c | 8 +++++++- gcc/testsuite/ChangeLog | 6 +++++- gcc/testsuite/gcc.dg/pragma-re-3.c | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pragma-re-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65651500df3..147d8d856b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-21 Mark Mitchell + + * c-decl.c (implicityl_declare): Call maybe_apply_renaming_pragma. + (finish_decl): Likewise. + 2004-09-21 Devang Patel * tree.def (VEC_COND_EXPR): New tree node. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 76c1a08d3b4..98f1580ed5f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2159,6 +2159,8 @@ implicitly_declare (tree functionid) { struct c_binding *b; tree decl = 0; + tree asmspec_tree; + for (b = I_SYMBOL_BINDING (functionid); b; b = b->shadowed) { if (B_IN_SCOPE (b, external_scope)) @@ -2230,6 +2232,9 @@ implicitly_declare (tree functionid) TREE_PUBLIC (decl) = 1; C_DECL_IMPLICIT (decl) = 1; implicit_decl_warning (functionid, 0); + asmspec_tree = maybe_apply_renaming_pragma (decl, /*asmname=*/NULL); + if (asmspec_tree) + set_user_assembler_name (decl, TREE_STRING_POINTER (asmspec_tree)); /* C89 says implicit declarations are in the innermost block. So we record the decl in the standard fashion. */ @@ -3064,7 +3069,8 @@ finish_decl (tree decl, tree init, tree asmspec_tree) const char *asmspec = 0; /* If a name was specified, get the string. */ - if (current_scope == file_scope) + if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL) + && DECL_FILE_SCOPE_P (decl)) asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree); if (asmspec_tree) asmspec = TREE_STRING_POINTER (asmspec_tree); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 11d8dfc4228..fb20f329643 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,8 @@ - 2004-09-17 Matt Austern +2004-09-21 Mark Mitchell + + * gcc.dg/pragma-re-3.c: New test. + +2004-09-17 Matt Austern PR c++/15049 * g++.dg/other/anon3.C: New. diff --git a/gcc/testsuite/gcc.dg/pragma-re-3.c b/gcc/testsuite/gcc.dg/pragma-re-3.c new file mode 100644 index 00000000000..4a73c414b92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pragma-re-3.c @@ -0,0 +1,18 @@ +/* { dg-do link { target *-*-solaris* } } */ + +#pragma redefine_extname f1 f +#pragma redefine_extname g1 g + +void f() { + extern int f1(); + f1(); +} + +void g() { + g1(); +} + +int main () { + f(); + g(); +} -- 2.30.2