diff mbox

[11/13] Generalise typed_noop_remove

Message ID 87381s10g7.fsf@e105548-lin.cambridge.arm.com
State New
Headers show

Commit Message

Richard Sandiford June 16, 2015, 9:12 a.m. UTC
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.

Comments

Jeff Law June 23, 2015, 11:18 p.m. UTC | #1
On 06/16/2015 03:12 AM, Richard Sandiford wrote:
> 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.
OK.
jeff
diff mbox

Patch

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.  */