]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree.c (build_constructor): New function.
authorZack Weinberg <zack@gcc.gnu.org>
Sun, 13 Apr 2003 01:45:35 +0000 (01:45 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Sun, 13 Apr 2003 01:45:35 +0000 (01:45 +0000)
* 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

31 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/decl.c
gcc/ada/gigi.h
gcc/ada/trans.c
gcc/ada/utils.c
gcc/ada/utils2.c
gcc/builtins.c
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/init.c
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/semantics.c
gcc/cp/typeck.c
gcc/cp/typeck2.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/f/ste.c
gcc/java/ChangeLog
gcc/java/class.c
gcc/java/constants.c
gcc/java/java-tree.h
gcc/java/parse.y
gcc/objc/objc-act.c
gcc/profile.c
gcc/tree.c
gcc/tree.h

index a51bdf695c55f4ac5efa47ffee9aaf7df8e39103..9ae6cf1ec14c47b926f2c05de68f9d5502ca0903 100644 (file)
@@ -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
index 1993f767b7b6ccba0ce4f890030d50db53ee4a79..038b18f6971fd491cef68d3828e82351e2bce45a 100644 (file)
@@ -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.
index adf648111b3a9673850320e25c0e5206fd8671ab..1225ba169a5da39e617341ceec54aac0f5adce72 100644 (file)
@@ -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);
index a91b98ced6edbeed420628dafe5b34cc5c17f17b..4094f4902f86cfafb79819c7a79f088047b31ed5 100644 (file)
@@ -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,
index 68bb09ed4e9d947e6e01a976c54d7f9c7cb9315e..4155eecfd6e793cd7ff8c3fc2df8bd476cb9be16 100644 (file)
@@ -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));
 }
 \f
 /* 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));
 }
 \f
 /* EXP is to be treated as an array or record.  Handle the cases when it is
index a5d2860652f2c3b44613fd3353345ef7560bdaac..fa58936a53eb79f169de976a6c88492f14e7c61d 100644 (file)
@@ -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));
 }
 \f
 /* 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);
     }
 
index 131aeec4d7e451a158d4046265c49f3987ea985d..21d32f9cc6e4728d3428f24ac62f9487fe46144d 100644 (file)
@@ -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
index ee2d57990d4ccf88536822dbd8bbe78fe1cef3a2..667de5f3b39aa13f37e6906abb29c8f881507f35 100644 (file)
@@ -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.  */
index ec9418bdc84471eedd103a403632264c533d104f..aa58bea77505728af2ddb1896864a3324cd46cdc 100644 (file)
@@ -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)
index 1b13649d13196b9c343030b6d910abb22e407ff3..40a2810f1520fe3509b18647ac78141ab3c0d8e0 100644 (file)
@@ -1,3 +1,17 @@
+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
index ed0824a1c0e87b811230d5d057604fef3a434b82..382519e75286797d9906ddae822d1c3b979d24ce 100644 (file)
@@ -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;
index 28d1493f88328231b1c5840687ad8c3d6e733ad7..f5ee1a36c29801ea639798ff0234df410f44973d 100644 (file)
@@ -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))
index 0f8617c141f26454016786944f0b9ea552e03063..57050d782af2f4b096c09e6e01df31e37234887b 100644 (file)
@@ -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)
index d8542831f8a2826317f5bc206d09e1123665db1a..3083412786e2c870a2cd07371bdaf818ff6819cf 100644 (file)
@@ -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);
index b37332953ef8b0755d06a397ae0a2c238e5f28aa..c8e7c4089e2af76a0bb4284e9c2f14a75a58d11a 100644 (file)
@@ -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)
index 24ba0fd9b0244fafda23d110325d7c29fea87124..8283acb7f4601a00f3607c6c103a30bd740ab91d 100644 (file)
@@ -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.  */
index a5b7c50398047e23dac6490b84d1eab975137200..7c7af3e839913b44e56fa43de13091db8786dc45 100644 (file)
@@ -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)
index 45d528ffb1341795331381f900c135bd5f416f16..8e2682f7f93fe91f09152c38819f55f4d0c60906 100644 (file)
@@ -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))
index c4540481454269cce79d6d2881f319294eb1189f..2df882a1db38a4cb49d8b0278b7a445ad64d3bfa 100644 (file)
@@ -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);
     }
 
index d6ff7194b19818cdbc2718be91f435a491869623..fc712ff07013b078eef37a934d550ab178499952 100644 (file)
@@ -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
index b63e2eac9d61174555e62ae0bd563a7922f13f3a..1ccaeb20dcee1caefca1ccb6023e257ff4a9bf33 100644 (file)
@@ -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:
index 7d625cb6159881d91c23c5bccdf39fddde934e52..a1f355b7b17ea7c20690322928c6d9edf1888a1e 100644 (file)
@@ -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;
 
index fe99c0a345061b426a20c9d092c600a70bcd2ea3..4ee59ee672669c796f9c021ad7d92fd66187c7a5 100644 (file)
@@ -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:
index f121f0e95c521ef6cd5dc671093529981fddcc0b..fff42473cd06dce1c10d1f858488eb048083f9f1 100644 (file)
@@ -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;
index 1a56df0646149000ee236bc6243e4cdb2066532e..274a8bfd91ba302319123271a34e30b84e69628c 100644 (file)
@@ -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);
     }
index adfd77eee462d27a7e2f40fe8a96532260dc5b77..62d2452861e65940312436f986559a3af8b7d90e 100644 (file)
@@ -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
index b5808d4cebb0a96da49df5b20129a9bacfb3e6f1..df60f9e221065270a698a069c4b6cd5fde4e3885 100644 (file)
@@ -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;
index b9ac3150c1e9e011bc1410f3b9aefd8e64ce4646..36badee5884d9c34a4c2d90370b7fe8acf886932 100644 (file)
@@ -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));
 }
 \f
 /* 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> = { ... };  */
index 5cbdd00c058e43ae397049dfcd35472025e4ca2e..99ddd3bc7d49e25c99fee028ac74be90d08737f5 100644 (file)
@@ -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);
index fc4630f62f4db5b1dc0cfe4f84be7710e1c06981..0570261d60d1045dee1fa158d4478df244c921b4 100644 (file)
@@ -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
index 8dacb68da55de8e7973fa367bf57954367be961b..70d746394d79afdce0a90875b839851da565b09e 100644 (file)
@@ -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 *));