Patchwork [cxx-conversion] Fix hash_table build problems with checking enabled.

login
register
mail settings
Submitter Lawrence Crowl
Date Dec. 11, 2012, 2:39 a.m.
Message ID <CAGqM8fbVGXQX0mX8eqQGuVDF0T5frNO9Dijf3r-m3eCYD9OYeA@mail.gmail.com>
Download mbox | patch
Permalink /patch/205115/
State New
Headers show

Comments

Lawrence Crowl - Dec. 11, 2012, 2:39 a.m.
Fix some hash_table build errors when configured with
--enable-checking=yes.

tree-browser.c
   * Remove stale declaration of removed TB_parent_eq.
   * Fix template parameter for base class to match value_type.

gimple.h
   * Use gimplify_hasher::hash rather than gimple_tree_hash in the
   assertion check.
   * Change return values to match return type. (I.e. no conversions.)

Tested on x86-64.

Committing to branch as obvious.

Patch

Index: gcc/tree-browser.c
===================================================================
--- gcc/tree-browser.c	(revision 194227)
+++ gcc/tree-browser.c	(working copy)
@@ -96,14 +96,13 @@  static tree TB_next_expr (tree);
 static tree TB_up_expr (tree);
 static tree TB_first_in_bind (tree);
 static tree TB_last_in_bind (tree);
-static int  TB_parent_eq (const void *, const void *);
 static tree TB_history_prev (void);

 /* FIXME: To be declared in a .h file.  */
 void browse_tree (tree);

 /* Hashtable helpers.  */
-struct tree_upper_hasher : typed_noop_remove <VALUE>
+struct tree_upper_hasher : typed_noop_remove <tree_node>
 {
   typedef tree_node value_type;
   typedef tree_node compare_type;
Index: gcc/gimple.h
===================================================================
--- gcc/gimple.h	(revision 194227)
+++ gcc/gimple.h	(working copy)
@@ -972,18 +972,18 @@  gimplify_hasher::equal (const value_type

   if (TREE_CODE (t2) != code
       || TREE_TYPE (t1) != TREE_TYPE (t2))
-    return 0;
+    return false;

   if (!operand_equal_p (t1, t2, 0))
-    return 0;
+    return false;

 #ifdef ENABLE_CHECKING
   /* Only allow them to compare equal if they also hash equal; otherwise
      results are nondeterminate, and we fail bootstrap comparison.  */
-  gcc_assert (gimple_tree_hash (p1) == gimple_tree_hash (p2));
+  gcc_assert (hash (p1) == hash (p2));
 #endif

-  return 1;
+  return true;
 }

 struct gimplify_ctx