From 6561b12ebf41a77d17e80bb8641a9a43e1752e44 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 22 Apr 2024 10:06:49 +0200 Subject: [PATCH] all: use defines for attributes --- include/base/nl-base-utils.h | 4 ++-- lib/route/cls/ematch/container.c | 2 +- lib/route/nh.c | 2 +- lib/xfrm/sa.c | 4 ++-- lib/xfrm/sp.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/base/nl-base-utils.h b/include/base/nl-base-utils.h index 03d568e2..a155bbad 100644 --- a/include/base/nl-base-utils.h +++ b/include/base/nl-base-utils.h @@ -816,8 +816,8 @@ static inline void nl_write_unlock(pthread_rwlock_t *lock) } #else -#define NL_LOCK(NAME) int __unused_lock_##NAME __attribute__((unused)) -#define NL_RW_LOCK(NAME) int __unused_lock_##NAME __attribute__((unused)) +#define NL_LOCK(NAME) int __unused_lock_##NAME _nl_unused +#define NL_RW_LOCK(NAME) int __unused_lock_##NAME _nl_unused #define nl_lock(LOCK) \ do { \ diff --git a/lib/route/cls/ematch/container.c b/lib/route/cls/ematch/container.c index ea2d1666..d7e5a3af 100644 --- a/lib/route/cls/ematch/container.c +++ b/lib/route/cls/ematch/container.c @@ -10,7 +10,7 @@ #include "nl-route.h" -static int container_parse(struct rtnl_ematch *e, void *data, size_t len __attribute__((unused))) +static int container_parse(struct rtnl_ematch *e, void *data, size_t len) { /* The kernel may provide more than 4 bytes of data in the future and we want diff --git a/lib/route/nh.c b/lib/route/nh.c index 1072172d..40ce5d43 100644 --- a/lib/route/nh.c +++ b/lib/route/nh.c @@ -176,7 +176,7 @@ static void nexthop_keygen(struct nl_object *obj, uint32_t *hashkey, unsigned int lkey_sz; struct nexthop_hash_key { uint32_t nh_id; - } __attribute__((packed)) lkey; + } _nl_packed lkey; lkey_sz = sizeof(lkey); lkey.nh_id = nexthop->nh_id; diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c index 0c89c715..2fe387d7 100644 --- a/lib/xfrm/sa.c +++ b/lib/xfrm/sa.c @@ -2372,12 +2372,12 @@ static struct nl_cache_ops xfrmnl_sa_ops = { * @{ */ -static void __attribute__ ((constructor)) xfrm_sa_init(void) +static void _nl_init xfrm_sa_init(void) { nl_cache_mngt_register(&xfrmnl_sa_ops); } -static void __attribute__ ((destructor)) xfrm_sa_exit(void) +static void _nl_exit xfrm_sa_exit(void) { nl_cache_mngt_unregister(&xfrmnl_sa_ops); } diff --git a/lib/xfrm/sp.c b/lib/xfrm/sp.c index 3491fd70..642fbcbe 100644 --- a/lib/xfrm/sp.c +++ b/lib/xfrm/sp.c @@ -1281,7 +1281,7 @@ int xfrmnl_sp_get_sec_ctx (struct xfrmnl_sp* sp, unsigned int* len, unsigned int * * @return 0 if sucessfull, else -1 */ -int xfrmnl_sp_set_sec_ctx (struct xfrmnl_sp* sp, unsigned int len __attribute__((unused)), unsigned int exttype, unsigned int alg, unsigned int doi, unsigned int ctx_len, char* ctx_str) +int xfrmnl_sp_set_sec_ctx (struct xfrmnl_sp* sp, unsigned int len, unsigned int exttype, unsigned int alg, unsigned int doi, unsigned int ctx_len, char* ctx_str) { /* Free up the old context string and allocate new one */ if (sp->sec_ctx) @@ -1450,12 +1450,12 @@ static struct nl_cache_ops xfrmnl_sp_ops = { * @{ */ -static void __attribute__ ((constructor)) xfrm_sp_init(void) +static void _nl_init xfrm_sp_init(void) { nl_cache_mngt_register(&xfrmnl_sp_ops); } -static void __attribute__ ((destructor)) xfrm_sp_exit(void) +static void _nl_exit xfrm_sp_exit(void) { nl_cache_mngt_unregister(&xfrmnl_sp_ops); }