diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-21 20:53:07 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-21 20:53:07 +0000 |
commit | dfa2ccf8dd273f121f3bf31a71c6d842fadcbe91 (patch) | |
tree | b39db2c718d8a94a3687623e18d1f0efe3060e0a /gcc/c-pragma.c | |
parent | b33ae811a998f3065d23501fd057f386224ada64 (diff) | |
download | gcc-dfa2ccf8dd273f121f3bf31a71c6d842fadcbe91.tar.gz |
* c-pragma.c (maybe_apply_pragma_weak): Don't get DECL_ASSEMBLER_NAME
when it's not needed.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69646 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-pragma.c')
-rw-r--r-- | gcc/c-pragma.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index dc9573397ec..c0bfc295749 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)) |