gcc/
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Oct 2012 11:46:25 +0000 (11:46 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Oct 2012 11:46:25 +0000 (11:46 +0000)
2012-10-08  Tobias Burnus  <burnus@net-b.de>

* lto-cgraph.c (input_node_opt_summary): Remove unused code.
* lto-opts.c (append_to_collect_gcc_options): Fix condition.
* lto-symtab.c (lto_cgraph_replace_node): Don't xstrdup string
which is passed to fprintf.

gcc/lto/
2012-10-08  Tobias Burnus  <burnus@net-b.de>

* lto-lang.c (lto_register_builtin_type): Avoid useless
decl creation.
* lto-object.c (lto_obj_file_open, lto_obj_file_open): Free memory.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192250 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/lto-cgraph.c
gcc/lto-opts.c
gcc/lto-symtab.c
gcc/lto/ChangeLog
gcc/lto/lto-lang.c
gcc/lto/lto-object.c

index 9967ecf..7ad8a41 100644 (file)
@@ -1,3 +1,10 @@
+2012-10-09  Tobias Burnus  <burnus@net-b.de>
+
+       * lto-cgraph.c (input_node_opt_summary): Remove unused code.
+       * lto-opts.c (append_to_collect_gcc_options): Fix condition.
+       * lto-symtab.c (lto_cgraph_replace_node): Don't xstrdup string
+       which is passed to fprintf.
+
 2012-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/54194
index 4f952f5..b23f192 100644 (file)
@@ -1517,14 +1517,9 @@ input_node_opt_summary (struct cgraph_node *node,
   count = streamer_read_uhwi (ib_main);
   for (i = 0; i < count; i++)
     {
-      int parm_num;
-      tree parm;
       struct ipa_replace_map *map = ggc_alloc_ipa_replace_map ();
 
       VEC_safe_push (ipa_replace_map_p, gc, node->clone.tree_map, map);
-      for (parm_num = 0, parm = DECL_ARGUMENTS (node->symbol.decl); parm_num;
-          parm = DECL_CHAIN (parm))
-       parm_num --;
       map->parm_num = streamer_read_uhwi (ib_main);
       map->old_tree = NULL;
       map->new_tree = stream_read_tree (ib_main, data_in);
index 668a5ce..a235f41 100644 (file)
@@ -44,7 +44,7 @@ append_to_collect_gcc_options (struct obstack *ob,
                               bool *first_p, const char *opt)
 {
   const char *p, *q = opt;
-  if (!first_p)
+  if (!*first_p)
     obstack_grow (ob, " ", 1);
   obstack_grow (ob, "'", 1);
   while ((p = strchr (q, '\'')))
index 25c0b22..659a68b 100644 (file)
@@ -46,8 +46,8 @@ lto_cgraph_replace_node (struct cgraph_node *node,
     {
       fprintf (cgraph_dump_file, "Replacing cgraph node %s/%i by %s/%i"
               " for symbol %s\n",
-              xstrdup (cgraph_node_name (node)), node->uid,
-              xstrdup (cgraph_node_name (prevailing_node)),
+              cgraph_node_name (node), node->uid,
+              cgraph_node_name (prevailing_node),
               prevailing_node->uid,
               IDENTIFIER_POINTER ((*targetm.asm_out.mangle_assembler_name)
                 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)))));
index d9849b4..265922f 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-09  Tobias Burnus  <burnus@net-b.de>
+
+       * lto-lang.c (lto_register_builtin_type): Avoid useless
+       decl creation.
+       * lto-object.c (lto_obj_file_open, lto_obj_file_open): Free memory.
+
 2012-10-08  Tobias Burnus  <burnus@net-b.de>
 
        * lto.c (lto_wpa_write_files, read_cgraph_and_symbols):
index 280d883..edfab74 100644 (file)
@@ -1079,10 +1079,13 @@ lto_register_builtin_type (tree type, const char *name)
 {
   tree decl;
 
-  decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier (name), type);
-  DECL_ARTIFICIAL (decl) = 1;
   if (!TYPE_NAME (type))
-    TYPE_NAME (type) = decl;
+    {
+      decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
+                        get_identifier (name), type);
+      DECL_ARTIFICIAL (decl) = 1;
+      TYPE_NAME (type) = decl;
+    }
 
   registered_builtin_types = tree_cons (0, type, registered_builtin_types);
 }
index daf3bd0..ce24400 100644 (file)
@@ -133,7 +133,10 @@ lto_obj_file_open (const char *filename, bool writable)
          errmsg = simple_object_attributes_merge (saved_attributes, attrs,
                                                   &err);
          if (errmsg != NULL)
-           goto fail_errmsg;
+           {
+             free (attrs);
+             goto fail_errmsg;
+           }
        }
     }
   else
@@ -155,11 +158,13 @@ lto_obj_file_open (const char *filename, bool writable)
     error ("%s: %s: %s", fname, errmsg, xstrerror (err));
                                         
  fail:
-  if (lo != NULL)
+  if (lo->fd != -1)
     lto_obj_file_close ((lto_file *) lo);
+  free (lo);
   return NULL;
 }
 
+
 /* Close FILE.  If FILE was opened for writing, it is written out
    now.  */