diff options
author | Geoffrey Keating <geoffk@apple.com> | 2003-07-21 20:53:07 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2003-07-21 20:53:07 +0000 |
commit | 49a64b24626e87167c98713e8403811806f61dcf (patch) | |
tree | b39db2c718d8a94a3687623e18d1f0efe3060e0a /gcc | |
parent | 8c29550d3c6fbc405e1039246ae4425c7cbb8d3b (diff) | |
download | gcc-49a64b24626e87167c98713e8403811806f61dcf.zip gcc-49a64b24626e87167c98713e8403811806f61dcf.tar.gz gcc-49a64b24626e87167c98713e8403811806f61dcf.tar.bz2 |
c-pragma.c (maybe_apply_pragma_weak): Don't get DECL_ASSEMBLER_NAME when it's not needed.
* c-pragma.c (maybe_apply_pragma_weak): Don't get DECL_ASSEMBLER_NAME
when it's not needed.
From-SVN: r69646
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-pragma.c | 23 |
2 files changed, 20 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cd57ee3..92dd499 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-07-21 Geoffrey Keating <geoffk@apple.com> + + * c-pragma.c (maybe_apply_pragma_weak): Don't get DECL_ASSEMBLER_NAME + when it's not needed. + 2003-07-21 Jakub Jelinek <jakub@redhat.com> * config/rs6000/rs6000.h (machine_function): Add ra_need_lr. diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index dc95733..c0bfc29 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -286,15 +286,22 @@ maybe_apply_pragma_weak (tree decl) { tree *p, t, id; - /* Copied from the check in set_decl_assembler_name. */ - if (TREE_CODE (decl) == FUNCTION_DECL - || (TREE_CODE (decl) == VAR_DECL - && (TREE_STATIC (decl) - || DECL_EXTERNAL (decl) - || TREE_PUBLIC (decl)))) - id = DECL_ASSEMBLER_NAME (decl); - else + /* Avoid asking for DECL_ASSEMBLER_NAME when it's not needed. */ + + /* No weak symbols pending, take the short-cut. */ + if (!pending_weaks) + return; + /* If it's not visible outside this file, it doesn't matter whether + it's weak. */ + if (!DECL_EXTERNAL (decl) && !TREE_PUBLIC (decl)) return; + /* If it's not a function or a variable, it can't be weak. + FIXME: what kinds of things are visible outside this file but + aren't functions or variables? Should this be an abort() instead? */ + if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) + return; + + id = DECL_ASSEMBLER_NAME (decl); for (p = &pending_weaks; (t = *p) ; p = &TREE_CHAIN (t)) if (id == TREE_PURPOSE (t)) |