Andrei G has uploaded this change for review.
core/hash: do not use __always_inline in a public header
include/osmocom/core/hash.h declares hash_64_generic() with
__always_inline. That spelling was imported with the file from the Linux
kernel. glibc defines the macro in <sys/cdefs.h>, so it happens to work
there. Darwin, FreeBSD and OpenBSD do not define it, and every consumer of
hash.h fails to compile with clang: "unknown type name '__always_inline'",
followed by "call to undeclared function 'hash_64_generic'" further down.
Use the spelling the neighbouring public header already uses:
include/osmocom/core/log2.h declares fls() and fls64() as
static inline __attribute__((always_inline))
The #ifndef __always_inline guard used in src/core/conv_acc_sse_impl.h and
conv_acc_neon_impl.h is the other in-tree option, but those are private
sources; a public header should not define a reserved identifier for its
includers.
hash.h stayed unnoticed because libosmo-sigtran is the first consumer to
include hashtable.h. Reproduced on macOS ARM64 with clang 17 (Xcode 16).
The same failure is expected on FreeBSD and OpenBSD with base clang.
Change-Id: I103831bacde6d2f3f2a140812cd1e2300298bab5
Signed-off-by: Andrei Gosman <andrei.gosman@gmail.com>
---
M include/osmocom/core/hash.h
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/71/43571/1
diff --git a/include/osmocom/core/hash.h b/include/osmocom/core/hash.h
index b45c036..a435105 100644
--- a/include/osmocom/core/hash.h
+++ b/include/osmocom/core/hash.h
@@ -73,7 +73,7 @@
#ifndef HAVE_ARCH_HASH_64
#define hash_64 hash_64_generic
#endif
-static __always_inline uint32_t hash_64_generic(uint64_t val, unsigned int bits)
+static inline __attribute__((always_inline)) uint32_t hash_64_generic(uint64_t val, unsigned int bits)
{
#if BITS_PER_LONG == 64
/* 64x64-bit multiply is efficient on all 64-bit processors */
To view, visit change 43571. To unsubscribe, or for help writing mail filters, visit settings.