From d7b11178c4579f9c109c77609ef60dd0d6448598 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 16 Jun 2017 14:54:39 +0000 Subject: [PATCH] Symbol tables are insert only. * cp-tree.h (default_hash_traits ): Don't derive from pointer_hash. Make undeletable. From-SVN: r249266 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cp-tree.h | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2d7ee176894..7f9ddb03df9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-06-16 Nathan Sidwell + Symbol tables are insert only. + * cp-tree.h (default_hash_traits ): Don't + derive from pointer_hash. Make undeletable. + * class.c (resort_type_method_vec): Avoid potential unsigned overflow. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c56e59cbd7e..6c236aee4c7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -550,7 +550,7 @@ identifier_p (tree t) template <> struct default_hash_traits - : pointer_hash , ggc_remove + : pointer_hash { /* Use a regular tree as the type, to make using the hash table simpler. We'll get dynamic type checking with the hash function @@ -558,10 +558,14 @@ struct default_hash_traits GTY((skip)) typedef tree value_type; GTY((skip)) typedef tree compare_type; - static hashval_t hash (const value_type &id) + static hashval_t hash (const value_type id) { return IDENTIFIER_HASH_VALUE (id); } + + /* Nothing is deletable. Everything is insertable. */ + static bool is_deleted (value_type) { return false; } + static void remove (value_type) { gcc_unreachable (); } }; /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a -- 2.30.2