c-common.c (handle_used_attribute): Use mark_referenced.

* 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
This commit is contained in:
Jan Hubicka 2003-06-26 00:14:26 +02:00 committed by Jan Hubicka
parent 6322fdd83b
commit 4d7d0451bc
4 changed files with 37 additions and 21 deletions

View 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> 2003-06-25 Wolfgang Bangerth <bangerth@dealii.org>
* gccbug.in: Add PCH to list of categories. * gccbug.in: Add PCH to list of categories.

View File

@ -4812,8 +4812,10 @@ handle_used_attribute (tree *pnode, tree name, tree args ATTRIBUTE_UNUSED,
if (TREE_CODE (node) == FUNCTION_DECL if (TREE_CODE (node) == FUNCTION_DECL
|| (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node))) || (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 else
{ {
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));

View File

@ -2908,6 +2908,7 @@ extern void variable_section PARAMS ((tree, int));
enum tls_model decl_tls_model PARAMS ((tree)); enum tls_model decl_tls_model PARAMS ((tree));
enum symbol_visibility decl_visibility PARAMS ((tree)); enum symbol_visibility decl_visibility PARAMS ((tree));
extern void resolve_unique_section PARAMS ((tree, int, int)); extern void resolve_unique_section PARAMS ((tree, int, int));
extern void mark_referenced PARAMS ((tree));
/* In stmt.c */ /* In stmt.c */
extern void emit_nop PARAMS ((void)); extern void emit_nop PARAMS ((void));

View File

@ -1728,6 +1728,30 @@ assemble_label (name)
ASM_OUTPUT_LABEL (asm_out_file, 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. /* 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. If NAME starts with a *, the rest of NAME is output verbatim.
Otherwise NAME is transformed in an implementation-defined way Otherwise NAME is transformed in an implementation-defined way
@ -1746,25 +1770,7 @@ assemble_name (file, name)
id = maybe_get_identifier (real_name); id = maybe_get_identifier (real_name);
if (id) if (id)
{ mark_referenced (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;
}
if (name[0] == '*') if (name[0] == '*')
fputs (&name[1], file); fputs (&name[1], file);