diff mbox

VEC re-write [patch 23/25]

Message ID 20121115215427.8E215C0916@torture.tor.corp.google.com
State New
Headers show

Commit Message

Diego Novillo Nov. 15, 2012, 9:54 p.m. UTC
2012-11-15  Diego Novillo  <dnovillo@google.com>

	Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec)

	* config/vms/vms.c: Use new vec API in vec.h.
	* vmsdbgout.c: Likewise.
diff mbox

Patch

diff --git a/gcc/config/vms/vms.c b/gcc/config/vms/vms.c
index d23e8a8..65bf42a 100644
--- a/gcc/config/vms/vms.c
+++ b/gcc/config/vms/vms.c
@@ -101,7 +101,7 @@  static const struct vms_crtl_name vms_crtl_names[] =
 
 /* List of aliased identifiers.  They must be persistent across gc.  */
 
-static GTY(()) VEC(tree,gc) *aliases_id;
+static GTY(()) vec<tree, va_gc> *aliases_id;
 
 /* Add a CRTL translation.  This simply use the transparent alias
    mechanism, which is platform independent and works with the
@@ -120,7 +120,7 @@  vms_add_crtl_xlat (const char *name, size_t nlen,
   IDENTIFIER_TRANSPARENT_ALIAS (targ) = 1;
   TREE_CHAIN (targ) = get_identifier_with_length (id_str, id_len);
 
-  VEC_safe_push (tree, gc, aliases_id, targ);
+  vec_safe_push (aliases_id, targ);
 }
 
 /* Do VMS specific stuff on builtins: disable the ones that are not
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 5472ac5..cb8479f 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -101,11 +101,9 @@  static unsigned int file_info_table_in_use;
 #define FILE_TABLE_INCREMENT 64
 
 typedef char *char_p;
-DEF_VEC_P(char_p);
-DEF_VEC_ALLOC_P(char_p,heap);
 
-static VEC(char_p,heap) *funcnam_table;
-static VEC(unsigned,heap) *funcnum_table;
+static vec<char_p> funcnam_table;
+static vec<unsigned> funcnum_table;
 #define FUNC_TABLE_INITIAL 256
 
 /* Local pointer to the name of the main input file.  Initialized in
@@ -641,7 +639,7 @@  write_rtnbeg (int rtnnum, int dosizeonly)
   DST_ROUTINE_BEGIN rtnbeg;
   DST_PROLOG prolog;
 
-  rtnname = VEC_index (char_p, funcnam_table, rtnnum);
+  rtnname = funcnam_table[rtnnum];
   rtnnamelen = strlen (rtnname);
   rtnentryname = concat (rtnname, "..en", NULL);
 
@@ -714,7 +712,7 @@  write_rtnbeg (int rtnnum, int dosizeonly)
 
       ASM_GENERATE_INTERNAL_LABEL
         (label, FUNC_PROLOG_LABEL,
-	 VEC_index (unsigned, funcnum_table, rtnnum));
+	 funcnum_table[rtnnum]);
       totsize += write_debug_addr (label, "prolog breakpoint addr",
 				   dosizeonly);
     }
@@ -748,10 +746,10 @@  write_rtnend (int rtnnum, int dosizeonly)
 
   ASM_GENERATE_INTERNAL_LABEL
    (label1, FUNC_BEGIN_LABEL,
-    VEC_index (unsigned, funcnum_table, rtnnum));
+    funcnum_table[rtnnum]);
   ASM_GENERATE_INTERNAL_LABEL
    (label2, FUNC_END_LABEL,
-    VEC_index (unsigned, funcnum_table, rtnnum));
+    funcnum_table[rtnnum]);
   totsize += write_debug_delta4 (label2, label1, "routine size", dosizeonly);
 
   return totsize;
@@ -1264,9 +1262,8 @@  vmsdbgout_begin_function (tree decl)
     (*dwarf2_debug_hooks.begin_function) (decl);
 
   /* Add the new entry to the end of the function name table.  */
-  VEC_safe_push (char_p, heap, funcnam_table, xstrdup (name));
-  VEC_safe_push (unsigned, heap, funcnum_table,
-		 current_function_funcdef_no);
+  funcnam_table.safe_push (xstrdup (name));
+  funcnum_table.safe_push (current_function_funcdef_no);
 }
 
 static char fullname_buff [4096];
@@ -1447,8 +1444,8 @@  vmsdbgout_init (const char *filename)
   /* Skip the first entry - file numbers begin at 1.  */
   file_info_table_in_use = 1;
 
-  funcnam_table = VEC_alloc (char_p, heap, FUNC_TABLE_INITIAL);
-  funcnum_table = VEC_alloc (unsigned, heap, FUNC_TABLE_INITIAL);
+  funcnam_table.create (FUNC_TABLE_INITIAL);
+  funcnum_table.create (FUNC_TABLE_INITIAL);
 
   /* Allocate the initial hunk of the line_info_table.  */
   line_info_table = XCNEWVEC (dst_line_info_entry, LINE_INFO_TABLE_INCREMENT);
@@ -1564,7 +1561,7 @@  vmsdbgout_finish (const char *filename ATTRIBUTE_UNUSED)
   ASM_OUTPUT_ALIGN (asm_out_file, 0);
 
   totsize = write_modbeg (1);
-  FOR_EACH_VEC_ELT (unsigned, funcnum_table, i, ifunc)
+  FOR_EACH_VEC_ELT (funcnum_table, i, ifunc)
     {
       totsize += write_rtnbeg (i, 1);
       totsize += write_rtnend (i, 1);
@@ -1572,7 +1569,7 @@  vmsdbgout_finish (const char *filename ATTRIBUTE_UNUSED)
   totsize += write_pclines (1);
 
   write_modbeg (0);
-  FOR_EACH_VEC_ELT (unsigned, funcnum_table, i, ifunc)
+  FOR_EACH_VEC_ELT (funcnum_table, i, ifunc)
     {
       write_rtnbeg (i, 0);
       write_rtnend (i, 0);