diff options
author | Jan Hubicka <jh@suse.cz> | 2005-06-24 17:14:04 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2005-06-24 15:14:04 +0000 |
commit | ce91e74c187986865c3de8fbd871242183afa93d (patch) | |
tree | cb74c75feb0a3380d0f1a108528cdc35a05f7892 /gcc/c-common.c | |
parent | 62765fb14a52c42422b31938deb5893ebe13e735 (diff) | |
download | gcc-ce91e74c187986865c3de8fbd871242183afa93d.zip gcc-ce91e74c187986865c3de8fbd871242183afa93d.tar.gz gcc-ce91e74c187986865c3de8fbd871242183afa93d.tar.bz2 |
tree-optimize.c (init_tree_optimization_passes): Fix flags of all_passes and all_ipa_passes.
* tree-optimize.c (init_tree_optimization_passes): Fix flags of
all_passes and all_ipa_passes.
* c-common.c: Include cgraph.h
(handle_externally_visible_attribute): New function.
(c_common_att): Add "externally_visible" attribute.
* cgraph.c (decide_is_variable_needed): Obey externally
visible flag.
(cgraph_varpool_finalize_decl): Avoid redundant checking.
* cgraph.h (struct cgraph_node): New flag externally_visible.
(decide_is_function_needed): Obey externally visible flag.
(cgraph_finalize_function): Avoid redundant checks.
(cgraph_function_and_variable_visibility): Bring symbols local
when asked for.
* common.opt (fwhole-program): New flag.
* doc/invoke.texi (-fwhole-program): Document.
From-SVN: r101295
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index b7263aa..c9ebb58 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -47,6 +47,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-mudflap.h" #include "opts.h" #include "real.h" +#include "cgraph.h" cpp_reader *parse_in; /* Declared in c-pragma.h. */ @@ -514,6 +515,8 @@ static tree handle_always_inline_attribute (tree *, tree, tree, int, bool *); static tree handle_used_attribute (tree *, tree, tree, int, bool *); static tree handle_unused_attribute (tree *, tree, tree, int, bool *); +static tree handle_externally_visible_attribute (tree *, tree, tree, int, + bool *); static tree handle_const_attribute (tree *, tree, tree, int, bool *); static tree handle_transparent_union_attribute (tree *, tree, tree, int, bool *); @@ -580,6 +583,8 @@ const struct attribute_spec c_common_attribute_table[] = handle_used_attribute }, { "unused", 0, 0, false, false, false, handle_unused_attribute }, + { "externally_visible", 0, 0, true, false, false, + handle_externally_visible_attribute }, /* The same comments as for noreturn attributes apply to const ones. */ { "const", 0, 0, true, false, false, handle_const_attribute }, @@ -4129,6 +4134,47 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args), return NULL_TREE; } +/* Handle a "externally_visible" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_externally_visible_attribute (tree *pnode, tree name, + tree ARG_UNUSED (args), + int ARG_UNUSED (flags), + bool *no_add_attrs) +{ + tree node = *pnode; + + if ((!TREE_STATIC (node) && TREE_CODE (node) != FUNCTION_DECL) + || !TREE_PUBLIC (node)) + { + warning (OPT_Wattributes, + "%qE attribute have effect only on public objects", name); + *no_add_attrs = true; + } + else if (TREE_CODE (node) == FUNCTION_DECL) + { + struct cgraph_node *n = cgraph_node (node); + n->local.externally_visible = true; + if (n->local.finalized) + cgraph_mark_needed_node (n); + } + else if (TREE_CODE (node) == VAR_DECL) + { + struct cgraph_varpool_node *n = cgraph_varpool_node (node); + n->externally_visible = true; + if (n->finalized) + cgraph_varpool_mark_needed_node (n); + } + else + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + /* Handle a "const" attribute; arguments as in struct attribute_spec.handler. */ |