summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-13 01:45:35 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-13 01:45:35 +0000
commit46518bf201fac97504ef5c9aae880d908f89ff79 (patch)
treed3a49132e8246b9fe0b8818a628270a745927d80 /gcc
parentfc7657e881366a7916956c40bf8c14ed6e91fda3 (diff)
downloadgcc-46518bf201fac97504ef5c9aae880d908f89ff79.tar.gz
* tree.c (build_constructor): New function.
* tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/decl.c4
-rw-r--r--gcc/ada/gigi.h5
-rw-r--r--gcc/ada/trans.c12
-rw-r--r--gcc/ada/utils.c14
-rw-r--r--gcc/ada/utils2.c10
-rw-r--r--gcc/builtins.c19
-rw-r--r--gcc/c-typeck.c10
-rw-r--r--gcc/cp/ChangeLog14
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/pt.c9
-rw-r--r--gcc/cp/rtti.c15
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/cp/typeck2.c11
-rw-r--r--gcc/f/ChangeLog9
-rw-r--r--gcc/f/com.c18
-rw-r--r--gcc/f/ste.c12
-rw-r--r--gcc/java/ChangeLog9
-rw-r--r--gcc/java/class.c22
-rw-r--r--gcc/java/constants.c7
-rw-r--r--gcc/java/java-tree.h2
-rw-r--r--gcc/java/parse.y2
-rw-r--r--gcc/objc/objc-act.c59
-rw-r--r--gcc/profile.c54
-rw-r--r--gcc/tree.c23
-rw-r--r--gcc/tree.h1
31 files changed, 228 insertions, 166 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a51bdf695c5..9ae6cf1ec14 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,10 +1,34 @@
2003-04-12 Zack Weinberg <zack@codesourcery.com>
+ * tree.c (build_constructor): New function.
+ * tree.h: Prototype it.
+
+ * c-typeck.c (build_c_cast, pop_init_level)
+ * profile.c (build_function_info_value, build_gcov_info_value)
+ (create_profiler):
+ Use build_constructor.
+
+ * builtins.c (expand_builtin_args_info): Remove #if 0 blocks.
+
+ * objc/objc-act.c (build_constructor):
+ Rename objc_build_constructor. Use build_constructor.
+ (build_objc_string_object, objc_add_static_instance)
+ (init_def_list, init_objc_symtab, init_module_descriptor)
+ (generate_static_references, build_selector_translation_table)
+ (build_descriptor_table_initializer, generate_descriptor_table)
+ (build_protocol_initializer, build_ivar_list_initializer)
+ (generate_ivars_list, build_dispatch_table_initializer)
+ (generate_dispatch_table, generate_protocol_list)
+ (build_category_initializer, build_shared_structure_initializer):
+ Update to match.
+
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
* intl.h: #define gcc_gettext_width to strlen when !ENABLE_NLS.
2003-04-12 Stephane Carrez <stcarrez@nerim.fr>
- * config/m68hc11/m68hc11-protos.h
+ * config/m68hc11/m68hc11-protos.h
(m68hc11_eq_compare_operator): Declare
* config/m68hc11/m68hc11.h (PREDICATE_CODES): Register new predicate.
* config/m68hc11/m68hc11.c (m68hc11_eq_compare_operator): New predicate
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1993f767b7b..038b18f6971 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
+ * gigi.h, utils2.c (build_constructor):
+ Rename gnat_build_constructor. Use build_constructor.
+ * decl.c (gnat_to_gnu_entity)
+ * trans.c (tree_transform, pos_to_constructor, extract_values)
+ * ada/utils.c (build_template, convert_to_fat_pointer, convert)
+ (unchecked_convert)
+ * ada/utils2.c (build_binary_op, build_call_raise, build_allocator)
+ (fill_vms_descriptor):
+ Update to match.
+
2003-04-06 Zack Weinberg <zack@codesourcery.com>
* ada-tree.def: Make fourth element for GNAT_LOOP_ID zero.
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index adf648111b3..1225ba169a5 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -812,7 +812,7 @@ gnat_to_gnu_entity (gnat_entity, gnu_expr, definition)
&& TYPE_CONTAINS_TEMPLATE_P (gnu_type)
&& gnu_expr == 0)
gnu_expr
- = build_constructor
+ = gnat_build_constructor
(gnu_type,
tree_cons
(TYPE_FIELDS (gnu_type),
@@ -957,7 +957,7 @@ gnat_to_gnu_entity (gnat_entity, gnu_expr, definition)
if (gnu_expr != 0)
gnu_expr
- = build_constructor (gnu_new_type,
+ = gnat_build_constructor (gnu_new_type,
tree_cons (TYPE_FIELDS (gnu_new_type),
gnu_expr, NULL_TREE));
set_lineno (gnat_entity, 1);
diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h
index a91b98ced6e..4094f4902f8 100644
--- a/gcc/ada/gigi.h
+++ b/gcc/ada/gigi.h
@@ -691,8 +691,9 @@ extern tree build_call_0_expr PARAMS((tree));
name, if requested. MSG says which exception function to call. */
extern tree build_call_raise PARAMS((int));
-/* Return a CONSTRUCTOR of TYPE whose list is LIST. */
-extern tree build_constructor PARAMS((tree, tree));
+/* Return a CONSTRUCTOR of TYPE whose list is LIST. This is not the
+ same as build_constructor in the language-independent tree.c. */
+extern tree gnat_build_constructor PARAMS((tree, tree));
/* Return a COMPONENT_REF to access a field that is given by COMPONENT,
an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL,
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c
index 68bb09ed4e9..4155eecfd6e 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/trans.c
@@ -647,7 +647,7 @@ tree_transform (gnat_node)
gnu_list);
gnu_result
- = build_constructor (gnu_result_type, nreverse (gnu_list));
+ = gnat_build_constructor (gnu_result_type, nreverse (gnu_list));
}
break;
@@ -1620,7 +1620,7 @@ tree_transform (gnat_node)
= TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_result_type)));
if (Null_Record_Present (gnat_node))
- gnu_result = build_constructor (gnu_aggr_type, NULL_TREE);
+ gnu_result = gnat_build_constructor (gnu_aggr_type, NULL_TREE);
else if (TREE_CODE (gnu_aggr_type) == RECORD_TYPE)
gnu_result
@@ -2454,7 +2454,7 @@ tree_transform (gnat_node)
gnu_ret_val = TREE_VALUE (TYPE_CI_CO_LIST (gnu_subprog_type));
else
gnu_ret_val
- = build_constructor (TREE_TYPE (gnu_subprog_type),
+ = gnat_build_constructor (TREE_TYPE (gnu_subprog_type),
TYPE_CI_CO_LIST (gnu_subprog_type));
}
@@ -2696,7 +2696,7 @@ tree_transform (gnat_node)
if (list_length (gnu_cico_list) == 1)
gnu_retval = TREE_VALUE (gnu_cico_list);
else
- gnu_retval = build_constructor (TREE_TYPE (gnu_subprog_type),
+ gnu_retval = gnat_build_constructor (TREE_TYPE (gnu_subprog_type),
gnu_cico_list);
if (DECL_P (gnu_retval) && DECL_BY_REF_P (gnu_retval))
@@ -5011,7 +5011,7 @@ pos_to_constructor (gnat_expr, gnu_array_type, gnat_component_type)
gnu_expr_list);
}
- return build_constructor (gnu_array_type, nreverse (gnu_expr_list));
+ return gnat_build_constructor (gnu_array_type, nreverse (gnu_expr_list));
}
/* Subroutine of assoc_to_constructor: VALUES is a list of field associations,
@@ -5062,7 +5062,7 @@ extract_values (values, record_type)
result = tree_cons (field, value, result);
}
- return build_constructor (record_type, nreverse (result));
+ return gnat_build_constructor (record_type, nreverse (result));
}
/* EXP is to be treated as an array or record. Handle the cases when it is
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index a5d2860652f..fa58936a53e 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -2206,7 +2206,7 @@ build_template (template_type, array_type, expr)
tree_cons (field, min, template_elts));
}
- return build_constructor (template_type, nreverse (template_elts));
+ return gnat_build_constructor (template_type, nreverse (template_elts));
}
/* Build a VMS descriptor from a Mechanism_Type, which must specify
@@ -2681,7 +2681,7 @@ convert_to_fat_pointer (type, expr)
pointer to the template and array. */
if (integer_zerop (expr))
return
- build_constructor
+ gnat_build_constructor
(type,
tree_cons (TYPE_FIELDS (type),
convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
@@ -2715,7 +2715,7 @@ convert_to_fat_pointer (type, expr)
/* The result is a CONSTRUCTOR for the fat pointer. */
return
- build_constructor (type,
+ gnat_build_constructor (type,
tree_cons (TYPE_FIELDS (type), expr,
tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
template_addr, NULL_TREE)));
@@ -2818,7 +2818,7 @@ convert (type, expr)
else
return
- build_constructor (type,
+ gnat_build_constructor (type,
tree_cons (TYPE_FIELDS (type),
convert (TREE_TYPE
(TYPE_FIELDS (type)),
@@ -2849,7 +2849,7 @@ convert (type, expr)
tree obj_type = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (type)));
return
- build_constructor
+ gnat_build_constructor
(type,
tree_cons (TYPE_FIELDS (type),
build_template (TREE_TYPE (TYPE_FIELDS (type)),
@@ -3017,7 +3017,7 @@ convert (type, expr)
case RECORD_TYPE:
if (TYPE_LEFT_JUSTIFIED_MODULAR_P (type) && ! AGGREGATE_TYPE_P (etype))
return
- build_constructor
+ gnat_build_constructor
(type, tree_cons (TYPE_FIELDS (type),
convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
NULL_TREE));
@@ -3263,7 +3263,7 @@ unchecked_convert (type, expr)
TYPE_FIELDS (rec_type) = field;
layout_type (rec_type);
- expr = build_constructor (rec_type, build_tree_list (field, expr));
+ expr = gnat_build_constructor (rec_type, build_tree_list (field, expr));
expr = unchecked_convert (type, expr);
}
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index 131aeec4d7e..21d32f9cc6e 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -929,7 +929,7 @@ build_binary_op (op_code, result_type, left_operand, right_operand)
just compare the data pointer. */
else if (TYPE_FAT_POINTER_P (left_base_type)
&& TREE_CODE (right_operand) == CONSTRUCTOR
- && integer_zerop (TREE_VALUE (TREE_OPERAND (right_operand, 1))))
+ && integer_zerop (TREE_VALUE (CONSTRUCTOR_ELTS (right_operand))))
{
right_operand = build_component_ref (left_operand, NULL_TREE,
TYPE_FIELDS (left_base_type));
@@ -1514,7 +1514,7 @@ build_call_raise (msg)
/* Return a CONSTRUCTOR of TYPE whose list is LIST. */
tree
-build_constructor (type, list)
+gnat_build_constructor (type, list)
tree type;
tree list;
{
@@ -1566,7 +1566,7 @@ build_constructor (type, list)
}
}
- result = build (CONSTRUCTOR, type, NULL_TREE, list);
+ result = build_constructor (type, list);
TREE_CONSTANT (result) = allconstant;
TREE_STATIC (result) = allconstant;
TREE_SIDE_EFFECTS (result) = side_effects;
@@ -1896,7 +1896,7 @@ build_allocator (type, init, result_type, gnat_proc, gnat_pool)
(MODIFY_EXPR, storage_type,
build_unary_op (INDIRECT_REF, NULL_TREE,
convert (storage_ptr_type, storage)),
- build_constructor (storage_type, template_cons)),
+ gnat_build_constructor (storage_type, template_cons)),
convert (storage_ptr_type, storage)));
}
else
@@ -2008,7 +2008,7 @@ fill_vms_descriptor (expr, gnat_formal)
const_list);
}
- return build_constructor (record_type, nreverse (const_list));
+ return gnat_build_constructor (record_type, nreverse (const_list));
}
/* Indicate that we need to make the address of EXPR_NODE and it therefore
diff --git a/gcc/builtins.c b/gcc/builtins.c
index ee2d57990d4..667de5f3b39 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3212,11 +3212,6 @@ expand_builtin_args_info (exp)
tree arglist = TREE_OPERAND (exp, 1);
int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int);
int *word_ptr = (int *) &current_function_args_info;
-#if 0
- /* These are used by the code below that is if 0'ed away */
- int i;
- tree type, elts, result;
-#endif
if (sizeof (CUMULATIVE_ARGS) % sizeof (int) != 0)
abort ();
@@ -3239,20 +3234,6 @@ expand_builtin_args_info (exp)
error ("missing argument in `__builtin_args_info'");
return const0_rtx;
-
-#if 0
- for (i = 0; i < nwords; i++)
- elts = tree_cons (NULL_TREE, build_int_2 (word_ptr[i], 0));
-
- type = build_array_type (integer_type_node,
- build_index_type (build_int_2 (nwords, 0)));
- result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (elts));
- TREE_CONSTANT (result) = 1;
- TREE_STATIC (result) = 1;
- result = build1 (INDIRECT_REF, build_pointer_type (type), result);
- TREE_CONSTANT (result) = 1;
- return expand_expr (result, NULL_RTX, VOIDmode, 0);
-#endif
}
/* Expand ARGLIST, from a call to __builtin_next_arg. */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index ec9418bdc84..aa58bea7750 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -3660,8 +3660,10 @@ build_c_cast (type, expr)
if (pedantic)
pedwarn ("ISO C forbids casts to union type");
- t = digest_init (type, build (CONSTRUCTOR, type, NULL_TREE,
- build_tree_list (field, value)), 0);
+ t = digest_init (type,
+ build_constructor (type,
+ build_tree_list (field, value)),
+ 0);
TREE_CONSTANT (t) = TREE_CONSTANT (value);
return t;
}
@@ -5569,8 +5571,8 @@ pop_init_level (implicit)
constructor = error_mark_node;
else
{
- constructor = build (CONSTRUCTOR, constructor_type, NULL_TREE,
- nreverse (constructor_elements));
+ constructor = build_constructor (constructor_type,
+ nreverse (constructor_elements));
if (constructor_constant)
TREE_CONSTANT (constructor) = 1;
if (constructor_constant && constructor_simple)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b13649d131..40a2810f152 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,19 @@
2003-04-12 Zack Weinberg <zack@codesourcery.com>
+ * class.c (initialize_array)
+ * decl.c (reshape_init)
+ * decl2.c (build_expr_from_tree)
+ * init.c (build_zero_init)
+ * pt.c (tsubst_copy, tsubst_copy_and_build)
+ * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer)
+ (ptm_initializer, class_initializer, get_pseudo_ti_init)
+ * semantics.c (finish_compound_literal)
+ * typeck.c (build_ptrmemfunc1)
+ * typeck2.c (store_init_value, process_init_constructor)
+ (build_functional_cast): Use build_constructor.
+
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
* call.c (print_z_candidates): Use gcc_gettext_width, not
strlen, to determine how much padding to use.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index ed0824a1c0e..382519e7528 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6843,7 +6843,7 @@ initialize_array (tree decl, tree inits)
context = DECL_CONTEXT (decl);
DECL_CONTEXT (decl) = NULL_TREE;
- DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, inits);
+ DECL_INITIAL (decl) = build_constructor (NULL_TREE, inits);
TREE_HAS_CONSTRUCTOR (DECL_INITIAL (decl)) = 1;
cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0);
DECL_CONTEXT (decl) = context;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 28d1493f883..f5ee1a36c29 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7520,7 +7520,7 @@ reshape_init (tree type, tree *initp)
else
{
/* Build a CONSTRUCTOR to hold the contents of the aggregate. */
- new_init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ new_init = build_constructor (type, NULL_TREE);
TREE_HAS_CONSTRUCTOR (new_init) = 1;
if (CLASS_TYPE_P (type))
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 0f8617c141f..57050d782af 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3272,7 +3272,7 @@ build_expr_from_tree (t)
r = tree_cons (purpose, value, r);
}
- r = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (r));
+ r = build_constructor (NULL_TREE, nreverse (r));
TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
if (type)
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index d8542831f8a..3083412786e 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -204,7 +204,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
tree inits;
/* Build a constructor to contain the initializations. */
- init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ init = build_constructor (type, NULL_TREE);
/* Iterate over the fields, building initializations. */
inits = NULL_TREE;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
@@ -236,7 +236,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
tree inits;
/* Build a constructor to contain the initializations. */
- init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ init = build_constructor (type, NULL_TREE);
/* Iterate over the array elements, building initializations. */
inits = NULL_TREE;
max_index = nelts ? nelts : array_type_nelts (type);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b37332953ef..c8e7c4089e2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7534,10 +7534,9 @@ tsubst_copy (t, args, complain, in_decl)
case CONSTRUCTOR:
{
- r = build
- (CONSTRUCTOR, tsubst (TREE_TYPE (t), args, complain, in_decl),
- NULL_TREE, tsubst_copy (CONSTRUCTOR_ELTS (t), args,
- complain, in_decl));
+ r = build_constructor
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ tsubst_copy (CONSTRUCTOR_ELTS (t), args, complain, in_decl));
TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
return r;
}
@@ -8348,7 +8347,7 @@ tsubst_copy_and_build (t, args, complain, in_decl)
r = tree_cons (purpose, value, r);
}
- r = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (r));
+ r = build_constructor (NULL_TREE, nreverse (r));
TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
if (type)
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 24ba0fd9b02..8283acb7f46 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -811,7 +811,7 @@ tinfo_base_init (tree desc, tree target)
init = tree_cons (NULL_TREE, decay_conversion (name_decl), init);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
init = tree_cons (NULL_TREE, init, NULL_TREE);
@@ -827,7 +827,7 @@ generic_initializer (tree desc, tree target)
{
tree init = tinfo_base_init (desc, target);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
+ init = build_constructor (NULL_TREE, init);
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -854,7 +854,7 @@ ptr_initializer (tree desc, tree target, bool *non_public_ptr)
get_tinfo_ptr (TYPE_MAIN_VARIANT (to)),
init);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -891,7 +891,7 @@ ptm_initializer (tree desc, tree target, bool *non_public_ptr)
get_tinfo_ptr (klass),
init);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -959,7 +959,7 @@ class_initializer (tree desc, tree target, tree trail)
tree init = tinfo_base_init (desc, target);
TREE_CHAIN (init) = trail;
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
+ init = build_constructor (NULL_TREE, init);
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -1078,12 +1078,11 @@ get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p)
build_int_2 (flags, 0));
base_init = tree_cons (NULL_TREE, offset, base_init);
base_init = tree_cons (NULL_TREE, tinfo, base_init);
- base_init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, base_init);
+ base_init = build_constructor (NULL_TREE, base_init);
TREE_HAS_CONSTRUCTOR (base_init) = 1;
base_inits = tree_cons (NULL_TREE, base_init, base_inits);
}
- base_inits = build (CONSTRUCTOR,
- NULL_TREE, NULL_TREE, base_inits);
+ base_inits = build_constructor (NULL_TREE, base_inits);
TREE_HAS_CONSTRUCTOR (base_inits) = 1;
base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE);
/* Prepend the number of bases. */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index a5b7c503980..7c7af3e8399 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1600,8 +1600,7 @@ finish_compound_literal (type, initializer_list)
tree compound_literal;
/* Build a CONSTRUCTOR for the INITIALIZER_LIST. */
- compound_literal = build_nt (CONSTRUCTOR, NULL_TREE,
- initializer_list);
+ compound_literal = build_constructor (NULL_TREE, initializer_list);
/* Mark it as a compound-literal. */
TREE_HAS_CONSTRUCTOR (compound_literal) = 1;
if (processing_template_decl)
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 45d528ffb13..8e2682f7f93 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5781,7 +5781,7 @@ build_ptrmemfunc1 (type, delta, pfn)
/* Finish creating the initializer. */
u = tree_cons (pfn_field, pfn,
build_tree_list (delta_field, delta));
- u = build (CONSTRUCTOR, type, NULL_TREE, u);
+ u = build_constructor (type, u);
TREE_CONSTANT (u) = TREE_CONSTANT (pfn) && TREE_CONSTANT (delta);
TREE_STATIC (u) = (TREE_CONSTANT (u)
&& (initializer_constant_valid_p (pfn, TREE_TYPE (pfn))
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index c4540481454..2df882a1db3 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -336,7 +336,7 @@ store_init_value (decl, init)
if (TREE_CODE (init) == TREE_LIST)
{
error ("constructor syntax used, but no constructor declared for type `%T'", type);
- init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
}
}
else if (TREE_CODE (init) == TREE_LIST
@@ -704,7 +704,7 @@ process_init_constructor (type, init, elts)
if (IS_AGGR_TYPE (TREE_TYPE (type)))
next1 = build_functional_cast (TREE_TYPE (type), NULL_TREE);
else
- next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, NULL_TREE);
+ next1 = build_constructor (NULL_TREE, NULL_TREE);
next1 = digest_init (TREE_TYPE (type), next1, 0);
}
else if (! zero_init_p (TREE_TYPE (type)))
@@ -797,8 +797,7 @@ process_init_constructor (type, init, elts)
NULL_TREE);
else
{
- next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE,
- NULL_TREE);
+ next1 = build_constructor (NULL_TREE, NULL_TREE);
if (init)
TREE_HAS_CONSTRUCTOR (next1)
= TREE_HAS_CONSTRUCTOR (init);
@@ -926,7 +925,7 @@ process_init_constructor (type, init, elts)
if (erroneous)
return error_mark_node;
- result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (members));
+ result = build_constructor (type, nreverse (members));
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE)
complete_array_type (type, result, /*do_default=*/0);
if (init)
@@ -1232,7 +1231,7 @@ build_functional_cast (exp, parms)
if (parms == NULL_TREE && !TYPE_NEEDS_CONSTRUCTING (type)
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
{
- exp = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ exp = build_constructor (type, NULL_TREE);
return get_target_expr (exp);
}
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index d6ff7194b19..fc712ff0701 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,12 @@
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
+ * com.c (ffecom_build_complex_constant_, ffecom_expr_)
+ (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_)
+ (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2)
+ * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_)
+ (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_):
+ Use build_constructor.
+
2003-04-11 Bud Davis <bdavis9659@comcast.net>
PR Fortran/9263
diff --git a/gcc/f/com.c b/gcc/f/com.c
index b63e2eac9d6..1ccaeb20dce 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -1287,7 +1287,7 @@ ffecom_build_complex_constant_ (tree type, tree realpart, tree imagpart)
{
bothparts = build_tree_list (TYPE_FIELDS (type), realpart);
TREE_CHAIN (bothparts) = build_tree_list (TREE_CHAIN (TYPE_FIELDS (type)), imagpart);
- bothparts = build (CONSTRUCTOR, type, NULL_TREE, bothparts);
+ bothparts = build_constructor (type, bothparts);
}
else
{
@@ -3027,7 +3027,7 @@ ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest,
build_range_type (ffecom_integer_type_node,
ffecom_integer_zero_node,
item));
- list = build (CONSTRUCTOR, item, NULL_TREE, list);
+ list = build_constructor (item, list);
TREE_CONSTANT (list) = 1;
TREE_STATIC (list) = 1;
return list;
@@ -3075,7 +3075,7 @@ ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest,
build_range_type (ffecom_integer_type_node,
ffecom_integer_zero_node,
item));
- list = build (CONSTRUCTOR, item, NULL_TREE, list);
+ list = build_constructor (item, list);
TREE_CONSTANT (list) = 1;
TREE_STATIC (list) = 1;
return list;
@@ -6302,7 +6302,7 @@ ffecom_init_zero_ (tree decl)
init = convert (type, integer_zero_node);
else if (!incremental)
{
- init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ init = build_constructor (type, NULL_TREE);
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
}
@@ -8761,7 +8761,7 @@ ffecom_transform_namelist_ (ffesymbol s)
TREE_CHAIN (TREE_CHAIN (nmlinits))
= build_tree_list ((field = TREE_CHAIN (field)), nvarsinit);
- nmlinits = build (CONSTRUCTOR, nmltype, NULL_TREE, nmlinits);
+ nmlinits = build_constructor (nmltype, nmlinits);
TREE_CONSTANT (nmlinits) = 1;
TREE_STATIC (nmlinits) = 1;
@@ -9296,7 +9296,7 @@ ffecom_vardesc_ (ffebld expr)
TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (varinits)))
= build_tree_list ((field = TREE_CHAIN (field)), typeinit);
- varinits = build (CONSTRUCTOR, vardesctype, NULL_TREE, varinits);
+ varinits = build_constructor (vardesctype, varinits);
TREE_CONSTANT (varinits) = 1;
TREE_STATIC (varinits) = 1;
@@ -9341,7 +9341,7 @@ ffecom_vardesc_array_ (ffesymbol s)
build_range_type (integer_type_node,
integer_one_node,
build_int_2 (i, 0)));
- list = build (CONSTRUCTOR, item, NULL_TREE, list);
+ list = build_constructor (item, list);
TREE_CONSTANT (list) = 1;
TREE_STATIC (list) = 1;
@@ -9447,7 +9447,7 @@ ffecom_vardesc_dims_ (ffesymbol s)
build_int_2
((int) ffesymbol_rank (s)
+ 2, 0)));
- list = build (CONSTRUCTOR, item, NULL_TREE, numdim);
+ list = build_constructor (item, numdim);
TREE_CONSTANT (list) = 1;
TREE_STATIC (list) = 1;
@@ -9582,7 +9582,7 @@ ffecom_2 (enum tree_code code, tree type, tree node1,
case COMPLEX_EXPR:
item = build_tree_list (TYPE_FIELDS (type), node1);
TREE_CHAIN (item) = build_tree_list (TREE_CHAIN (TYPE_FIELDS (type)), node2);
- item = build (CONSTRUCTOR, type, NULL_TREE, item);
+ item = build_constructor (type, item);
break;
case PLUS_EXPR:
diff --git a/gcc/f/ste.c b/gcc/f/ste.c
index 7d625cb6159..a1f355b7b17 100644
--- a/gcc/f/ste.c
+++ b/gcc/f/ste.c
@@ -1231,7 +1231,7 @@ ffeste_io_ialist_ (bool have_err,
initn = inits;
ffeste_f2c_init_next_ (unitinit);
- inits = build (CONSTRUCTOR, f2c_alist_struct, NULL_TREE, inits);
+ inits = build_constructor (f2c_alist_struct, inits);
TREE_CONSTANT (inits) = constantp ? 1 : 0;
TREE_STATIC (inits) = 1;
@@ -1434,7 +1434,7 @@ ffeste_io_cilist_ (bool have_err,
ffeste_f2c_init_next_ (formatinit);
ffeste_f2c_init_next_ (recinit);
- inits = build (CONSTRUCTOR, f2c_cilist_struct, NULL_TREE, inits);
+ inits = build_constructor (f2c_cilist_struct, inits);
TREE_CONSTANT (inits) = constantp ? 1 : 0;
TREE_STATIC (inits) = 1;
@@ -1561,7 +1561,7 @@ ffeste_io_cllist_ (bool have_err,
ffeste_f2c_init_next_ (unitinit);
ffeste_f2c_init_next_ (statinit);
- inits = build (CONSTRUCTOR, f2c_close_struct, NULL_TREE, inits);
+ inits = build_constructor (f2c_close_struct, inits);
TREE_CONSTANT (inits) = constantp ? 1 : 0;
TREE_STATIC (inits) = 1;
@@ -1766,7 +1766,7 @@ ffeste_io_icilist_ (bool have_err,
ffeste_f2c_init_next_ (unitleninit);
ffeste_f2c_init_next_ (unitnuminit);
- inits = build (CONSTRUCTOR, f2c_icilist_struct, NULL_TREE, inits);
+ inits = build_constructor (f2c_icilist_struct, inits);
TREE_CONSTANT (inits) = constantp ? 1 : 0;
TREE_STATIC (inits) = 1;
@@ -2013,7 +2013,7 @@ ffeste_io_inlist_ (bool have_err,
ffeste_f2c_init_next_ (blankinit);
ffeste_f2c_init_next_ (blankleninit);
- inits = build (CONSTRUCTOR, f2c_inquire_struct, NULL_TREE, inits);
+ inits = build_constructor (f2c_inquire_struct, inits);
TREE_CONSTANT (inits) = constantp ? 1 : 0;
TREE_STATIC (inits) = 1;
@@ -2189,7 +2189,7 @@ ffeste_io_olist_ (bool have_err,
ffeste_f2c_init_next_ (reclinit);
ffeste_f2c_init_next_ (blankinit);
- inits = build (CONSTRUCTOR, f2c_open_struct, NULL_TREE, inits);
+ inits = build_constructor (f2c_open_struct, inits);
TREE_CONSTANT (inits) = constantp ? 1 : 0;
TREE_STATIC (inits) = 1;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index fe99c0a3450..4ee59ee6726 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,12 @@
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
+ * class.c (make_field_value, make_method_value, get_dispatch_table)
+ (make_class_data, emit_offset_symbol_table)
+ * constants.c (build_constants_constructor)
+ * java-tree.h (START_RECORD_CONSTRUCTOR)
+ * parse.y (maybe_build_array_element_wfl):
+ Use build_constructor.
+
2003-04-10 Eric Blake <ebb9@email.byu.edu>
PR java/10253:
diff --git a/gcc/java/class.c b/gcc/java/class.c
index f121f0e95c5..fff42473cd0 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1076,7 +1076,7 @@ make_field_value (tree fdecl)
PUSH_FIELD_VALUE
(finit, "info",
- build (CONSTRUCTOR, field_info_union_node, NULL_TREE,
+ build_constructor (field_info_union_node,
build_tree_list
((FIELD_STATIC (fdecl)
? TREE_CHAIN (TYPE_FIELDS (field_info_union_node))
@@ -1145,7 +1145,7 @@ make_method_value (tree mdecl)
table = tree_cons (NULL_TREE, utf8, table);
}
type = build_prim_array_type (ptr_type_node, length);
- table = build (CONSTRUCTOR, type, NULL_TREE, table);
+ table = build_constructor (type, table);
/* Compute something unique enough. */
sprintf (buf, "_methods%d", method_name_count++);
array = build_decl (VAR_DECL, get_identifier (buf), type);
@@ -1267,9 +1267,8 @@ get_dispatch_table (tree type, tree this_class_addr)
if (TARGET_VTABLE_USES_DESCRIPTORS)
arraysize *= TARGET_VTABLE_USES_DESCRIPTORS;
arraysize += 2;
- return build (CONSTRUCTOR,
- build_prim_array_type (nativecode_ptr_type_node, arraysize),
- NULL_TREE, list);
+ return build_constructor (build_prim_array_type (nativecode_ptr_type_node,
+ arraysize), list);
}
static int
@@ -1352,8 +1351,8 @@ make_class_data (tree type)
field_array_type = build_prim_array_type (field_type_node, field_count);
fields_decl = build_decl (VAR_DECL, mangled_classname ("_FL_", type),
field_array_type);
- DECL_INITIAL (fields_decl) = build (CONSTRUCTOR, field_array_type,
- NULL_TREE, static_fields);
+ DECL_INITIAL (fields_decl) = build_constructor (field_array_type,
+ static_fields);
TREE_STATIC (fields_decl) = 1;
DECL_ARTIFICIAL (fields_decl) = 1;
DECL_IGNORED_P (fields_decl) = 1;
@@ -1378,8 +1377,8 @@ make_class_data (tree type)
method_array_type = build_prim_array_type (method_type_node, method_count);
methods_decl = build_decl (VAR_DECL, mangled_classname ("_MT_", type),
method_array_type);
- DECL_INITIAL (methods_decl) = build (CONSTRUCTOR, method_array_type,
- NULL_TREE, nreverse (methods));
+ DECL_INITIAL (methods_decl) = build_constructor (method_array_type,
+ nreverse (methods));
TREE_STATIC (methods_decl) = 1;
DECL_ARTIFICIAL (methods_decl) = 1;
DECL_IGNORED_P (methods_decl) = 1;
@@ -1451,8 +1450,7 @@ make_class_data (tree type)
}
init = tree_cons (NULL_TREE, index, init);
}
- DECL_INITIAL (idecl) = build (CONSTRUCTOR, interface_array_type,
- NULL_TREE, init);
+ DECL_INITIAL (idecl) = build_constructor (interface_array_type, init);
TREE_STATIC (idecl) = 1;
DECL_ARTIFICIAL (idecl) = 1;
DECL_IGNORED_P (idecl) = 1;
@@ -2099,7 +2097,7 @@ emit_offset_symbol_table (void)
/* Put the list in the right order and make it a constructor. */
list = nreverse (list);
- table = build (CONSTRUCTOR, method_symbols_array_type, NULL_TREE, list);
+ table = build_constructor (method_symbols_array_type, list);
/* Make it the initial value for otable_syms and emit the decl. */
DECL_INITIAL (otable_syms_decl) = table;
diff --git a/gcc/java/constants.c b/gcc/java/constants.c
index 1a56df06461..274a8bfd91b 100644
--- a/gcc/java/constants.c
+++ b/gcc/java/constants.c
@@ -442,8 +442,8 @@ build_constants_constructor (void)
data_decl = TREE_OPERAND (build_constant_data_ref (), 0);
TREE_TYPE (data_decl) = build_array_type (ptr_type_node, index_type),
- DECL_INITIAL (data_decl) = build (CONSTRUCTOR, TREE_TYPE (data_decl),
- NULL_TREE, data_list);
+ DECL_INITIAL (data_decl) = build_constructor (TREE_TYPE (data_decl),
+ data_list);
DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
DECL_SIZE_UNIT (data_decl) = TYPE_SIZE_UNIT (TREE_TYPE (data_decl));
rest_of_decl_compilation (data_decl, (char *) 0, 1, 0);
@@ -454,8 +454,7 @@ build_constants_constructor (void)
current_class),
tags_type);
TREE_STATIC (tags_decl) = 1;
- DECL_INITIAL (tags_decl) = build (CONSTRUCTOR, tags_type,
- NULL_TREE, tags_list);
+ DECL_INITIAL (tags_decl) = build_constructor (tags_type, tags_list);
rest_of_decl_compilation (tags_decl, (char*) 0, 1, 0);
tags_value = build_address_of (tags_decl);
}
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index adfd77eee46..62d2452861e 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -1650,7 +1650,7 @@ extern tree *type_map;
/* Start building a RECORD_TYPE constructor with a given TYPE in CONS. */
#define START_RECORD_CONSTRUCTOR(CONS, CTYPE) { \
- CONS = build (CONSTRUCTOR, CTYPE, NULL_TREE, NULL_TREE);\
+ CONS = build_constructor (CTYPE, NULL_TREE);\
TREE_CHAIN(CONS) = TYPE_FIELDS (CTYPE); }
/* Append a field initializer to CONS for the dummy field for the inherited
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index b5808d4cebb..df60f9e2210 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -14499,7 +14499,7 @@ maybe_build_array_element_wfl (tree node)
static tree
build_new_array_init (int location, tree values)
{
- tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
+ tree constructor = build_constructor (NULL_TREE, values);
tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
EXPR_WFL_LINECOL (to_return) = location;
return to_return;
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index b9ac3150c1e..36badee5884 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -124,7 +124,7 @@ static void finish_objc PARAMS ((void));
/* Code generation. */
static void synth_module_prologue PARAMS ((void));
-static tree build_constructor PARAMS ((tree, tree));
+static tree objc_build_constructor PARAMS ((tree, tree));
static rtx build_module_descriptor PARAMS ((void));
static tree init_module_descriptor PARAMS ((tree));
static tree build_objc_method_call PARAMS ((int, tree, tree,
@@ -1346,7 +1346,8 @@ build_objc_string_object (strings)
= tree_cons (NULL_TREE, copy_node (build_unary_op (ADDR_EXPR, string, 1)),
initlist);
initlist = tree_cons (NULL_TREE, build_int_2 (length, 0), initlist);
- constructor = build_constructor (constant_string_type, nreverse (initlist));
+ constructor = objc_build_constructor (constant_string_type,
+ nreverse (initlist));
if (!flag_next_runtime)
{
@@ -1401,7 +1402,7 @@ objc_add_static_instance (constructor, class_decl)
with type TYPE and elements ELTS. */
static tree
-build_constructor (type, elts)
+objc_build_constructor (type, elts)
tree type, elts;
{
tree constructor, f, e;
@@ -1424,7 +1425,7 @@ build_constructor (type, elts)
TREE_VALUE (e) = convert (TREE_TYPE (f), TREE_VALUE (e));
}
- constructor = build (CONSTRUCTOR, type, NULL_TREE, elts);
+ constructor = build_constructor (type, elts);
TREE_CONSTANT (constructor) = 1;
TREE_STATIC (constructor) = 1;
TREE_READONLY (constructor) = 1;
@@ -1540,7 +1541,7 @@ init_def_list (type)
initlist = tree_cons (NULL_TREE, expr, initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* Construct the initial value for all of _objc_symtab. */
@@ -1585,7 +1586,7 @@ init_objc_symtab (type)
initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* Push forward-declarations of all the categories so that
@@ -1674,7 +1675,7 @@ init_module_descriptor (type)
expr = build_int_2 (0, 0);
initlist = tree_cons (NULL_TREE, expr, initlist);
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* Write out the data structures to describe Objective C classes defined.
@@ -1898,7 +1899,7 @@ generate_static_references ()
/* Output {..., NULL}. */
initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- expr = build_constructor (TREE_TYPE (decl), nreverse (initlist));
+ expr = objc_build_constructor (TREE_TYPE (decl), nreverse (initlist));
finish_decl (decl, expr, NULL_TREE);
TREE_USED (decl) = 1;
@@ -1921,7 +1922,7 @@ generate_static_references ()
TREE_USED (static_instances_decl) = 1;
DECL_CONTEXT (static_instances_decl) = 0;
DECL_ARTIFICIAL (static_instances_decl) = 1;
- expr = build_constructor (TREE_TYPE (static_instances_decl),
+ expr = objc_build_constructor (TREE_TYPE (static_instances_decl),
nreverse (decls));
finish_decl (static_instances_decl, expr, NULL_TREE);
}
@@ -2088,8 +2089,8 @@ build_selector_translation_table ()
tree encoding = get_proto_encoding (TREE_PURPOSE (chain));
eltlist = tree_cons (NULL_TREE, expr, NULL_TREE);
eltlist = tree_cons (NULL_TREE, encoding, eltlist);
- expr = build_constructor (objc_selector_template,
- nreverse (eltlist));
+ expr = objc_build_constructor (objc_selector_template,
+ nreverse (eltlist));
}
initlist = tree_cons (NULL_TREE, expr, initlist);
@@ -2104,8 +2105,8 @@ build_selector_translation_table ()
/* NULL terminate the list and fix the decl for output. */
initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
DECL_INITIAL (UOBJC_SELECTOR_TABLE_decl) = objc_ellipsis_node;
- initlist = build_constructor (TREE_TYPE (UOBJC_SELECTOR_TABLE_decl),
- nreverse (initlist));
+ initlist = objc_build_constructor (TREE_TYPE (UOBJC_SELECTOR_TABLE_decl),
+ nreverse (initlist));
finish_decl (UOBJC_SELECTOR_TABLE_decl, initlist, NULL_TREE);
current_function_decl = NULL_TREE;
}
@@ -2636,13 +2637,15 @@ build_descriptor_table_initializer (type, entries)
initlist
= tree_cons (NULL_TREE,
- build_constructor (type, nreverse (eltlist)), initlist);
+ objc_build_constructor (type, nreverse (eltlist)),
+ initlist);
entries = TREE_CHAIN (entries);
}
while (entries);
- return build_constructor (build_array_type (type, 0), nreverse (initlist));
+ return objc_build_constructor (build_array_type (type, 0),
+ nreverse (initlist));
}
/* struct objc_method_prototype_list {
@@ -2857,7 +2860,7 @@ generate_descriptor_table (type, name, size, list, proto)
initlist = build_tree_list (NULL_TREE, build_int_2 (size, 0));
initlist = tree_cons (NULL_TREE, list, initlist);
- finish_decl (decl, build_constructor (type, nreverse (initlist)),
+ finish_decl (decl, objc_build_constructor (type, nreverse (initlist)),
NULL_TREE);
return decl;
@@ -3223,7 +3226,7 @@ build_protocol_initializer (type, protocol_name, protocol_list,
initlist = tree_cons (NULL_TREE, expr, initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* struct objc_category {
@@ -3823,14 +3826,15 @@ build_ivar_list_initializer (type, field_decl)
/* Set offset. */
ivar = tree_cons (NULL_TREE, byte_position (field_decl), ivar);
initlist = tree_cons (NULL_TREE,
- build_constructor (type, nreverse (ivar)),
+ objc_build_constructor (type, nreverse (ivar)),
initlist);
field_decl = TREE_CHAIN (field_decl);
}
while (field_decl);
- return build_constructor (build_array_type (type, 0), nreverse (initlist));
+ return objc_build_constructor (build_array_type (type, 0),
+ nreverse (initlist));
}
static tree
@@ -3852,7 +3856,7 @@ generate_ivars_list (type, name, size, list)
initlist = tree_cons (NULL_TREE, list, initlist);
finish_decl (decl,
- build_constructor (TREE_TYPE (decl), nreverse (initlist)),
+ objc_build_constructor (TREE_TYPE (decl), nreverse (initlist)),
NULL_TREE);
return decl;
@@ -3945,14 +3949,15 @@ build_dispatch_table_initializer (type, entries)
elemlist);
initlist = tree_cons (NULL_TREE,
- build_constructor (type, nreverse (elemlist)),
+ objc_build_constructor (type, nreverse (elemlist)),
initlist);
entries = TREE_CHAIN (entries);
}
while (entries);
- return build_constructor (build_array_type (type, 0), nreverse (initlist));
+ return objc_build_constructor (build_array_type (type, 0),
+ nreverse (initlist));
}
/* To accomplish method prototyping without generating all kinds of
@@ -4023,7 +4028,7 @@ generate_dispatch_table (type, name, size, list)
initlist = tree_cons (NULL_TREE, list, initlist);
finish_decl (decl,
- build_constructor (TREE_TYPE (decl), nreverse (initlist)),
+ objc_build_constructor (TREE_TYPE (decl), nreverse (initlist)),
NULL_TREE);
return decl;
@@ -4200,8 +4205,8 @@ generate_protocol_list (i_or_p)
refs_decl = start_decl (expr_decl, decl_specs, 1, NULL_TREE);
DECL_CONTEXT (refs_decl) = NULL_TREE;
- finish_decl (refs_decl, build_constructor (TREE_TYPE (refs_decl),
- nreverse (initlist)),
+ finish_decl (refs_decl, objc_build_constructor (TREE_TYPE (refs_decl),
+ nreverse (initlist)),
NULL_TREE);
return refs_decl;
@@ -4255,7 +4260,7 @@ build_category_initializer (type, cat_name, class_name,
initlist = tree_cons (NULL_TREE, expr, initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* struct objc_class {
@@ -4366,7 +4371,7 @@ build_shared_structure_initializer (type, isa, super, name, size, status,
/* gc_object_type = NULL */
initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* static struct objc_category _OBJC_CATEGORY_<name> = { ... }; */
diff --git a/gcc/profile.c b/gcc/profile.c
index 5cbdd00c058..99ddd3bc7d4 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1649,12 +1649,11 @@ build_function_info_value (function)
build_counter_section_value (function->counter_sections[i].tag,
function->counter_sections[i].n_counters);
set_purpose (counter_section_value, counter_section_fields);
- counter_sections_value = tree_cons (NULL_TREE,
- build (CONSTRUCTOR,
- counter_section_type,
- NULL_TREE,
- nreverse (counter_section_value)),
- counter_sections_value);
+ counter_sections_value =
+ tree_cons (NULL_TREE,
+ build_constructor (counter_section_type,
+ nreverse (counter_section_value)),
+ counter_sections_value);
}
finish_builtin_struct (counter_section_type, "__counter_section",
counter_section_fields, NULL_TREE);
@@ -1662,10 +1661,8 @@ build_function_info_value (function)
if (function->n_counter_sections)
{
counter_sections_value =
- build (CONSTRUCTOR,
- counter_sections_array_type,
- NULL_TREE,
- nreverse (counter_sections_value)),
+ build_constructor (counter_sections_array_type,
+ nreverse (counter_sections_value)),
counter_sections_value = build1 (ADDR_EXPR,
counter_sections_ptr_type,
counter_sections_value);
@@ -1832,10 +1829,8 @@ build_gcov_info_value ()
tree function_info_value = build_function_info_value (item);
set_purpose (function_info_value, function_info_fields);
functions = tree_cons (NULL_TREE,
- build (CONSTRUCTOR,
- function_info_type,
- NULL_TREE,
- nreverse (function_info_value)),
+ build_constructor (function_info_type,
+ nreverse (function_info_value)),
functions);
}
finish_builtin_struct (function_info_type, "__function_info",
@@ -1849,10 +1844,7 @@ build_gcov_info_value ()
array_type = build_array_type (
function_info_type,
build_index_type (build_int_2 (n_functions - 1, 0)));
- functions = build (CONSTRUCTOR,
- array_type,
- NULL_TREE,
- nreverse (functions));
+ functions = build_constructor (array_type, nreverse (functions));
functions = build1 (ADDR_EXPR,
function_info_ptr_type,
functions);
@@ -1879,12 +1871,11 @@ build_gcov_info_value ()
profile_info.section_info[i].tag,
profile_info.section_info[i].n_counters);
set_purpose (counter_sections_value, counter_section_data_fields);
- counter_sections = tree_cons (NULL_TREE,
- build (CONSTRUCTOR,
- counter_section_data_type,
- NULL_TREE,
- nreverse (counter_sections_value)),
- counter_sections);
+ counter_sections =
+ tree_cons (NULL_TREE,
+ build_constructor (counter_section_data_type,
+ nreverse (counter_sections_value)),
+ counter_sections);
}
finish_builtin_struct (counter_section_data_type, "__counter_section_data",
counter_section_data_fields, NULL_TREE);
@@ -1895,13 +1886,11 @@ build_gcov_info_value ()
if (profile_info.n_sections)
{
- counter_sections =
- build (CONSTRUCTOR,
- build_array_type (
- counter_section_data_type,
- build_index_type (build_int_2 (profile_info.n_sections - 1, 0))),
- NULL_TREE,
- nreverse (counter_sections));
+ tree cst_type = build_index_type (build_int_2 (profile_info.n_sections-1,
+ 0));
+ cst_type = build_array_type (counter_section_data_type, cst_type);
+ counter_sections = build_constructor (cst_type,
+ nreverse (counter_sections));
counter_sections = build1 (ADDR_EXPR,
counter_section_data_ptr_type,
counter_sections);
@@ -1943,8 +1932,7 @@ create_profiler ()
gcov_info = build (VAR_DECL, gcov_info_type, NULL_TREE, NULL_TREE);
DECL_INITIAL (gcov_info) =
- build (CONSTRUCTOR, gcov_info_type, NULL_TREE,
- nreverse (gcov_info_value));
+ build_constructor (gcov_info_type, nreverse (gcov_info_value));
TREE_STATIC (gcov_info) = 1;
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0);
diff --git a/gcc/tree.c b/gcc/tree.c
index fc4630f62f4..0570261d60d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -468,6 +468,29 @@ build_vector (type, vals)
return v;
}
+/* Return a new CONSTRUCTOR node whose type is TYPE and whose values
+ are in a list pointed to by VALS. */
+tree
+build_constructor (type, vals)
+ tree type, vals;
+{
+ tree c = make_node (CONSTRUCTOR);
+ TREE_TYPE (c) = type;
+ CONSTRUCTOR_ELTS (c) = vals;
+
+ /* ??? May not be necessary. Mirrors what build does. */
+ if (vals)
+ {
+ TREE_SIDE_EFFECTS (c) = TREE_SIDE_EFFECTS (vals);
+ TREE_READONLY (c) = TREE_READONLY (vals);
+ TREE_CONSTANT (c) = TREE_CONSTANT (vals);
+ }
+ else
+ TREE_CONSTANT (c) = 0; /* safe side */
+
+ return c;
+}
+
/* Return a new REAL_CST node whose type is TYPE and value is D. */
tree
diff --git a/gcc/tree.h b/gcc/tree.h
index 8dacb68da55..70d746394d7 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2266,6 +2266,7 @@ extern tree build_nt PARAMS ((enum tree_code, ...));
extern tree build_int_2_wide PARAMS ((unsigned HOST_WIDE_INT, HOST_WIDE_INT));
extern tree build_vector PARAMS ((tree, tree));
+extern tree build_constructor PARAMS ((tree, tree));
extern tree build_real_from_int_cst PARAMS ((tree, tree));
extern tree build_complex PARAMS ((tree, tree, tree));
extern tree build_string PARAMS ((int, const char *));