c-common.c (handle_used_attribute): Use mark_referenced.
authorJan Hubicka <jh@suse.cz>
Wed, 25 Jun 2003 22:14:26 +0000 (00:14 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 25 Jun 2003 22:14:26 +0000 (22:14 +0000)
* c-common.c (handle_used_attribute): Use mark_referenced.
* varasm.c (mark_referenced): Break out from ...
(assemble_name): ... here.
* tree.h (mark_referenced): Declare.

From-SVN: r68500

gcc/ChangeLog
gcc/c-common.c
gcc/tree.h
gcc/varasm.c

index 7cab9e2..9d8dd82 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jun 26 00:13:35 CEST 2003  Jan Hubicka  <jh@suse.cz>
+
+       * c-common.c (handle_used_attribute): Use mark_referenced.
+       * varasm.c (mark_referenced): Break out from ...
+       (assemble_name): ... here.
+       * tree.h (mark_referenced): Declare.
+
 2003-06-25  Wolfgang Bangerth  <bangerth@dealii.org>
 
        * gccbug.in: Add PCH to list of categories.
index 8b555a8..43f9586 100644 (file)
@@ -4812,8 +4812,10 @@ handle_used_attribute (tree *pnode, tree name, tree args ATTRIBUTE_UNUSED,
 
   if (TREE_CODE (node) == FUNCTION_DECL
       || (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node)))
-    TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (node))
-      = TREE_USED (node) = 1;
+    {
+      mark_referenced (DECL_ASSEMBLER_NAME (node));
+      TREE_USED (node) = 1;
+    }
   else
     {
       warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
index 93065c5..e43466b 100644 (file)
@@ -2908,6 +2908,7 @@ extern void variable_section              PARAMS ((tree, int));
 enum tls_model decl_tls_model          PARAMS ((tree));
 enum symbol_visibility decl_visibility PARAMS ((tree));
 extern void resolve_unique_section     PARAMS ((tree, int, int));
+extern void mark_referenced    PARAMS ((tree));
 
 /* In stmt.c */
 extern void emit_nop                   PARAMS ((void));
index c2bd4b3..7519138 100644 (file)
@@ -1728,6 +1728,30 @@ assemble_label (name)
   ASM_OUTPUT_LABEL (asm_out_file, name);
 }
 
+/* Set the symbol_referenced flag for ID and notify callgraph code.  */
+void
+mark_referenced (id)
+     tree id;
+{
+  if (!TREE_SYMBOL_REFERENCED (id))
+    {
+      struct cgraph_node *node;
+      struct cgraph_varpool_node *vnode;
+
+      if (!cgraph_global_info_ready)
+       {
+         node = cgraph_node_for_identifier (id);
+         if (node)
+           cgraph_mark_needed_node (node, 1);
+       }
+
+      vnode = cgraph_varpool_node_for_identifier (id);
+      if (vnode)
+       cgraph_varpool_mark_needed_node (vnode);
+    }
+  TREE_SYMBOL_REFERENCED (id) = 1;
+}
+
 /* Output to FILE a reference to the assembler name of a C-level name NAME.
    If NAME starts with a *, the rest of NAME is output verbatim.
    Otherwise NAME is transformed in an implementation-defined way
@@ -1746,25 +1770,7 @@ assemble_name (file, name)
 
   id = maybe_get_identifier (real_name);
   if (id)
-    {
-      if (!TREE_SYMBOL_REFERENCED (id))
-       {
-         struct cgraph_node *node;
-         struct cgraph_varpool_node *vnode;
-         
-         if (!cgraph_global_info_ready)
-           {
-             node = cgraph_node_for_identifier (id);
-             if (node)
-               cgraph_mark_needed_node (node, 1);
-           }
-
-         vnode = cgraph_varpool_node_for_identifier (id);
-         if (vnode)
-           cgraph_varpool_mark_needed_node (vnode);
-       }
-      TREE_SYMBOL_REFERENCED (id) = 1;
-    }
+    mark_referenced (id);
 
   if (name[0] == '*')
     fputs (&name[1], file);