]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/htable_type.h
htable: Mark functions constructed by HTABLE_DEFINE_TYPE as UNNEEDED
[ccan] / ccan / htable / htable_type.h
index ad3974c5e446dc74be147371d74dafb09feea631..6764c3f24ae103c8bccbcc8949c283ff56dcca1e 100644 (file)
@@ -2,6 +2,7 @@
 #ifndef CCAN_HTABLE_TYPE_H
 #define CCAN_HTABLE_TYPE_H
 #include <ccan/htable/htable.h>
+#include <ccan/compiler/compiler.h>
 #include "config.h"
 
 /**
        {                                                               \
                return hashfn(keyof((const type *)elem));               \
        }                                                               \
-       static inline void name##_init(struct name *ht)                 \
+       static inline UNNEEDED void name##_init(struct name *ht)        \
        {                                                               \
                htable_init(&ht->raw, name##_hash, NULL);               \
        }                                                               \
-       static inline void name##_init_sized(struct name *ht, size_t s) \
+       static inline UNNEEDED void name##_init_sized(struct name *ht,  \
+                                                     size_t s)         \
        {                                                               \
                htable_init_sized(&ht->raw, name##_hash, NULL, s);      \
        }                                                               \
-       static inline void name##_clear(struct name *ht)                \
+       static inline UNNEEDED void name##_clear(struct name *ht)       \
        {                                                               \
                htable_clear(&ht->raw);                                 \
        }                                                               \
        {                                                               \
                return htable_add(&ht->raw, hashfn(keyof(elem)), elem); \
        }                                                               \
-       static inline bool name##_del(struct name *ht, const type *elem) \
+       static inline UNNEEDED bool name##_del(struct name *ht,         \
+                                              const type *elem)        \
        {                                                               \
                return htable_del(&ht->raw, hashfn(keyof(elem)), elem); \
        }                                                               \
-       static inline type *name##_get(const struct name *ht,           \
+       static inline UNNEEDED type *name##_get(const struct name *ht,  \
                                       const HTABLE_KTYPE(keyof) k)     \
        {                                                               \
                /* Typecheck for eqfn */                                \
@@ -81,7 +84,7 @@
                                  (bool (*)(const void *, void *))(eqfn), \
                                  k);                                   \
        }                                                               \
-       static inline bool name##_delkey(struct name *ht,               \
+       static inline UNNEEDED bool name##_delkey(struct name *ht,      \
                                         const HTABLE_KTYPE(keyof) k)   \
        {                                                               \
                type *elem = name##_get(ht, k);                         \
                        return name##_del(ht, elem);                    \
                return false;                                           \
        }                                                               \
-       static inline type *name##_first(const struct name *ht,         \
+       static inline UNNEEDED type *name##_first(const struct name *ht, \
                                         struct name##_iter *iter)      \
        {                                                               \
                return htable_first(&ht->raw, &iter->i);                \
        }                                                               \
-       static inline type *name##_next(const struct name *ht,          \
+       static inline UNNEEDED type *name##_next(const struct name *ht, \
                                        struct name##_iter *iter)       \
        {                                                               \
                return htable_next(&ht->raw, &iter->i);                 \