This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: cp/init.c, conversion to ISO C


The attached patch is a step in the conversion to ISO C in the c++
frontend. It removes use of the PARAMS macro and converts the function
declarations to ISO C style.

Bootstrapped on i686-linux-gnu.

ok for mainline?

2003-05-19  Jens-Michael Hoffmann  <jensmh@gmx.de>

	    * init.c: removes use of PARAMS macro.
	    uses new style function declarations.

? autom4te.cache
? cp_initc_patch
? gcc/doc/HTML
? gcc/doc/a.out
? gcc/doc/jmh.texi2html
? gcc/doc/testrun.log
? gcc/doc/testrun.sum
? libf2c/libI77/autom4te.cache
? libf2c/libU77/autom4te.cache
Index: gcc/cp/init.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/init.c,v
retrieving revision 1.321
diff -c -3 -p -r1.321 init.c
*** gcc/cp/init.c	10 May 2003 11:29:51 -0000	1.321
--- gcc/cp/init.c	19 May 2003 19:53:01 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 36,59 ****
  #include "toplev.h"
  
  static void construct_virtual_base (tree, tree);
! static void expand_aggr_init_1 PARAMS ((tree, tree, tree, tree, int));
! static void expand_default_init PARAMS ((tree, tree, tree, tree, int));
! static tree build_vec_delete_1 PARAMS ((tree, tree, tree, special_function_kind, int));
  static void perform_member_init (tree, tree);
! static tree build_builtin_delete_call PARAMS ((tree));
! static int member_init_ok_or_else PARAMS ((tree, tree, tree));
! static void expand_virtual_init PARAMS ((tree, tree));
  static tree sort_mem_initializers (tree, tree);
! static tree initializing_context PARAMS ((tree));
! static void expand_cleanup_for_base PARAMS ((tree, tree));
! static tree get_temp_regvar PARAMS ((tree, tree));
! static tree dfs_initialize_vtbl_ptrs PARAMS ((tree, void *));
! static tree build_default_init PARAMS ((tree, tree));
! static tree build_new_1	PARAMS ((tree));
! static tree get_cookie_size PARAMS ((tree));
! static tree build_dtor_call PARAMS ((tree, special_function_kind, int));
! static tree build_field_list PARAMS ((tree, tree, int *));
! static tree build_vtbl_address PARAMS ((tree));
  
  /* We are about to generate some complex initialization code.
     Conceptually, it is all a single expression.  However, we may want
--- 36,59 ----
  #include "toplev.h"
  
  static void construct_virtual_base (tree, tree);
! static void expand_aggr_init_1 (tree, tree, tree, tree, int);
! static void expand_default_init (tree, tree, tree, tree, int);
! static tree build_vec_delete_1 (tree, tree, tree, special_function_kind, int);
  static void perform_member_init (tree, tree);
! static tree build_builtin_delete_call (tree);
! static int member_init_ok_or_else (tree, tree, tree);
! static void expand_virtual_init (tree, tree);
  static tree sort_mem_initializers (tree, tree);
! static tree initializing_context (tree);
! static void expand_cleanup_for_base (tree, tree);
! static tree get_temp_regvar (tree, tree);
! static tree dfs_initialize_vtbl_ptrs (tree, void *);
! static tree build_default_init (tree, tree);
! static tree build_new_1	(tree);
! static tree get_cookie_size (tree);
! static tree build_dtor_call (tree, special_function_kind, int);
! static tree build_field_list (tree, tree, int *);
! static tree build_vtbl_address (tree);
  
  /* We are about to generate some complex initialization code.
     Conceptually, it is all a single expression.  However, we may want
*************** static tree build_vtbl_address PARAMS ((
*** 65,73 ****
     complete.  */
  
  void
