提交 824d4062 编写于 作者: J James Almer

compat/atomics/gcc: use __typeof__ instead of typeof

The typeof keyword is apparently not available when using the -std=c99 option.

Fixes the use of C11 atomic functions with old GCC.
Reviewed-by: NMuhammad Faiz <mfcc64@gmail.com>
Signed-off-by: NJames Almer <jamrial@gmail.com>
上级 3796fb26
......@@ -100,8 +100,8 @@ do { \
#define atomic_exchange(object, desired) \
({ \
typeof(object) _obj = (object); \
typeof(*object) _old; \
__typeof__(object) _obj = (object); \
__typeof__(*object) _old; \
do \
_old = atomic_load(_obj); \
while (!__sync_bool_compare_and_swap(_obj, _old, (desired))); \
......@@ -113,8 +113,8 @@ do { \
#define atomic_compare_exchange_strong(object, expected, desired) \
({ \
typeof(object) _exp = (expected); \
typeof(*object) _old = *_exp; \
__typeof__(object) _exp = (expected); \
__typeof__(*object) _old = *_exp; \
*_exp = __sync_val_compare_and_swap((object), _old, (desired)); \
*_exp == _old; \
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册