From aafaff7640e33e6534d2d130cfbc46c791a54b8c Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 23 Nov 2014 19:09:51 +0100 Subject: [PATCH hurd 01/28] include: force all refcount functions to be inlined * include/refcount.h: Declare all functions `extern inline' instead of `static inline'. This forces those functions to be inlined, and allows us to use them in functions declared as `extern inline'. --- include/refcount.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/include/refcount.h b/include/refcount.h index ebde42d..21ac876 100644 --- a/include/refcount.h +++ b/include/refcount.h @@ -32,7 +32,7 @@ typedef unsigned int refcount_t; /* Initialize REF with REFERENCES. REFERENCES must not be zero. */ -static inline void +extern inline void refcount_init (refcount_t *ref, unsigned int references) { assert (references > 0 || !"references must not be zero!"); @@ -46,7 +46,7 @@ refcount_init (refcount_t *ref, unsigned int references) This is the unsafe version of refcount_ref. refcount_ref also checks for use-after-free errors. When in doubt, use that one instead. */ -static inline unsigned int +extern inline unsigned int refcount_unsafe_ref (refcount_t *ref) { unsigned int r; @@ -58,7 +58,7 @@ refcount_unsafe_ref (refcount_t *ref) /* Increment REF. Return the result of the operation. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline unsigned int +extern inline unsigned int refcount_ref (refcount_t *ref) { unsigned int r; @@ -70,7 +70,7 @@ refcount_ref (refcount_t *ref) /* Decrement REF. Return the result of the operation. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline unsigned int +extern inline unsigned int refcount_deref (refcount_t *ref) { unsigned int r; @@ -81,7 +81,7 @@ refcount_deref (refcount_t *ref) /* Return REF. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline unsigned int +extern inline unsigned int refcount_references (refcount_t *ref) { return __atomic_load_n (ref, __ATOMIC_RELAXED); @@ -120,7 +120,7 @@ union _references { /* Initialize REF with HARD and WEAK references. HARD and WEAK must not both be zero. */ -static inline void +extern inline void refcounts_init (refcounts_t *ref, uint32_t hard, uint32_t weak) { assert ((hard != 0 || weak != 0) || !"references must not both be zero!"); @@ -135,7 +135,7 @@ refcounts_init (refcounts_t *ref, uint32_t hard, uint32_t weak) This is the unsafe version of refcounts_ref. refcounts_ref also checks for use-after-free errors. When in doubt, use that one instead. */ -static inline void +extern inline void refcounts_unsafe_ref (refcounts_t *ref, struct references *result) { const union _references op = { .references = { .hard = 1 } }; @@ -150,7 +150,7 @@ refcounts_unsafe_ref (refcounts_t *ref, struct references *result) the result of the operation is written there. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_ref (refcounts_t *ref, struct references *result) { struct references r; @@ -165,7 +165,7 @@ refcounts_ref (refcounts_t *ref, struct references *result) the result of the operation is written there. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_deref (refcounts_t *ref, struct references *result) { const union _references op = { .references = { .hard = 1 } }; @@ -180,7 +180,7 @@ refcounts_deref (refcounts_t *ref, struct references *result) NULL, the result of the operation is written there. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_promote (refcounts_t *ref, struct references *result) { /* To promote a weak reference, we need to atomically subtract 1 @@ -211,7 +211,7 @@ refcounts_promote (refcounts_t *ref, struct references *result) NULL, the result of the operation is written there. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_demote (refcounts_t *ref, struct references *result) { /* To demote a hard reference, we need to atomically subtract 1 from @@ -243,7 +243,7 @@ refcounts_demote (refcounts_t *ref, struct references *result) This is the unsafe version of refcounts_ref_weak. refcounts_ref_weak also checks for use-after-free errors. When in doubt, use that one instead. */ -static inline void +extern inline void refcounts_unsafe_ref_weak (refcounts_t *ref, struct references *result) { const union _references op = { .references = { .weak = 1 } }; @@ -258,7 +258,7 @@ refcounts_unsafe_ref_weak (refcounts_t *ref, struct references *result) the result of the operation is written there. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_ref_weak (refcounts_t *ref, struct references *result) { struct references r; @@ -273,7 +273,7 @@ refcounts_ref_weak (refcounts_t *ref, struct references *result) the result of the operation is written there. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_deref_weak (refcounts_t *ref, struct references *result) { const union _references op = { .references = { .weak = 1 } }; @@ -287,7 +287,7 @@ refcounts_deref_weak (refcounts_t *ref, struct references *result) /* Store the current reference counts of REF in RESULT. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline void +extern inline void refcounts_references (refcounts_t *ref, struct references *result) { union _references r; @@ -298,7 +298,7 @@ refcounts_references (refcounts_t *ref, struct references *result) /* Return the hard reference count of REF. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline uint32_t +extern inline uint32_t refcounts_hard_references (refcounts_t *ref) { struct references result; @@ -309,7 +309,7 @@ refcounts_hard_references (refcounts_t *ref) /* Return the weak reference count of REF. This function uses atomic operations. It is not required to serialize calls to this function. */ -static inline uint32_t +extern inline uint32_t refcounts_weak_references (refcounts_t *ref) { struct references result; -- 2.1.3