From: Rafael Zalamena Date: Mon, 19 Jun 2017 16:24:04 +0000 (-0300) Subject: lib: fix __unused compilation on old platforms X-Git-Tag: reindent-master-before~62^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b19ad86195435f6ef84ebf0303ba03d8f79cd7fc;p=mirror%2Ffrr.git lib: fix __unused compilation on old platforms Expand the macro __attribute__ to avoid problem with old platforms that do not define this. --- diff --git a/lib/openbsd-tree.h b/lib/openbsd-tree.h index 8436615c27..22cb9252f5 100644 --- a/lib/openbsd-tree.h +++ b/lib/openbsd-tree.h @@ -362,122 +362,118 @@ int _rb_check(const struct rb_type *, void *, unsigned long); #define RB_INITIALIZER(_head) { { NULL } } -#ifndef __unused -#define __unused __attribute__((__unused__)) -#endif /* __unused */ - #define RB_PROTOTYPE(_name, _type, _field, _cmp) \ extern const struct rb_type *const _name##_RB_TYPE; \ \ -__unused static inline void \ +__attribute__((__unused__)) static inline void \ _name##_RB_INIT(struct _name *head) \ { \ _rb_init(&head->rbh_root); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_INSERT(struct _name *head, struct _type *elm) \ { \ return _rb_insert(_name##_RB_TYPE, &head->rbh_root, elm); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_REMOVE(struct _name *head, struct _type *elm) \ { \ return _rb_remove(_name##_RB_TYPE, &head->rbh_root, elm); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_FIND(struct _name *head, const struct _type *key) \ { \ return _rb_find(_name##_RB_TYPE, &head->rbh_root, key); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_NFIND(struct _name *head, const struct _type *key) \ { \ return _rb_nfind(_name##_RB_TYPE, &head->rbh_root, key); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_ROOT(struct _name *head) \ { \ return _rb_root(_name##_RB_TYPE, &head->rbh_root); \ } \ \ -__unused static inline int \ +__attribute__((__unused__)) static inline int \ _name##_RB_EMPTY(struct _name *head) \ { \ return _rb_empty(&head->rbh_root); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_MIN(struct _name *head) \ { \ return _rb_min(_name##_RB_TYPE, &head->rbh_root); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_MAX(struct _name *head) \ { \ return _rb_max(_name##_RB_TYPE, &head->rbh_root); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_NEXT(struct _type *elm) \ { \ return _rb_next(_name##_RB_TYPE, elm); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_PREV(struct _type *elm) \ { \ return _rb_prev(_name##_RB_TYPE, elm); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_LEFT(struct _type *elm) \ { \ return _rb_left(_name##_RB_TYPE, elm); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_RIGHT(struct _type *elm) \ { \ return _rb_right(_name##_RB_TYPE, elm); \ } \ \ -__unused static inline struct _type * \ +__attribute__((__unused__)) static inline struct _type * \ _name##_RB_PARENT(struct _type *elm) \ { \ return _rb_parent(_name##_RB_TYPE, elm); \ } \ \ -__unused static inline void \ +__attribute__((__unused__)) static inline void \ _name##_RB_SET_LEFT(struct _type *elm, struct _type *left) \ { \ return _rb_set_left(_name##_RB_TYPE, elm, left); \ } \ \ -__unused static inline void \ +__attribute__((__unused__)) static inline void \ _name##_RB_SET_RIGHT(struct _type *elm, struct _type *right) \ { \ return _rb_set_right(_name##_RB_TYPE, elm, right); \ } \ \ -__unused static inline void \ +__attribute__((__unused__)) static inline void \ _name##_RB_SET_PARENT(struct _type *elm, struct _type *parent) \ { \ return _rb_set_parent(_name##_RB_TYPE, elm, parent); \ } \ \ -__unused static inline void \ +__attribute__((__unused__)) static inline void \ _name##_RB_POISON(struct _type *elm, unsigned long poison) \ { \ return _rb_poison(_name##_RB_TYPE, elm, poison); \ } \ \ -__unused static inline int \ +__attribute__((__unused__)) static inline int \ _name##_RB_CHECK(struct _type *elm, unsigned long poison) \ { \ return _rb_check(_name##_RB_TYPE, elm, poison); \