extern void *rcu_dereference_sym_bp(void *p);
#define rcu_dereference_bp(p) \
({ \
- typeof(p) _________p1 = URCU_FORCE_CAST(typeof(p), \
+ __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \
rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \
(_________p1); \
})
extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new);
#define rcu_cmpxchg_pointer_bp(p, old, _new) \
({ \
- typeof(*(p)) _________pold = (old); \
- typeof(*(p)) _________pnew = (_new); \
- typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \
- rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p),\
+ __typeof__(*(p)) _________pold = (old); \
+ __typeof__(*(p)) _________pnew = (_new); \
+ __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
+ rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \
_________pold, \
_________pnew)); \
(_________p1); \
extern void *rcu_xchg_pointer_sym_bp(void **p, void *v);
#define rcu_xchg_pointer_bp(p, v) \
({ \
- typeof(*(p)) _________pv = (v); \
- typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \
+ __typeof__(*(p)) _________pv = (v); \
+ __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)),\
rcu_xchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \
_________pv)); \
(_________p1); \
extern void *rcu_set_pointer_sym_bp(void **p, void *v);
#define rcu_set_pointer_bp(p, v) \
({ \
- typeof(*(p)) _________pv = (v); \
- typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \
+ __typeof__(*(p)) _________pv = (v); \
+ __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
rcu_set_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \
_________pv)); \
(_________p1); \
extern void *rcu_dereference_sym(void *p);
#define rcu_dereference(p) \
({ \
- typeof(p) _________p1 = URCU_FORCE_CAST(typeof(p), \
+ __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \
rcu_dereference_sym(URCU_FORCE_CAST(void *, p))); \
(_________p1); \
})
extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
#define rcu_cmpxchg_pointer(p, old, _new) \
({ \
- typeof(*(p)) _________pold = (old); \
- typeof(*(p)) _________pnew = (_new); \
- typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \
- rcu_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p),\
+ __typeof__(*(p)) _________pold = (old); \
+ __typeof__(*(p)) _________pnew = (_new); \
+ __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
+ rcu_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
_________pold, \
_________pnew)); \
(_________p1); \
extern void *rcu_xchg_pointer_sym(void **p, void *v);
#define rcu_xchg_pointer(p, v) \
({ \
- typeof(*(p)) _________pv = (v); \
- typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \
+ __typeof__(*(p)) _________pv = (v); \
+ __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
rcu_xchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
_________pv)); \
(_________p1); \
extern void *rcu_set_pointer_sym(void **p, void *v);
#define rcu_set_pointer(p, v) \
do { \
- typeof(*(p)) _________pv = (v); \
+ __typeof__(*(p)) _________pv = (v); \
(void) rcu_set_pointer_sym(URCU_FORCE_CAST(void **, p), \
_________pv); \
} while (0)
* use is to mediate communication between process-level code and irq/NMI
* handlers, all running on the same CPU.
*/
-#define CMM_ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+#define CMM_ACCESS_ONCE(x) (*(volatile __typeof__(x) *)&(x))
#ifndef caa_max
#define caa_max(a,b) ((a)>(b)?(a):(b))
*/
#define caa_container_of(ptr, type, member) \
({ \
- const typeof(((type *) NULL)->member) * __ptr = (ptr); \
+ const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \
(type *)((char *)__ptr - offsetof(type, member)); \
})
#define cds_hlist_for_each_entry(entry, pos, head, member) \
for (pos = (head)->next, \
- entry = cds_hlist_entry(pos, typeof(*entry), member); \
+ entry = cds_hlist_entry(pos, __typeof__(*entry), member); \
pos != NULL; \
pos = pos->next, \
- entry = cds_hlist_entry(pos, typeof(*entry), member))
+ entry = cds_hlist_entry(pos, __typeof__(*entry), member))
#define cds_hlist_for_each_entry_safe(entry, pos, p, head, member) \
for (pos = (head)->next, \
- entry = cds_hlist_entry(pos, typeof(*entry), member); \
+ entry = cds_hlist_entry(pos, __typeof__(*entry), member); \
(pos != NULL) && ({ p = pos->next; 1;}); \
pos = p, \
- entry = cds_hlist_entry(pos, typeof(*entry), member))
+ entry = cds_hlist_entry(pos, __typeof__(*entry), member))
#endif /* _KCOMPAT_HLIST_H */
pos = p, p = pos->prev)
#define cds_list_for_each_entry(pos, head, member) \
- for (pos = cds_list_entry((head)->next, typeof(*pos), member); \
+ for (pos = cds_list_entry((head)->next, __typeof__(*pos), member); \
&pos->member != (head); \
- pos = cds_list_entry(pos->member.next, typeof(*pos), member))
+ pos = cds_list_entry(pos->member.next, __typeof__(*pos), member))
#define cds_list_for_each_entry_reverse(pos, head, member) \
- for (pos = cds_list_entry((head)->prev, typeof(*pos), member); \
+ for (pos = cds_list_entry((head)->prev, __typeof__(*pos), member); \
&pos->member != (head); \
- pos = cds_list_entry(pos->member.prev, typeof(*pos), member))
+ pos = cds_list_entry(pos->member.prev, __typeof__(*pos), member))
#define cds_list_for_each_entry_safe(pos, p, head, member) \
- for (pos = cds_list_entry((head)->next, typeof(*pos), member), \
- p = cds_list_entry(pos->member.next,typeof(*pos), member); \
+ for (pos = cds_list_entry((head)->next, __typeof__(*pos), member), \
+ p = cds_list_entry(pos->member.next, __typeof__(*pos), member); \
&pos->member != (head); \
- pos = p, p = cds_list_entry(pos->member.next, typeof(*pos), member))
+ pos = p, p = cds_list_entry(pos->member.next, __typeof__(*pos), member))
static inline int cds_list_empty(struct cds_list_head *head)
{
#define cds_hlist_for_each_entry_rcu(entry, pos, head, member) \
for (pos = rcu_dereference((head)->next), \
- entry = cds_hlist_entry(pos, typeof(*entry), member); \
+ entry = cds_hlist_entry(pos, __typeof__(*entry), member); \
pos != NULL; \
pos = rcu_dereference(pos->next), \
- entry = cds_hlist_entry(pos, typeof(*entry), member))
+ entry = cds_hlist_entry(pos, __typeof__(*entry), member))
#endif /* _URCU_RCUHLIST_H */
#define cds_lfht_for_each_entry(ht, iter, pos, member) \
for (cds_lfht_first(ht, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
- typeof(*(pos)), member); \
+ __typeof__(*(pos)), member); \
&(pos)->member != NULL; \
cds_lfht_next(ht, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
- typeof(*(pos)), member))
+ __typeof__(*(pos)), member))
#define cds_lfht_for_each_entry_duplicate(ht, hash, match, key, \
iter, pos, member) \
for (cds_lfht_lookup(ht, hash, match, key, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
- typeof(*(pos)), member); \
+ __typeof__(*(pos)), member); \
&(pos)->member != NULL; \
cds_lfht_next_duplicate(ht, match, key, iter), \
pos = caa_container_of(cds_lfht_iter_get_node(iter), \
- typeof(*(pos)), member))
+ __typeof__(*(pos)), member))
#ifdef __cplusplus
}
/* Iterate through elements of the list.
*/
#define cds_list_for_each_entry_rcu(pos, head, member) \
- for (pos = cds_list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
+ for (pos = cds_list_entry(rcu_dereference((head)->next), __typeof__(*pos), member); \
&pos->member != (head); \
- pos = cds_list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
+ pos = cds_list_entry(rcu_dereference(pos->member.next), __typeof__(*pos), member))
#endif /* _URCU_RCULIST_H */
*/
#define _rcu_dereference(p) ({ \
- typeof(p) _________p1 = CMM_LOAD_SHARED(p); \
+ __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \
cmm_smp_read_barrier_depends(); \
(_________p1); \
})
#define _rcu_cmpxchg_pointer(p, old, _new) \
({ \
- typeof(*p) _________pold = (old); \
- typeof(*p) _________pnew = (_new); \
+ __typeof__(*p) _________pold = (old); \
+ __typeof__(*p) _________pnew = (_new); \
if (!__builtin_constant_p(_new) || \
((_new) != NULL)) \
cmm_wmb(); \
#define _rcu_xchg_pointer(p, v) \
({ \
- typeof(*p) _________pv = (v); \
+ __typeof__(*p) _________pv = (v); \
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
cmm_wmb(); \
#define _rcu_set_pointer(p, v) \
do { \
- typeof(*p) _________pv = (v); \
+ __typeof__(*p) _________pv = (v); \
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
cmm_wmb(); \
*/
#define CMM_STORE_SHARED(x, v) \
({ \
- typeof(x) _v = _CMM_STORE_SHARED(x, v); \
+ __typeof__(x) _v = _CMM_STORE_SHARED(x, v); \
cmm_smp_wmc(); \
_v; \
})