laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/43571?usp=email )

Change subject: core/hash: avoid __always_inline in public header
......................................................................

core/hash: avoid __always_inline in 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 <[email protected]>
---
M include/osmocom/core/hash.h
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve




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 https://gerrit.osmocom.org/c/libosmocore/+/43571?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I103831bacde6d2f3f2a140812cd1e2300298bab5
Gerrit-Change-Number: 43571
Gerrit-PatchSet: 2
Gerrit-Owner: Andrei G <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to