! begin_init_stmts (stmt_expr_p, compound_stmt_p)
!      tree *stmt_expr_p;
!      tree *compound_stmt_p;
  {
    if (building_stmt_tree ())
      *stmt_expr_p = begin_stmt_expr ();
--- 65,71 ----
     complete.  */
  
  void
! begin_init_stmts (tree *stmt_expr_p, tree *compound_stmt_p)
  {
    if (building_stmt_tree ())
      *stmt_expr_p = begin_stmt_expr ();
*************** begin_init_stmts (stmt_expr_p, compound_
*** 82,91 ****
     begin_init_stmts.  Returns the statement-expression itself.  */
  
  tree
! finish_init_stmts (stmt_expr, compound_stmt)
!      tree stmt_expr;
!      tree compound_stmt;
! 
  {  
    if (building_stmt_tree ())
      finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
--- 80,86 ----
     begin_init_stmts.  Returns the statement-expression itself.  */
  
  tree
! finish_init_stmts (tree stmt_expr, tree compound_stmt)
  {  
    if (building_stmt_tree ())
      finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
*************** finish_init_stmts (stmt_expr, compound_s
*** 113,121 ****
     TREE_LIST whose TREE_VALUE is the this ptr expression.  */
  
  static tree
! dfs_initialize_vtbl_ptrs (binfo, data)
!      tree binfo;
!      void *data;
  {
    if ((!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
        && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
--- 108,114 ----
     TREE_LIST whose TREE_VALUE is the this ptr expression.  */
  
  static tree
! dfs_initialize_vtbl_ptrs (tree binfo, void *data)
  {
    if ((!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
        && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
*************** dfs_initialize_vtbl_ptrs (binfo, data)
*** 136,143 ****
     ADDR.  */
  
  void
! initialize_vtbl_ptrs (addr)
!      tree addr;
  {
    tree list;
    tree type;
--- 129,135 ----
     ADDR.  */
  
  void
! initialize_vtbl_ptrs (tree addr)
  {
    tree list;
    tree type;
*************** build_zero_init (tree type, tree nelts, 
*** 270,278 ****
     constructors to be called.  */
  
  static tree
! build_default_init (type, nelts)
!      tree type;
!      tree nelts;
  {
    /* [dcl.init]:
  
--- 262,268 ----
     constructors to be called.  */
  
  static tree
! build_default_init (tree type, tree nelts)
  {
    /* [dcl.init]:
  
*************** perform_member_init (tree member, tree i
*** 418,427 ****
     the FIELD_DECLs on the TYPE_FIELDS list for T, in reverse order.  */
  
  static tree 
! build_field_list (t, list, uses_unions_p)
!      tree t;
!      tree list;
!      int *uses_unions_p;
  {
    tree fields;
  
--- 408,414 ----
     the FIELD_DECLs on the TYPE_FIELDS list for T, in reverse order.  */
  
  static tree 
! build_field_list (tree t, tree list, int *uses_unions_p)
  {
    tree fields;
  
*************** emit_mem_initializers (tree mem_inits)
*** 724,731 ****
     assigned to the vptr) for BINFO.  */
  
  static tree
! build_vtbl_address (binfo)
!      tree binfo;
  {
    tree binfo_for = binfo;
    tree vtbl;
--- 711,717 ----
     assigned to the vptr) for BINFO.  */
  
  static tree
! build_vtbl_address (tree binfo)
  {
    tree binfo_for = binfo;
    tree vtbl;
*************** build_vtbl_address (binfo)
*** 764,771 ****
     multiple inheritance, this might mean "C's A" if C : A, B.  */
  
  static void
! expand_virtual_init (binfo, decl)
!      tree binfo, decl;
  {
    tree vtbl, vtbl_ptr;
    tree vtt_index;
--- 750,756 ----
     multiple inheritance, this might mean "C's A" if C : A, B.  */
  
  static void
! expand_virtual_init (tree binfo, tree decl)
  {
    tree vtbl, vtbl_ptr;
    tree vtt_index;
*************** expand_virtual_init (binfo, decl)
*** 817,825 ****
     destroyed.  */
  
  static void
! expand_cleanup_for_base (binfo, flag)
!      tree binfo;
!      tree flag;
  {
    tree expr;
  
--- 802,808 ----
     destroyed.  */
  
  static void
! expand_cleanup_for_base (tree binfo, tree flag)
  {
    tree expr;
  
*************** construct_virtual_base (tree vbase, tree
*** 896,903 ****
  /* Find the context in which this FIELD can be initialized.  */
  
  static tree
! initializing_context (field)
!      tree field;
  {
    tree t = DECL_CONTEXT (field);
  
--- 879,885 ----
  /* Find the context in which this FIELD can be initialized.  */
  
  static tree
! initializing_context (tree field)
  {
    tree t = DECL_CONTEXT (field);
  
*************** initializing_context (field)
*** 916,925 ****
     MEMBER_NAME is the name of the member.  */
  
  static int
! member_init_ok_or_else (field, type, member_name)
!      tree field;
!      tree type;
!      tree member_name;
  {
    if (field == error_mark_node)
      return 0;
--- 898,904 ----
     MEMBER_NAME is the name of the member.  */
  
  static int
! member_init_ok_or_else (tree field, tree type, tree member_name)
  {
    if (field == error_mark_node)
      return 0;
*************** expand_member_init (tree name)
*** 1068,1076 ****
     perform the initialization, but not both, as it would be ambiguous.  */
  
  tree
! build_aggr_init (exp, init, flags)
!      tree exp, init;
!      int flags;
  {
    tree stmt_expr;
    tree compound_stmt;
--- 1047,1053 ----
     perform the initialization, but not both, as it would be ambiguous.  */
  
  tree
! build_aggr_init (tree exp, tree init, int flags)
  {
    tree stmt_expr;
    tree compound_stmt;
*************** build_aggr_init (exp, init, flags)
*** 1148,1156 ****
  /* Like build_aggr_init, but not just for aggregates.  */
  
  tree
! build_init (decl, init, flags)
!      tree decl, init;
!      int flags;
  {
    tree expr;
  
--- 1125,1131 ----
  /* Like build_aggr_init, but not just for aggregates.  */
  
  tree
! build_init (tree decl, tree init, int flags)
  {
    tree expr;
  
*************** build_init (decl, init, flags)
*** 1164,1174 ****
  }
  
  static void
! expand_default_init (binfo, true_exp, exp, init, flags)
!      tree binfo;
!      tree true_exp, exp;
!      tree init;
!      int flags;
  {
    tree type = TREE_TYPE (exp);
    tree ctor_name;
--- 1139,1145 ----
  }
  
  static void
! expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags)
  {
    tree type = TREE_TYPE (exp);
    tree ctor_name;
*************** expand_default_init (binfo, true_exp, ex
*** 1268,1278 ****
     its description.  */
  
  static void
! expand_aggr_init_1 (binfo, true_exp, exp, init, flags)
!      tree binfo;
!      tree true_exp, exp;
!      tree init;
!      int flags;
  {
    tree type = TREE_TYPE (exp);
  
--- 1239,1245 ----
     its description.  */
  
  static void
! expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags)
  {
    tree type = TREE_TYPE (exp);
  
*************** expand_aggr_init_1 (binfo, true_exp, exp
*** 1306,1314 ****
     OR_ELSE is nonzero, give an error message.  */
  
  int
! is_aggr_type (type, or_else)
!      tree type;
!      int or_else;
  {
    if (type == error_mark_node)
      return 0;
--- 1273,1279 ----
     OR_ELSE is nonzero, give an error message.  */
  
  int
! is_aggr_type (tree type, int or_else)
  {
    if (type == error_mark_node)
      return 0;
*************** is_aggr_type (type, or_else)
*** 1327,1335 ****
  /* Like is_aggr_typedef, but returns typedef if successful.  */
  
  tree
! get_aggr_from_typedef (name, or_else)
!      tree name;
!      int or_else;
  {
    tree type;
  
--- 1292,1298 ----
  /* Like is_aggr_typedef, but returns typedef if successful.  */
  
  tree
! get_aggr_from_typedef (tree name, int or_else)
  {
    tree type;
  
*************** get_aggr_from_typedef (name, or_else)
*** 1357,1364 ****
  }
  
  tree
! get_type_value (name)
!      tree name;
  {
    if (name == error_mark_node)
      return NULL_TREE;
--- 1320,1326 ----
  }
  
  tree
! get_type_value (tree name)
  {
    if (name == error_mark_node)
      return NULL_TREE;
*************** get_type_value (name)
*** 1377,1384 ****
     the appropriate function call.  */
  
  tree
! build_member_call (type, name, parmlist)
!      tree type, name, parmlist;
  {
    tree t;
    tree method_name;
--- 1339,1345 ----
     the appropriate function call.  */
  
  tree
! build_member_call (tree type, tree name, tree parmlist)
  {
    tree t;
    tree method_name;
*************** build_member_call (type, name, parmlist)
*** 1532,1539 ****
     @@ This function should be rewritten and placed in search.c.  */
  
  tree
! build_offset_ref (type, name)
!      tree type, name;
  {
    tree decl, t = error_mark_node;
    tree member;
--- 1493,1499 ----
     @@ This function should be rewritten and placed in search.c.  */
  
  tree
! build_offset_ref (tree type, tree name)
  {
    tree decl, t = error_mark_node;
    tree member;
*************** build_offset_ref (type, name)
*** 1722,1729 ****
     not have its address taken.  */
  
  tree
! resolve_offset_ref (exp)
!      tree exp;
  {
    tree type = TREE_TYPE (exp);
    tree base = NULL_TREE;
--- 1682,1688 ----
     not have its address taken.  */
  
  tree
! resolve_offset_ref (tree exp)
  {
    tree type = TREE_TYPE (exp);
    tree base = NULL_TREE;
*************** resolve_offset_ref (exp)
*** 1846,1853 ****
     constant, then return that value.  */
  
  tree
! decl_constant_value (decl)
!      tree decl;
  {
    if (TREE_READONLY_DECL_P (decl)
        && ! TREE_THIS_VOLATILE (decl)
--- 1805,1811 ----
     constant, then return that value.  */
  
  tree
! decl_constant_value (tree decl)
  {
    if (TREE_READONLY_DECL_P (decl)
        && ! TREE_THIS_VOLATILE (decl)
*************** decl_constant_value (decl)
*** 1868,1875 ****
  /* Call the global __builtin_delete to delete ADDR.  */
  
  static tree
! build_builtin_delete_call (addr)
!      tree addr;
  {
    mark_used (global_delete_fndecl);
    return build_call (global_delete_fndecl, build_tree_list (NULL_TREE, addr));
--- 1826,1832 ----
  /* Call the global __builtin_delete to delete ADDR.  */
  
  static tree
! build_builtin_delete_call (tree addr)
  {
    mark_used (global_delete_fndecl);
    return build_call (global_delete_fndecl, build_tree_list (NULL_TREE, addr));
*************** build_builtin_delete_call (addr)
*** 1902,1911 ****
     PLACEMENT is the `placement' list for user-defined operator new ().  */
  
  tree
! build_new (placement, decl, init, use_global_new)
!      tree placement;
!      tree decl, init;
!      int use_global_new;
  {
    tree type, rval;
    tree nelts = NULL_TREE, t;
--- 1859,1865 ----
     PLACEMENT is the `placement' list for user-defined operator new ().  */
  
  tree
! build_new (tree placement, tree decl, tree init, int use_global_new)
  {
    tree type, rval;
    tree nelts = NULL_TREE, t;
*************** build_new (placement, decl, init, use_gl
*** 2075,2082 ****
  /* Given a Java class, return a decl for the corresponding java.lang.Class.  */
  
  tree
! build_java_class_ref (type)
!      tree type;
  {
    tree name = NULL_TREE, class_decl;
    static tree CL_suffix = NULL_TREE;
--- 2029,2035 ----
  /* Given a Java class, return a decl for the corresponding java.lang.Class.  */
  
  tree
! build_java_class_ref (tree type)
  {
    tree name = NULL_TREE, class_decl;
    static tree CL_suffix = NULL_TREE;
*************** build_java_class_ref (type)
*** 2125,2132 ****
     known that a cookie is needed.  */
  
  static tree
! get_cookie_size (type)
!      tree type;
  {
    tree cookie_size;
  
--- 2078,2084 ----
     known that a cookie is needed.  */
  
  static tree
! get_cookie_size (tree type)
  {
    tree cookie_size;
  
*************** get_cookie_size (type)
*** 2149,2156 ****
     value is immediately handed to expand_expr.  */
  
  static tree
! build_new_1 (exp)
!      tree exp;
  {
    tree placement, init;
    tree true_type, size, rval, t;
--- 2101,2107 ----
     value is immediately handed to expand_expr.  */
  
  static tree
! build_new_1 (tree exp)
  {
    tree placement, init;
    tree true_type, size, rval, t;
*************** build_new_1 (exp)
*** 2535,2544 ****
  }
  
  static tree
! build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
!      tree base, maxindex, type;
!      special_function_kind auto_delete_vec;
!      int use_global_delete;
  {
    tree virtual_size;
    tree ptype = build_pointer_type (type = complete_type (type));
--- 2486,2493 ----
  }
  
  static tree
! build_vec_delete_1 (tree base, tree maxindex, tree type,
!     special_function_kind auto_delete_vec, int use_global_delete)
  {
    tree virtual_size;
    tree ptype = build_pointer_type (type = complete_type (type));
*************** build_vec_delete_1 (base, maxindex, type
*** 2676,2683 ****
  /* Create an unnamed variable of the indicated TYPE.  */ 
  
  tree
! create_temporary_var (type)
!      tree type;
  {
    tree decl;
   
--- 2625,2631 ----
  /* Create an unnamed variable of the indicated TYPE.  */ 
  
  tree
! create_temporary_var (tree type)
  {
    tree decl;
   
*************** create_temporary_var (type)
*** 2699,2706 ****
     "outside" the binding contour of the function).  */
  
  static tree
! get_temp_regvar (type, init)
!      tree type, init;
  {
    tree decl;
  
--- 2647,2653 ----
     "outside" the binding contour of the function).  */
  
  static tree
! get_temp_regvar (tree type, tree init)
  {
    tree decl;
  
*************** get_temp_regvar (type, init)
*** 2731,2739 ****
     but use assignment instead of initialization.  */
  
  tree
! build_vec_init (base, maxindex, init, from_array)
!      tree base, init, maxindex;
!      int from_array;
  {
    tree rval;
    tree base2 = NULL_TREE;
--- 2678,2684 ----
     but use assignment instead of initialization.  */
  
  tree
! build_vec_init (tree base, tree maxindex, tree init, int from_array)
  {
    tree rval;
    tree base2 = NULL_TREE;
*************** build_vec_init (base, maxindex, init, fr
*** 3024,3033 ****
     This does not call any destructors.  */
  
  tree
! build_x_delete (addr, which_delete, virtual_size)
!      tree addr;
!      int which_delete;
!      tree virtual_size;
  {
    int use_global_delete = which_delete & 1;
    int use_vec_delete = !!(which_delete & 2);
--- 2969,2975 ----
     This does not call any destructors.  */
  
  tree
! build_x_delete (tree addr, int which_delete, tree virtual_size)
  {
    int use_global_delete = which_delete & 1;
    int use_vec_delete = !!(which_delete & 2);
*************** build_x_delete (addr, which_delete, virt
*** 3041,3050 ****
     build_delete.  */
  
  static tree
! build_dtor_call (exp, dtor_kind, flags)
!      tree exp;
!      special_function_kind dtor_kind;
!      int flags;
  {
    tree name;
  
--- 2983,2989 ----
     build_delete.  */
  
  static tree
! build_dtor_call (tree exp, special_function_kind dtor_kind, int flags)
  {
    tree name;
  
*************** build_dtor_call (exp, dtor_kind, flags)
*** 3079,3089 ****
     flags.  See cp-tree.h for more info.  */
  
  tree
! build_delete (type, addr, auto_delete, flags, use_global_delete)
!      tree type, addr;
!      special_function_kind auto_delete;
!      int flags;
!      int use_global_delete;
  {
    tree expr;
  
--- 3018,3025 ----
     flags.  See cp-tree.h for more info.  */
  
  tree
! build_delete (tree type, tree addr, special_function_kind auto_delete,
!     int flags, int use_global_delete)
  {
    tree expr;
  
*************** push_base_cleanups ()
*** 3312,3319 ****
  /* For type TYPE, delete the virtual baseclass objects of DECL.  */
  
  tree
! build_vbase_delete (type, decl)
!      tree type, decl;
  {
    tree vbases = CLASSTYPE_VBASECLASSES (type);
    tree result = NULL_TREE;
--- 3248,3254 ----
  /* For type TYPE, delete the virtual baseclass objects of DECL.  */
  
  tree
! build_vbase_delete (tree type, tree decl)
  {
    tree vbases = CLASSTYPE_VBASECLASSES (type);
    tree result = NULL_TREE;
*************** build_vbase_delete (type, decl)
*** 3353,3362 ****
     be worth bothering.)  */
  
  tree
! build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete)
!      tree base, maxindex;
!      special_function_kind auto_delete_vec;
!      int use_global_delete;
  {
    tree type;
  
--- 3288,3295 ----
     be worth bothering.)  */
  
  tree
! build_vec_delete (tree base, tree maxindex,
!     special_function_kind auto_delete_vec, int use_global_delete)
  {
    tree type;
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]