diff options
author | Alexander Kabaev <kan@FreeBSD.org> | 2003-08-22 02:56:07 +0000 |
---|---|---|
committer | Alexander Kabaev <kan@FreeBSD.org> | 2003-08-22 02:56:07 +0000 |
commit | 50ebf00d843b15d8beae7f0a8d34d1ea4ae48cec (patch) | |
tree | aa86de970d24a76b30b53157cf41e9d09ffe4d51 /contrib/gcc/c-pragma.c | |
parent | 6bdbd039fdee37985426b3cfdb6ec9b43f1c96aa (diff) | |
download | src-50ebf00d843b15d8beae7f0a8d34d1ea4ae48cec.tar.gz src-50ebf00d843b15d8beae7f0a8d34d1ea4ae48cec.zip |
Gcc 3.3.1-release.
Notes
Notes:
svn path=/vendor/gcc/dist/; revision=119256
Diffstat (limited to 'contrib/gcc/c-pragma.c')
-rw-r--r-- | contrib/gcc/c-pragma.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/contrib/gcc/c-pragma.c b/contrib/gcc/c-pragma.c index 73c7d5ff5451..819e6965bd6b 100644 --- a/contrib/gcc/c-pragma.c +++ b/contrib/gcc/c-pragma.c @@ -288,15 +288,22 @@ maybe_apply_pragma_weak (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)) |