From a04a722b88baf5568f3ba02a07189cbd65b0dc22 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 5 May 2011 11:20:31 +0100 Subject: c-decl.c (finish_decl): Don't call get_pending_sizes. * c-decl.c (finish_decl): Don't call get_pending_sizes. (grokparm): Add parameter expr. Pass it to grokdeclarator. (push_parm_decl): Add parameter expr. Pass it to grokdeclarator. (c_variable_size): Remove. (grokdeclarator): Use save_expr instead of c_variable_size. Don't call put_pending_sizes. (get_parm_info): Add parameter expr. Use it to set arg_info->pending_sizes. (store_parm_decls): Use arg_info->pending_sizes instead or calling get_pending_sizes. * c-parser.c (c_parser_parms_declarator): Update call to c_parser_parms_list_declarator. (c_parser_parms_list_declarator): Take parameter expr. Update call to push_parm_decl. Update recursive call. Don't call get_pending_sizes. Update calls to get_parm_info. (c_parser_objc_method_definition): Update calls to c_parser_objc_method_decl and objc_start_method_definition. (c_parser_objc_methodproto): Update call to c_parser_objc_method_decl. (c_parser_objc_method_decl): Add parameter expr. Update call to grokparm. (c_parser_objc_try_catch_finally_statement): Update call to grokparm. * c-tree.h (struct c_arg_info.pending_sizes): Change to a tree. (get_parm_info, grokparm, push_parm_decl): Update prototypes. c-family: * c-objc.h (objc_start_method_definition): Update prototype. * stub-objc.c (objc_start_method_definition): Add extra parameter. cp: * parser.c (cp_parser_objc_method_definition_list): Update call to objc_start_method_definition. objc: * objc-act.c (objc_start_method_definition): Add parameter expr. Update call to start_method_def. (objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter, objc_synthesize_setter) Update calls to objc_start_method_definition. (objc_get_parm_info): Add parameter expr. Update call to get_parm_info. (start_method_def): Add parameter expr. Update call to objc_get_parm_info. * objc-gnu-runtime-abi-01.c (build_module_initializer_routine): Update call to objc_get_parm_info. * objc-runtime-shared-support.h (objc_get_parm_info): Add extra parameter. From-SVN: r173422 --- gcc/objc/ChangeLog | 16 ++++++++++++++++ gcc/objc/objc-act.c | 32 ++++++++++++++++++++------------ gcc/objc/objc-gnu-runtime-abi-01.c | 2 +- gcc/objc/objc-runtime-shared-support.h | 4 ++-- 4 files changed, 39 insertions(+), 15 deletions(-) (limited to 'gcc/objc') diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index f31a754..8706175 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,19 @@ +2011-05-05 Joseph Myers + + * objc-act.c (objc_start_method_definition): Add parameter expr. + Update call to start_method_def. + (objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter, + objc_synthesize_setter) Update calls to + objc_start_method_definition. + (objc_get_parm_info): Add parameter expr. Update call to + get_parm_info. + (start_method_def): Add parameter expr. Update call to + objc_get_parm_info. + * objc-gnu-runtime-abi-01.c (build_module_initializer_routine): + Update call to objc_get_parm_info. + * objc-runtime-shared-support.h (objc_get_parm_info): Add extra + parameter. + 2011-04-26 Jason Merrill * objc-act.c (objc_fold_objc_type_ref): Remove. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 025f375..46cfc55 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -126,7 +126,7 @@ static void synth_module_prologue (void); static tree start_class (enum tree_code, tree, tree, tree, tree); static tree continue_class (tree); static void finish_class (tree); -static void start_method_def (tree); +static void start_method_def (tree, tree); static tree start_protocol (enum tree_code, tree, tree, tree); static tree build_method_decl (enum tree_code, tree, tree, tree, bool); @@ -2041,9 +2041,12 @@ objc_add_method_declaration (bool is_class_method, tree decl, tree attributes) /* Return 'true' if the method definition could be started, and 'false' if not (because we are outside an @implementation context). + EXPR is NULL or an expression that needs to be evaluated for the + side effects of array size expressions in the parameters. */ bool -objc_start_method_definition (bool is_class_method, tree decl, tree attributes) +objc_start_method_definition (bool is_class_method, tree decl, tree attributes, + tree expr) { if (!objc_implementation_context) { @@ -2070,7 +2073,7 @@ objc_start_method_definition (bool is_class_method, tree decl, tree attributes) decl, is_class_method, /* is optional */ false); - start_method_def (decl); + start_method_def (decl, expr); return true; } @@ -4557,7 +4560,7 @@ objc_generate_cxx_ctor_or_dtor (bool dtor) ? TAG_CXX_DESTRUCT : TAG_CXX_CONSTRUCT), make_node (TREE_LIST), - false), NULL); + false), NULL, NULL_TREE); body = begin_function_body (); compound_stmt = begin_compound_stmt (0); @@ -7214,7 +7217,8 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr decl = copy_node (decl); DECL_SOURCE_LOCATION (decl) = location; - objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE); + objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE, + NULL_TREE); body = c_begin_compound_stmt (true); /* Now we need to decide how we build the getter. There are three @@ -7393,7 +7397,8 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr decl = copy_node (decl); DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (property); - objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE); + objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE, + NULL_TREE); body = c_begin_compound_stmt (true); @@ -8287,7 +8292,8 @@ objc_push_parm (tree parm) #ifdef OBJCPLUS tree -objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED) +objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED, + tree expr ATTRIBUTE_UNUSED) { tree parm_info = objc_parmlist; objc_parmlist = NULL_TREE; @@ -8296,7 +8302,7 @@ objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED) } #else struct c_arg_info * -objc_get_parm_info (int have_ellipsis) +objc_get_parm_info (int have_ellipsis, tree expr) { tree parm_info = objc_parmlist; struct c_arg_info *arg_info; @@ -8313,7 +8319,7 @@ objc_get_parm_info (int have_ellipsis) finish_decl (parm_info, input_location, NULL_TREE, NULL_TREE, NULL_TREE); parm_info = next; } - arg_info = get_parm_info (have_ellipsis); + arg_info = get_parm_info (have_ellipsis, expr); pop_scope (); objc_parmlist = NULL_TREE; return arg_info; @@ -8348,10 +8354,12 @@ synth_self_and_ucmd_args (void) /* Transform an Objective-C method definition into a static C function definition, synthesizing the first two arguments, "self" and "_cmd", - in the process. */ + in the process. EXPR is NULL or an expression that needs to be + evaluated for the side effects of array size expressions in the + parameters. */ static void -start_method_def (tree method) +start_method_def (tree method, tree expr) { tree parmlist; #ifdef OBJCPLUS @@ -8406,7 +8414,7 @@ start_method_def (tree method) have_ellipsis = 1; } - parm_info = objc_get_parm_info (have_ellipsis); + parm_info = objc_get_parm_info (have_ellipsis, expr); really_start_method (objc_method_context, parm_info); } diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c index fdeebea..863f7d6 100644 --- a/gcc/objc/objc-gnu-runtime-abi-01.c +++ b/gcc/objc/objc-gnu-runtime-abi-01.c @@ -948,7 +948,7 @@ build_module_initializer_routine (void) #else objc_start_function (get_identifier (TAG_GNUINIT), build_function_type_list (void_type_node, NULL_TREE), - NULL_TREE, objc_get_parm_info (0)); + NULL_TREE, objc_get_parm_info (0, NULL_TREE)); #endif body = c_begin_compound_stmt (true); add_stmt (build_function_call diff --git a/gcc/objc/objc-runtime-shared-support.h b/gcc/objc/objc-runtime-shared-support.h index ace9039..c948cfd 100644 --- a/gcc/objc/objc-runtime-shared-support.h +++ b/gcc/objc/objc-runtime-shared-support.h @@ -43,10 +43,10 @@ extern void add_class_reference (tree); #ifdef OBJCPLUS extern void objc_start_function (tree, tree, tree, tree); -extern tree objc_get_parm_info (int); +extern tree objc_get_parm_info (int, tree); #else extern void objc_start_function (tree, tree, tree, struct c_arg_info *); -extern struct c_arg_info *objc_get_parm_info (int); +extern struct c_arg_info *objc_get_parm_info (int, tree); #endif extern void objc_push_parm (tree); extern tree get_arg_type_list (tree, int, int); -- cgit v1.1