[11/13] Generalise typed_noop_remove

Richard Sandiford richard.sandiford@arm.com
Tue Jun 16 09:13:00 GMT 2015


The traits interface is supposed to support non-pointer element types,
so there's no real reason for typed_noop_remove to be specifically for
pointers.  It should be usable by anything that wants a no-op remove().

gcc/
	* hash-traits.h (typed_noop_remove): Don't require a pointer type.

Index: gcc/hash-traits.h
===================================================================
--- gcc/hash-traits.h	2015-06-15 16:05:24.059210397 +0100
+++ gcc/hash-traits.h	2015-06-15 16:05:24.051210490 +0100
@@ -44,7 +44,7 @@ typed_free_remove <Type>::remove (Type *
 template <typename Type>
 struct typed_noop_remove
 {
-  static inline void remove (Type *p);
+  static inline void remove (Type &);
 };
 
 
@@ -52,7 +52,7 @@ struct typed_noop_remove
 
 template <typename Type>
 inline void
-typed_noop_remove <Type>::remove (Type *p ATTRIBUTE_UNUSED)
+typed_noop_remove <Type>::remove (Type &)
 {
 }
 
@@ -169,7 +169,7 @@ struct ggc_cache_remove : ggc_remove<T>
    is deleted.  */
 
 template <typename T>
-struct nofree_ptr_hash : pointer_hash <T>, typed_noop_remove <T> {};
+struct nofree_ptr_hash : pointer_hash <T>, typed_noop_remove <T *> {};
 
 /* Traits for pointer elements that should be freed via free() when an
    element is deleted.  */



More information about the Gcc-patches mailing list