Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / godump.c
index b545525..81efa28 100644 (file)
@@ -1,5 +1,5 @@
 /* Output Go language descriptions of types.
-   Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2008-2013 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <iant@google.com>.
 
 This file is part of GCC.
@@ -56,7 +56,7 @@ static FILE *go_dump_file;
 
 /* A queue of decls to output.  */
 
-static GTY(()) VEC(tree,gc) *queue;
+static GTY(()) vec<tree, va_gc> *queue;
 
 /* A hash table of macros we have seen.  */
 
@@ -480,7 +480,7 @@ go_decl (tree decl)
       || DECL_IS_BUILTIN (decl)
       || DECL_NAME (decl) == NULL_TREE)
     return;
-  VEC_safe_push (tree, gc, queue, decl);
+  vec_safe_push (queue, decl);
 }
 
 /* A function decl.  */
@@ -515,7 +515,7 @@ go_type_decl (tree decl, int local)
          || TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) != IDENTIFIER_NODE)
       && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)
     return;
-  VEC_safe_push (tree, gc, queue, decl);
+  vec_safe_push (queue, decl);
 }
 
 /* A container for the data we pass around when generating information
@@ -1196,7 +1196,7 @@ go_finish (const char *filename)
 
   keyword_hash_init (&container);
 
-  FOR_EACH_VEC_ELT (tree, queue, ix, decl)
+  FOR_EACH_VEC_SAFE_ELT (queue, ix, decl)
     {
       switch (TREE_CODE (decl))
        {
@@ -1230,7 +1230,7 @@ go_finish (const char *filename)
   htab_delete (container.keyword_hash);
   obstack_free (&container.type_obstack, NULL);
 
-  queue = NULL;
+  vec_free (queue);
 
   if (fclose (go_dump_file) != 0)
     error ("could not close Go dump file: %m");