+2010-02-19 Mike Stump <mikestump@comcast.net>
+
+ PR objc/43061
+ * cgraphunit.c (process_function_and_variable_attributes): Check
+ DECL_PRESERVE_P instead of looking up attribute "used".
+ * ipa-pure-const.c (check_decl): Likewise.
+ * ipa-reference.c (has_proper_scope_for_analysis): Likewise.
+ * ipa-type-escape.c (has_proper_scope_for_analysis): Likewise.
+ * config/sol2.c (solaris_insert_attributes): Set DECL_PRESERVE_P
+ instead of attribute "used".
+ * config/sol2-c.c (solaris_pragma_init): Likewise.
+ (solaris_pragma_fini): Likewise.
+
2010-02-19 Jakub Jelinek <jakub@redhat.com>
* ipa-struct-reorg.c (make_field_acc_node, gen_cluster, peel_field):
for (node = cgraph_nodes; node != first; node = node->next)
{
tree decl = node->decl;
- if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
+ if (DECL_PRESERVE_P (decl))
{
mark_decl_referenced (decl);
if (node->local.finalized)
for (vnode = varpool_nodes; vnode != first_var; vnode = vnode->next)
{
tree decl = vnode->decl;
- if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
+ if (DECL_PRESERVE_P (decl))
{
mark_decl_referenced (decl);
vnode->force_output = true;
tree decl = identifier_global_value (t);
if (decl && DECL_P (decl))
{
- tree init_list = build_tree_list (get_identifier ("init"),
- NULL);
- tree attrs = tree_cons (get_identifier ("used"), NULL, init_list);
+ tree attrs = build_tree_list (get_identifier ("init"),
+ NULL);
+ TREE_USED (decl) = 1;
+ DECL_PRESERVE_P (decl) = 1;
decl_attributes (&decl, attrs, 0);
}
else
tree decl = identifier_global_value (t);
if (decl && DECL_P (decl))
{
- tree fini_list = build_tree_list (get_identifier ("fini"),
- NULL);
- tree attrs = tree_cons (get_identifier ("used"), NULL, fini_list);
+ tree attrs = build_tree_list (get_identifier ("fini"),
+ NULL);
+ TREE_USED (decl) = 1;
+ DECL_PRESERVE_P (decl) = 1;
decl_attributes (&decl, attrs, 0);
}
else
{
*attributes = tree_cons (get_identifier ("init"), NULL,
*attributes);
- *attributes = tree_cons (get_identifier ("used"), NULL,
- *attributes);
+ TREE_USED (decl) = 1;
+ DECL_PRESERVE_P (decl) = 1;
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;
{
*attributes = tree_cons (get_identifier ("fini"), NULL,
*attributes);
- *attributes = tree_cons (get_identifier ("used"), NULL,
- *attributes);
+ TREE_USED (decl) = 1;
+ DECL_PRESERVE_P (decl) = 1;
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;
/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
- if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+ if (DECL_PRESERVE_P (t))
{
local->pure_const_state = IPA_NEITHER;
if (dump_file)
{
/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
- if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+ if (DECL_PRESERVE_P (t))
return false;
/* Do not want to do anything with volatile except mark any
tree type = get_canon_type (TREE_TYPE (t), false, false);
if (!type) return;
- if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+ if (DECL_PRESERVE_P (t))
{
mark_interesting_type (type, FULL_ESCAPE);
return;
/* We reserve the right for the runtime to use/modify these variables
in ways that are opaque to us. */
DECL_PRESERVE_P (var) = 1;
- /* ipa*.c/cgraphunit.c use lookup attribute rather than testing
- DECL_PRESERVE_P. Once they switch to testing DECL_PRESERVE_P,
- this can be removed. */
- DECL_ATTRIBUTES (var) = tree_cons (get_identifier ("used"), NULL,
- DECL_ATTRIBUTES (var)) ;
}
/* Find the decl for the constant string class reference. This is only