splay-tree.h (splay_tree_compare_strings, [...]): Declare new utility functions.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 28 May 2018 18:21:23 +0000 (18:21 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Mon, 28 May 2018 18:21:23 +0000 (18:21 +0000)
include:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.h (splay_tree_compare_strings,
        splay_tree_delete_pointers): Declare new utility functions.

libiberty:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.c (splay_tree_compare_strings,
        splay_tree_delete_pointers): New utility functions.

gcc:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * tree-dump.c (dump_node): Use splay_tree_delete_pointers.

c-family:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c-lex.c (get_fileinfo): Use splay_tree_compare_strings and
        splay_tree_delete_pointers.

cp:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * decl2.c (start_static_storage_duration_function): Use
        splay_tree_delete_pointers.

From-SVN: r260850

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-lex.c
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/tree-dump.c
include/ChangeLog
include/splay-tree.h
libiberty/ChangeLog
libiberty/splay-tree.c

index 58ab2b4ed461006a9659311af874e7c97582aee7..8791af2982ee485f7c806d244b4f3c35fbbcc99b 100644 (file)
@@ -1,3 +1,7 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * tree-dump.c (dump_node): Use splay_tree_delete_pointers.
+
 2018-05-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/85933
index 4fc2f1bfad2e34e2d9c3d168fc27d7e9225f3d35..40565d68fdc7860f1ebda4628d893ea39a56326f 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * c-lex.c (get_fileinfo): Use splay_tree_compare_strings and
+       splay_tree_delete_pointers.
+
 2018-05-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/85921
index a4ad0a30f38836d42f50aeb67b05eac6acae9e42..3cd24ac40dc81e284877e0c0b27a0d06be261626 100644 (file)
@@ -103,11 +103,9 @@ get_fileinfo (const char *name)
   struct c_fileinfo *fi;
 
   if (!file_info_tree)
-    file_info_tree = splay_tree_new ((splay_tree_compare_fn)
-                                    (void (*) (void)) strcmp,
+    file_info_tree = splay_tree_new (splay_tree_compare_strings,
                                     0,
-                                    (splay_tree_delete_value_fn)
-                                    (void (*) (void)) free);
+                                    splay_tree_delete_pointers);
 
   n = splay_tree_lookup (file_info_tree, (splay_tree_key) name);
   if (n)
index 58fc696c571cf1b2984e524eb59416d065c9ac9c..a3a443a69b94c8b9a7e9b99a5546703a949aaece 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * decl2.c (start_static_storage_duration_function): Use
+       splay_tree_delete_pointers.
+
 2018-05-25  Jason Merrill  <jason@redhat.com>
 
        PR c++/85815 - reference to member of enclosing template.
index e16e476c28545031e303bb9b68c90c20b740b767..2cef9c750edc72ce657497dc8dcf2e2a8925b5a6 100644 (file)
@@ -3595,8 +3595,7 @@ start_static_storage_duration_function (unsigned count)
       priority_info_map = splay_tree_new (splay_tree_compare_ints,
                                          /*delete_key_fn=*/0,
                                          /*delete_value_fn=*/
-                                         (splay_tree_delete_value_fn)
-                                         (void (*) (void)) free);
+                                         splay_tree_delete_pointers);
 
       /* We always need to generate functions for the
         DEFAULT_INIT_PRIORITY so enter it now.  That way when we walk
index fe3cc12bf235d6c55987681b346004dcb9487622..fd565d207a8c8f79bfd6b67343b371dc6530070d 100644 (file)
@@ -732,8 +732,7 @@ dump_node (const_tree t, dump_flags_t flags, FILE *stream)
   di.flags = flags;
   di.node = t;
   di.nodes = splay_tree_new (splay_tree_compare_pointers, 0,
-                            (splay_tree_delete_value_fn)
-                            (void (*) (void)) free);
+                            splay_tree_delete_pointers);
 
   /* Queue up the first node.  */
   queue (&di, t, DUMP_NONE);
index 854b58af0838a71037665e00767d9a3071519be0..7b4aaed39c1e931165531aae8fd8bd015dd433b0 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * splay-tree.h (splay_tree_compare_strings,
+       splay_tree_delete_pointers): Declare new utility functions.
+
 2018-05-24  Tom Rix  <trix@juniper.net>
 
        * dwarf2.def (DW_FORM_strx*, DW_FORM_addrx*): New.
index b63612cc0a454d40d57efff90842d4c098661351..fc94fb786fb63c1e8690e9940f9381314c93a98b 100644 (file)
@@ -147,7 +147,9 @@ extern splay_tree_node splay_tree_max (splay_tree);
 extern splay_tree_node splay_tree_min (splay_tree);
 extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
 extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
-extern int splay_tree_compare_pointers (splay_tree_key,        splay_tree_key);
+extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
+extern int splay_tree_compare_strings (splay_tree_key, splay_tree_key);
+extern void splay_tree_delete_pointers (splay_tree_value);
 
 #ifdef __cplusplus
 }
index b249226155c99a9d9031029b1548cc06114ba601..19c62699c07aaa14cfb383269d3ba6acd82cf2c2 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * splay-tree.c (splay_tree_compare_strings,
+       splay_tree_delete_pointers): New utility functions.
+
 2018-05-10  Martin Liska  <mliska@suse.cz>
 
        PR bootstrap/64914
index 23d22a89d8eab06d52b0d9b06914a008bb8fff7e..d3be4aa90b54dc5f4bda4fdb44835e4b44dcd253 100644 (file)
@@ -31,6 +31,9 @@ Boston, MA 02110-1301, USA.  */
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 #include <stdio.h>
 
@@ -590,3 +593,19 @@ splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
   else 
     return 0;
 }
+
+/* Splay-tree comparison function, treating the keys as strings.  */
+
+int
+splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2)
+{
+  return strcmp ((char *) k1, (char *) k2);
+}
+
+/* Splay-tree delete function, simply using free.  */
+
+void
+splay_tree_delete_pointers (splay_tree_value value)
+{
+  free ((void *) value);
+}