diff options
Diffstat (limited to 'contrib/gcc/c-objc-common.c')
-rw-r--r-- | contrib/gcc/c-objc-common.c | 86 |
1 files changed, 45 insertions, 41 deletions
diff --git a/contrib/gcc/c-objc-common.c b/contrib/gcc/c-objc-common.c index d2bc5c1..9f3847c 100644 --- a/contrib/gcc/c-objc-common.c +++ b/contrib/gcc/c-objc-common.c @@ -33,14 +33,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-inline.h" #include "varray.h" #include "ggc.h" +#include "langhooks.h" +#include "target.h" -static int c_tree_printer PARAMS ((output_buffer *)); +static bool c_tree_printer PARAMS ((output_buffer *, text_info *)); static tree inline_forbidden_p PARAMS ((tree *, int *, void *)); static void expand_deferred_fns PARAMS ((void)); static tree start_cdtor PARAMS ((int)); static void finish_cdtor PARAMS ((tree)); -static varray_type deferred_fns; +static GTY(()) varray_type deferred_fns; int c_missing_noreturn_ok_p (decl) @@ -90,7 +92,7 @@ inline_forbidden_p (nodep, walk_subtrees, fn) { /* We cannot inline functions that take a variable number of arguments. */ - case BUILT_IN_VARARGS_START: + case BUILT_IN_VA_START: case BUILT_IN_STDARG_START: #if 0 /* Functions that need information about the address of the @@ -119,7 +121,7 @@ inline_forbidden_p (nodep, walk_subtrees, fn) /* We will not inline a function which uses computed goto. The addresses of its local labels, which may be tucked into global storage, are of course not constant across - instantiations, which causes unexpected behaviour. */ + instantiations, which causes unexpected behavior. */ if (TREE_CODE (t) != LABEL_DECL) return node; @@ -167,17 +169,11 @@ c_cannot_inline_tree_fn (fnp) /* Don't auto-inline anything that might not be bound within this unit of translation. */ - if (!DECL_DECLARED_INLINE_P (fn) && flag_pic && TREE_PUBLIC (fn)) - { - DECL_UNINLINABLE (fn) = 1; - return 1; - } + if (!DECL_DECLARED_INLINE_P (fn) && !(*targetm.binds_local_p) (fn)) + goto cannot_inline; if (! function_attribute_inlinable_p (fn)) - { - DECL_UNINLINABLE (fn) = 1; - return 1; - } + goto cannot_inline; /* If a function has pending sizes, we must not defer its compilation, and we can't inline it as a tree. */ @@ -187,10 +183,7 @@ c_cannot_inline_tree_fn (fnp) put_pending_sizes (t); if (t) - { - DECL_UNINLINABLE (fn) = 1; - return 1; - } + goto cannot_inline; } if (DECL_CONTEXT (fn)) @@ -198,10 +191,7 @@ c_cannot_inline_tree_fn (fnp) /* If a nested function has pending sizes, we may have already saved them. */ if (DECL_LANG_SPECIFIC (fn)->pending_sizes) - { - DECL_UNINLINABLE (fn) = 1; - return 1; - } + goto cannot_inline; } else { @@ -223,13 +213,29 @@ c_cannot_inline_tree_fn (fnp) return 0; } - if (walk_tree (&DECL_SAVED_TREE (fn), inline_forbidden_p, fn, NULL)) - { - DECL_UNINLINABLE (fn) = 1; - return 1; - } + if (walk_tree_without_duplicates + (&DECL_SAVED_TREE (fn), inline_forbidden_p, fn)) + goto cannot_inline; return 0; + + cannot_inline: + DECL_UNINLINABLE (fn) = 1; + return 1; +} + +/* Called from check_global_declarations. */ + +bool +c_warn_unused_global_decl (decl) + tree decl; +{ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl)) + return false; + if (DECL_IN_SYSTEM_HEADER (decl)) + return false; + + return true; } /* Initialization common to C and Objective-C front ends. */ @@ -240,13 +246,9 @@ c_objc_common_init (filename) c_init_decl_processing (); filename = c_common_init (filename); + if (filename == NULL) + return NULL; - add_c_tree_codes (); - - save_lang_status = &push_c_function_context; - restore_lang_status = &pop_c_function_context; - mark_lang_status = &mark_c_function_context; - lang_expand_expr = c_expand_expr; lang_expand_decl_stmt = c_expand_decl_stmt; /* These were not defined in the Objective-C front end, but I'm @@ -266,7 +268,6 @@ c_objc_common_init (filename) } VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns"); - ggc_add_tree_varray_root (&deferred_fns, 1); return filename; } @@ -304,7 +305,7 @@ expand_deferred_fns () } } - VARRAY_FREE (deferred_fns); + deferred_fns = 0; } static tree @@ -403,26 +404,29 @@ c_objc_common_finish_file () by the C++ front-end. Please notice when called, the `%' part was already skipped by the diagnostic machinery. */ -static int -c_tree_printer (buffer) +static bool +c_tree_printer (buffer, text) output_buffer *buffer; + text_info *text; { - tree t = va_arg (output_buffer_format_args (buffer), tree); + tree t = va_arg (*text->args_ptr, tree); - switch (*output_buffer_text_cursor (buffer)) + switch (*text->format_spec) { case 'D': case 'F': case 'T': { const char *n = DECL_NAME (t) - ? (*decl_printable_name) (t, 2) + ? (*lang_hooks.decl_printable_name) (t, 2) : "({anonymous})"; output_add_string (buffer, n); } - return 1; + return true; default: - return 0; + return false; } } + +#include "gt-c-objc-common.h" |