diff options
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 796f1ea..6dc2a6a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2791,7 +2791,7 @@ c_make_fname_decl (tree id, int type_dep) /*invisible=*/false, /*nested=*/false, UNKNOWN_LOCATION); } - finish_decl (decl, init, NULL_TREE); + finish_decl (decl, init, NULL_TREE, NULL_TREE); return decl; } @@ -3364,11 +3364,12 @@ c_maybe_initialize_eh (void) /* Finish processing of a declaration; install its initial value. + If ORIGTYPE is not NULL_TREE, it is the original type of INIT. If the length of an array type is not known before, it must be determined now, from the initial value, or it is an error. */ void -finish_decl (tree decl, tree init, tree asmspec_tree) +finish_decl (tree decl, tree init, tree origtype, tree asmspec_tree) { tree type; int was_incomplete = (DECL_SIZE (decl) == 0); @@ -3390,7 +3391,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree) init = 0; if (init) - store_init_value (decl, init); + store_init_value (decl, init, origtype); if (c_dialect_objc () && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL @@ -3643,11 +3644,14 @@ finish_decl (tree decl, tree init, tree asmspec_tree) tree cleanup_id = TREE_VALUE (TREE_VALUE (attr)); tree cleanup_decl = lookup_name (cleanup_id); tree cleanup; + VEC(tree,gc) *vec; /* Build "cleanup(&decl)" for the destructor. */ cleanup = build_unary_op (input_location, ADDR_EXPR, decl, 0); - cleanup = build_tree_list (NULL_TREE, cleanup); - cleanup = build_function_call (cleanup_decl, cleanup); + vec = VEC_alloc (tree, gc, 1); + VEC_quick_push (tree, vec, cleanup); + cleanup = build_function_call_vec (cleanup_decl, vec, NULL); + VEC_free (tree, gc, vec); /* Don't warn about decl unused; the cleanup uses it. */ TREE_USED (decl) = 1; @@ -3690,7 +3694,7 @@ push_parm_decl (const struct c_parm *parm) decl = pushdecl (decl); - finish_decl (decl, NULL_TREE, NULL_TREE); + finish_decl (decl, NULL_TREE, NULL_TREE, NULL_TREE); } /* Mark all the parameter declarations to date as forward decls. @@ -3740,7 +3744,7 @@ build_compound_literal (tree type, tree init, bool non_const) TREE_USED (decl) = 1; TREE_TYPE (decl) = type; TREE_READONLY (decl) = TYPE_READONLY (type); - store_init_value (decl, init); + store_init_value (decl, init, NULL_TREE); if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type)) { @@ -4678,7 +4682,7 @@ grokdeclarator (const struct c_declarator *declarator, tree decl = build_decl (TYPE_DECL, NULL_TREE, type); DECL_ARTIFICIAL (decl) = 1; pushdecl (decl); - finish_decl (decl, NULL_TREE, NULL_TREE); + finish_decl (decl, NULL_TREE, NULL_TREE, NULL_TREE); TYPE_NAME (type) = decl; } @@ -5527,7 +5531,7 @@ grokfield (location_t loc, width ? &width : NULL, decl_attrs, NULL, NULL, DEPRECATED_NORMAL); - finish_decl (value, NULL_TREE, NULL_TREE); + finish_decl (value, NULL_TREE, NULL_TREE, NULL_TREE); DECL_INITIAL (value) = width; return value; @@ -6814,7 +6818,7 @@ finish_function (void) && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) == integer_type_node && flag_isoc99) { - tree stmt = c_finish_return (integer_zero_node); + tree stmt = c_finish_return (integer_zero_node, NULL_TREE); /* Hack. We don't want the middle-end to warn that this return is unreachable, so we mark its location as special. Using UNKNOWN_LOCATION has the problem that it gets clobbered in |