From 0904888163ff8a33bd3fabb0ede11465a2366ad7 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Fri, 1 Sep 2017 18:07:42 +0200 Subject: [PATCH] tree.h: mark static functions as unused to avoid clang warning --- src/tree.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/tree.h b/src/tree.h index d8367e6..2f7e8be 100644 --- a/src/tree.h +++ b/src/tree.h @@ -53,6 +53,12 @@ #ifndef EPOLL_TREE_H_ #define EPOLL_TREE_H_ +#ifdef __clang__ +#define TREE_UNUSED __attribute__((__unused__)) +#else +#define TREE_UNUSED /* empty */ +#endif + /* clang-format off */ #define SPLAY_HEAD(name, type) \ @@ -119,7 +125,7 @@ struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ \ /* Finds the node with the same key as elm */ \ -static __inline struct type * \ +static __inline TREE_UNUSED struct type * \ name##_SPLAY_FIND(struct name *head, struct type *elm) \ { \ if (SPLAY_EMPTY(head)) \ @@ -130,7 +136,7 @@ name##_SPLAY_FIND(struct name *head, struct type *elm) \ return (NULL); \ } \ \ -static __inline struct type * \ +static __inline TREE_UNUSED struct type * \ name##_SPLAY_NEXT(struct name *head, struct type *elm) \ { \ name##_SPLAY(head, elm); \ @@ -144,7 +150,7 @@ name##_SPLAY_NEXT(struct name *head, struct type *elm) \ return (elm); \ } \ \ -static __inline struct type * \ +static __inline TREE_UNUSED struct type * \ name##_SPLAY_MIN_MAX(struct name *head, int val) \ { \ name##_SPLAY_MINMAX(head, val); \ @@ -377,7 +383,7 @@ struct { \ #define RB_PROTOTYPE(name, type, field, cmp) \ RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) #define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp, static) + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, static TREE_UNUSED) #define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ @@ -396,7 +402,7 @@ attr struct type *name##_RB_MINMAX(struct name *, int); \ #define RB_GENERATE(name, type, field, cmp) \ RB_GENERATE_INTERNAL(name, type, field, cmp,) #define RB_GENERATE_STATIC(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp, static) + RB_GENERATE_INTERNAL(name, type, field, cmp, static TREE_UNUSED) #define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ attr void \ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \