From bffe1a78002538ca976a8fd6116a085f6fe040b8 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Mon, 16 Jun 2025 21:52:16 +0100 Subject: [PATCH] Remove _always_inline_ attribute We have a single _always_inline_ instance in-tree, which lives in a header file. Just make it a "static inline", which will practically do the same thing and what we already have elsewhere in-tree. While in there drop the CAPS from ALIGN_POWER2 - it's a function, so we don't need the shouting. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/376 Signed-off-by: Lucas De Marchi --- .clang-format | 1 - shared/hash.c | 2 +- shared/macro.h | 1 - shared/util.h | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index fba64f87..a2655e8d 100644 --- a/.clang-format +++ b/.clang-format @@ -81,7 +81,6 @@ AttributeMacros: - KMOD_EXPORT - TS_EXPORT - _alignedptr_ - - _always_inline_ - _clang_suppress_alloc_ - _cleanup_ - _cleanup_free_ diff --git a/shared/hash.c b/shared/hash.c index 60090049..9e1f5ea4 100644 --- a/shared/hash.c +++ b/shared/hash.c @@ -34,7 +34,7 @@ struct hash *hash_new(unsigned int n_buckets, void (*free_value)(void *value)) { struct hash *hash; - n_buckets = ALIGN_POWER2(n_buckets); + n_buckets = align_power2(n_buckets); hash = calloc(1, sizeof(struct hash) + n_buckets * sizeof(struct hash_bucket)); if (hash == NULL) return NULL; diff --git a/shared/macro.h b/shared/macro.h index 0ad5fddc..77cc27e4 100644 --- a/shared/macro.h +++ b/shared/macro.h @@ -44,7 +44,6 @@ #define _maybe_unused_ __attribute__((unused)) #define _must_check_ __attribute__((warn_unused_result)) #define _printf_format_(a, b) __attribute__((format(printf, a, b))) -#define _always_inline_ __inline__ __attribute__((always_inline)) #define _sentinel_ __attribute__((sentinel)) #define _used_ __attribute__((used)) #define _retain_ __attribute__((retain)) diff --git a/shared/util.h b/shared/util.h index 718ecb8a..bf3f1009 100644 --- a/shared/util.h +++ b/shared/util.h @@ -88,7 +88,7 @@ unsigned long long get_backoff_delta_msec(unsigned long long tend, __p->__v = (val); \ } while (0) -static _always_inline_ unsigned int ALIGN_POWER2(unsigned int u) +static inline unsigned int align_power2(unsigned int u) { return 1 << ((sizeof(u) * 8) - __builtin_clz(u - 1)); } -- 2.47.2