From 0244e6f7e07176d02c4135e64e776bc117553c90 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 9 Jun 2010 15:18:40 +0000 Subject: [PATCH] call.c (build_java_interface_fn_ref): Call build_function_type_list instead of build_function_type. * call.c (build_java_interface_fn_ref): Call build_function_type_list instead of build_function_type. * decl.c (cxx_init_decl_processing): Likewise. (declare_global_var): Likewise. (get_atexit_node): Likewise. (expand_static_init): Likewise. * decl2.c (start_objects): Likewise. (start_static_storage_duration_function): Likewise. * except.c (init_exception_processing): Likewise. (build_exc_ptr): Likewise. (build_throw): Likewise. * rtti.c (throw_bad_cast): Likewise. (throw_bad_typeid): Likewise. (build_dynamic_cast_1): Likewise. From-SVN: r160486 --- gcc/cp/ChangeLog | 17 ++++++++++++++++ gcc/cp/call.c | 11 ++++------ gcc/cp/decl.c | 52 ++++++++++++++++++++++++------------------------ gcc/cp/decl2.c | 13 +++++------- gcc/cp/except.c | 30 +++++++++++++--------------- gcc/cp/rtti.c | 16 +++++++-------- 6 files changed, 73 insertions(+), 66 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f9831421f38..aca50f84c35 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2010-06-09 Nathan Froyd + + * call.c (build_java_interface_fn_ref): Call build_function_type_list + instead of build_function_type. + * decl.c (cxx_init_decl_processing): Likewise. + (declare_global_var): Likewise. + (get_atexit_node): Likewise. + (expand_static_init): Likewise. + * decl2.c (start_objects): Likewise. + (start_static_storage_duration_function): Likewise. + * except.c (init_exception_processing): Likewise. + (build_exc_ptr): Likewise. + (build_throw): Likewise. + * rtti.c (throw_bad_cast): Likewise. + (throw_bad_typeid): Likewise. + (build_dynamic_cast_1): Likewise. + 2010-06-09 Nathan Froyd * call.c (build_call_n): Call XALLOCAVEC instead of alloca. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 9162a1d83a5..e432f7490bf 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6008,14 +6008,11 @@ build_java_interface_fn_ref (tree fn, tree instance) if (!java_iface_lookup_fn) { - tree endlink = build_void_list_node (); - tree t = tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, java_int_type_node, - endlink))); + tree ftype = build_function_type_list (ptr_type_node, + ptr_type_node, ptr_type_node, + java_int_type_node, NULL_TREE); java_iface_lookup_fn - = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", - build_function_type (ptr_type_node, t), + = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", ftype, 0, NOT_BUILT_IN, NULL, NULL_TREE); } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ca3152f9caf..0c4ad496db3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3445,11 +3445,9 @@ cxx_init_decl_processing (void) vtable_index_type = ptrdiff_type_node; vtt_parm_type = build_pointer_type (const_ptr_type_node); - void_ftype = build_function_type (void_type_node, void_list_node); - void_ftype_ptr = build_function_type (void_type_node, - tree_cons (NULL_TREE, - ptr_type_node, - void_list_node)); + void_ftype = build_function_type_list (void_type_node, NULL_TREE); + void_ftype_ptr = build_function_type_list (void_type_node, + ptr_type_node, NULL_TREE); void_ftype_ptr = build_exception_variant (void_ftype_ptr, empty_except_spec); @@ -3506,10 +3504,7 @@ cxx_init_decl_processing (void) tree new_eh_spec; ptr_ftype_sizetype - = build_function_type (ptr_type_node, - tree_cons (NULL_TREE, - size_type_node, - void_list_node)); + = build_function_type_list (ptr_type_node, size_type_node, NULL_TREE); if (cxx_dialect == cxx98) { tree bad_alloc_id; @@ -6077,20 +6072,21 @@ declare_global_var (tree name, tree type) static tree get_atexit_fn_ptr_type (void) { - tree arg_types; tree fn_type; if (!atexit_fn_ptr_type_node) { + tree arg_type; if (flag_use_cxa_atexit && !targetm.cxx.use_atexit_for_cxa_atexit ()) /* The parameter to "__cxa_atexit" is "void (*)(void *)". */ - arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + arg_type = ptr_type_node; else /* The parameter to "atexit" is "void (*)(void)". */ - arg_types = void_list_node; + arg_type = NULL_TREE; - fn_type = build_function_type (void_type_node, arg_types); + fn_type = build_function_type_list (void_type_node, + arg_type, NULL_TREE); atexit_fn_ptr_type_node = build_pointer_type (fn_type); } @@ -6105,7 +6101,6 @@ static tree get_atexit_node (void) { tree atexit_fndecl; - tree arg_types; tree fn_type; tree fn_ptr_type; const char *name; @@ -6122,25 +6117,28 @@ get_atexit_node (void) We build up the argument types and then then function type itself. */ + tree argtype0, argtype1, argtype2; use_aeabi_atexit = targetm.cxx.use_aeabi_atexit (); /* First, build the pointer-to-function type for the first argument. */ fn_ptr_type = get_atexit_fn_ptr_type (); /* Then, build the rest of the argument types. */ - arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + argtype2 = ptr_type_node; if (use_aeabi_atexit) { - arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types); - arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types); + argtype1 = fn_ptr_type; + argtype0 = ptr_type_node; } else { - arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types); - arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types); + argtype1 = ptr_type_node; + argtype0 = fn_ptr_type; } /* And the final __cxa_atexit type. */ - fn_type = build_function_type (integer_type_node, arg_types); + fn_type = build_function_type_list (integer_type_node, + argtype0, argtype1, argtype2, + NULL_TREE); fn_ptr_type = build_pointer_type (fn_type); if (use_aeabi_atexit) name = "__aeabi_atexit"; @@ -6156,9 +6154,9 @@ get_atexit_node (void) We build up the argument types and then then function type itself. */ fn_ptr_type = get_atexit_fn_ptr_type (); - arg_types = tree_cons (NULL_TREE, fn_ptr_type, void_list_node); /* Build the final atexit type. */ - fn_type = build_function_type (integer_type_node, arg_types); + fn_type = build_function_type_list (integer_type_node, + fn_ptr_type, NULL_TREE); name = "atexit"; } @@ -6438,11 +6436,13 @@ expand_static_init (tree decl, tree init) abort_fn = get_identifier ("__cxa_guard_abort"); if (!get_global_value_if_present (acquire_fn, &acquire_fn)) { - tree argtypes = tree_cons (NULL_TREE, TREE_TYPE (guard_addr), - void_list_node); - tree vfntype = build_function_type (void_type_node, argtypes); + tree vfntype = build_function_type_list (void_type_node, + TREE_TYPE (guard_addr), + NULL_TREE); acquire_fn = push_library_fn - (acquire_fn, build_function_type (integer_type_node, argtypes), + (acquire_fn, build_function_type_list (integer_type_node, + TREE_TYPE (guard_addr), + NULL_TREE), NULL_TREE); release_fn = push_library_fn (release_fn, vfntype, NULL_TREE); abort_fn = push_library_fn (abort_fn, vfntype, NULL_TREE); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 070bc3efdc3..a33751cdccf 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2725,8 +2725,8 @@ start_objects (int method_type, int initp) fndecl = build_lang_decl (FUNCTION_DECL, get_file_function_name (type), - build_function_type (void_type_node, - void_list_node)); + build_function_type_list (void_type_node, + NULL_TREE)); start_preparsed_function (fndecl, /*attrs=*/NULL_TREE, SF_PRE_PARSED); TREE_PUBLIC (current_function_decl) = 0; @@ -2818,7 +2818,6 @@ static splay_tree priority_info_map; static tree start_static_storage_duration_function (unsigned count) { - tree parm_types; tree type; tree body; char id[sizeof (SSDF_IDENTIFIER) + 1 /* '\0' */ + 32]; @@ -2827,11 +2826,9 @@ start_static_storage_duration_function (unsigned count) SSDF_IDENTIFIER_. */ sprintf (id, "%s_%u", SSDF_IDENTIFIER, count); - /* Create the parameters. */ - parm_types = void_list_node; - parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types); - parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types); - type = build_function_type (void_type_node, parm_types); + type = build_function_type_list (void_type_node, + integer_type_node, integer_type_node, + NULL_TREE); /* Create the FUNCTION_DECL itself. */ ssdf_decl = build_lang_decl (FUNCTION_DECL, diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 7be760e18c0..c682c8d8cfe 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -62,15 +62,14 @@ init_exception_processing (void) /* void std::terminate (); */ push_namespace (std_identifier); - tmp = build_function_type (void_type_node, void_list_node); + tmp = build_function_type_list (void_type_node, NULL_TREE); terminate_node = build_cp_library_fn_ptr ("terminate", tmp); TREE_THIS_VOLATILE (terminate_node) = 1; TREE_NOTHROW (terminate_node) = 1; pop_namespace (); /* void __cxa_call_unexpected(void *); */ - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = build_function_type (void_type_node, tmp); + tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); call_unexpected_node = push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp); @@ -160,8 +159,9 @@ build_exc_ptr (void) static tree declare_nothrow_library_fn (tree name, tree return_type, tree parm_type) { - tree tmp = tree_cons (NULL_TREE, parm_type, void_list_node); - return push_library_fn (name, build_function_type (return_type, tmp), + return push_library_fn (name, build_function_type_list (return_type, + parm_type, + NULL_TREE), empty_except_spec); } @@ -650,8 +650,9 @@ build_throw (tree exp) if (!get_global_value_if_present (fn, &fn)) { /* Declare void _Jv_Throw (void *). */ - tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = build_function_type (ptr_type_node, tmp); + tree tmp; + tmp = build_function_type_list (ptr_type_node, + ptr_type_node, NULL_TREE); fn = push_throw_library_fn (fn, tmp); } else if (really_overloaded_fn (fn)) @@ -675,9 +676,8 @@ build_throw (tree exp) /* The CLEANUP_TYPE is the internal type of a destructor. */ if (!cleanup_type) { - tmp = void_list_node; - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - tmp = build_function_type (void_type_node, tmp); + tmp = build_function_type_list (void_type_node, + ptr_type_node, NULL_TREE); cleanup_type = build_pointer_type (tmp); } @@ -686,11 +686,9 @@ build_throw (tree exp) { /* Declare void __cxa_throw (void*, void*, void (*)(void*)). */ /* ??? Second argument is supposed to be "std::type_info*". */ - tmp = void_list_node; - tmp = tree_cons (NULL_TREE, cleanup_type, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - tmp = build_function_type (void_type_node, tmp); + tmp = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, + cleanup_type, NULL_TREE); fn = push_throw_library_fn (fn, tmp); } @@ -808,7 +806,7 @@ build_throw (tree exp) { /* Declare void __cxa_rethrow (void). */ fn = push_throw_library_fn - (fn, build_function_type (void_type_node, void_list_node)); + (fn, build_function_type_list (void_type_node, NULL_TREE)); } /* ??? Indicate that this function call allows exceptions of the type diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 12d1784f206..dde8e825dbe 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -207,8 +207,8 @@ throw_bad_cast (void) { tree fn = get_identifier ("__cxa_bad_cast"); if (!get_global_value_if_present (fn, &fn)) - fn = push_throw_library_fn (fn, build_function_type (ptr_type_node, - void_list_node)); + fn = push_throw_library_fn (fn, build_function_type_list (ptr_type_node, + NULL_TREE)); return build_cxx_call (fn, 0, NULL); } @@ -225,7 +225,7 @@ throw_bad_typeid (void) tree t; t = build_reference_type (const_type_info_type_node); - t = build_function_type (t, void_list_node); + t = build_function_type_list (t, NULL_TREE); fn = push_throw_library_fn (fn, t); } @@ -729,12 +729,10 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain) (cp_build_qualified_type (tinfo_ptr, TYPE_QUAL_CONST)); name = "__dynamic_cast"; - tmp = tree_cons - (NULL_TREE, const_ptr_type_node, tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, ptrdiff_type_node, void_list_node)))); - tmp = build_function_type (ptr_type_node, tmp); + tmp = build_function_type_list (ptr_type_node, + const_ptr_type_node, + tinfo_ptr, tinfo_ptr, + ptrdiff_type_node, NULL_TREE); dcast_fn = build_library_fn_ptr (name, tmp); DECL_PURE_P (dcast_fn) = 1; pop_abi_namespace ();