Commit 8c461ea1 by Jason Merrill

(compile_file): Use TREE_SYMBOL_REFERENCED instead of

        TREE_USED and TREE_ADDRESSABLE where appropriate.

From-SVN: r7551
parent 03e42132
...@@ -2313,8 +2313,7 @@ compile_file (name) ...@@ -2313,8 +2313,7 @@ compile_file (name)
if (! TREE_READONLY (decl) if (! TREE_READONLY (decl)
|| TREE_PUBLIC (decl) || TREE_PUBLIC (decl)
|| !optimize || !optimize
|| TREE_ADDRESSABLE (decl) || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
|| TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
rest_of_decl_compilation (decl, NULL_PTR, 1, 1); rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
else else
/* Cancel the RTL for this decl so that, if debugging info /* Cancel the RTL for this decl so that, if debugging info
...@@ -2327,9 +2326,8 @@ compile_file (name) ...@@ -2327,9 +2326,8 @@ compile_file (name)
&& ! TREE_ASM_WRITTEN (decl) && ! TREE_ASM_WRITTEN (decl)
&& DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) != 0
&& DECL_SAVED_INSNS (decl) != 0 && DECL_SAVED_INSNS (decl) != 0
&& (TREE_ADDRESSABLE (decl) && (flag_keep_inline_functions
|| flag_keep_inline_functions || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
|| TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
&& ! DECL_EXTERNAL (decl)) && ! DECL_EXTERNAL (decl))
{ {
temporary_allocation (); temporary_allocation ();
...@@ -2342,25 +2340,20 @@ compile_file (name) ...@@ -2342,25 +2340,20 @@ compile_file (name)
We don't warn about variables, We don't warn about variables,
because many programs have static variables because many programs have static variables
that exist only to get some text into the object file. */ that exist only to get some text into the object file. */
if ((warn_unused if (TREE_CODE (decl) == FUNCTION_DECL
|| TREE_USED (decl) && (warn_unused
|| (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl)))) || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
&& TREE_CODE (decl) == FUNCTION_DECL
&& DECL_INITIAL (decl) == 0 && DECL_INITIAL (decl) == 0
&& DECL_EXTERNAL (decl) && DECL_EXTERNAL (decl)
&& ! TREE_PUBLIC (decl)) && ! TREE_PUBLIC (decl))
{ {
/* This should be a pedwarn, except that there is pedwarn_with_decl (decl,
no easy way to prevent it from happening when the
name is used only inside a sizeof.
This at least avoids being incorrect. */
warning_with_decl (decl,
"`%s' declared `static' but never defined"); "`%s' declared `static' but never defined");
/* This symbol is effectively an "extern" declaration now. */ /* This symbol is effectively an "extern" declaration now. */
TREE_PUBLIC (decl) = 1; TREE_PUBLIC (decl) = 1;
assemble_external (decl); assemble_external (decl);
} }
/* Warn about static fns or vars defined but not used, /* Warn about static fns or vars defined but not used,
but not about inline functions or static consts but not about inline functions or static consts
since defining those in header files is normal practice. */ since defining those in header files is normal practice. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment