* 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.
From-SVN: r65539
+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
+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.
&& TYPE_CONTAINS_TEMPLATE_P (gnu_type)
&& gnu_expr == 0)
gnu_expr
- = build_constructor
+ = gnat_build_constructor
(gnu_type,
tree_cons
(TYPE_FIELDS (gnu_type),
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);
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,
gnu_list);
gnu_result
- = build_constructor (gnu_result_type, nreverse (gnu_list));
+ = gnat_build_constructor (gnu_result_type, nreverse (gnu_list));
}
break;
= 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
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));
}
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))
gnu_expr_list);
}
- return build_constructor (gnu_array_type, nreverse (gnu_expr_list));
+ return gnat_build_constructor (gnu_array_type, nreverse (gnu_expr_list));
}
\f
/* Subroutine of assoc_to_constructor: VALUES is a list of field associations,
result = tree_cons (field, value, result);
}
- return build_constructor (record_type, nreverse (result));
+ return gnat_build_constructor (record_type, nreverse (result));
}
\f
/* EXP is to be treated as an array or record. Handle the cases when it is
tree_cons (field, min, template_elts));
}
- return build_constructor (template_type, nreverse (template_elts));
+ return gnat_build_constructor (template_type, nreverse (template_elts));
}
\f
/* Build a VMS descriptor from a Mechanism_Type, which must specify
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),
/* 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)));
else
return
- build_constructor (type,
+ gnat_build_constructor (type,
tree_cons (TYPE_FIELDS (type),
convert (TREE_TYPE
(TYPE_FIELDS (type)),
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)),
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));
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);
}
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));
/* Return a CONSTRUCTOR of TYPE whose list is LIST. */
tree
-build_constructor (type, list)
+gnat_build_constructor (type, list)
tree type;
tree 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;
(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
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
tree arglist = TREE_OPERAND (exp, 1);
int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int);
int *word_ptr = (int *) ¤t_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 ();
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. */
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;
}
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)
+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
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;
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))
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)
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))
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);
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;
}
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)
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);
{
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;
}
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;
}
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;
}
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;
}
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. */
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)
/* 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))
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
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)))
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);
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)
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);
}
+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
{
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
{
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;
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;
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;
}
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;
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;
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;
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;
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:
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;
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;
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;
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;
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;
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;
+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:
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))
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);
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
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;
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;
}
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;
/* 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;
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);
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);
}
/* 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
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;
/* 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,
= 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)
{
with type TYPE and elements ELTS. */
static tree
-build_constructor (type, elts)
+objc_build_constructor (type, elts)
tree type, elts;
{
tree constructor, f, e;
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;
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. */
initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* Push forward-declarations of all the categories so that
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.
/* 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;
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);
}
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);
/* 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;
}
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 {
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;
initlist = tree_cons (NULL_TREE, expr, initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
\f
/* struct objc_category {
/* 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
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;
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
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;
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;
initlist = tree_cons (NULL_TREE, expr, initlist);
}
- return build_constructor (type, nreverse (initlist));
+ return objc_build_constructor (type, nreverse (initlist));
}
/* struct objc_class {
/* 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> = { ... }; */
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);
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);
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",
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);
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);
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);
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);
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
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 *));