Skip to content

Commit 2d6d1fd

Browse files
authored
Merge pull request #334 from compnerd/reserved-asm
use reserved spelling for inline assembly
2 parents dc01e36 + cfa1ad8 commit 2d6d1fd

23 files changed

+90
-94
lines changed

os/object_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#endif
8787
#define OS_OBJECT_OBJC_CLASS_DECL(name) \
8888
extern void *OS_OBJECT_CLASS_SYMBOL(name) \
89-
asm(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name)))
89+
__asm__(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name)))
9090
#else
9191
#define OS_OBJECT_HAVE_OBJC1 0
9292
#define OS_OBJECT_HAVE_OBJC2 0

src/apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ dispatch_apply_f(size_t iterations, dispatch_queue_t dq, void *ctxt,
285285
.dc_ctxt = ctxt,
286286
.dc_data = dq,
287287
};
288-
dispatch_apply_t da = (typeof(da))_dispatch_continuation_alloc();
288+
dispatch_apply_t da = (__typeof__(da))_dispatch_continuation_alloc();
289289
da->da_index = 0;
290290
da->da_todo = iterations;
291291
da->da_iterations = iterations;

src/block.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ extern "C" {
109109
// The compiler hides the name of the function it generates, and changes it if
110110
// we try to reference it directly, but the linker still sees it.
111111
extern void DISPATCH_BLOCK_SPECIAL_INVOKE(void *)
112-
#if defined(__linux__) || defined(__FreeBSD__)
113-
asm("___dispatch_block_create_block_invoke");
114-
#else
115-
asm("____dispatch_block_create_block_invoke");
116-
#endif
112+
__asm__(OS_STRINGIFY(__USER_LABEL_PREFIX__) "___dispatch_block_create_block_invoke");
117113
void (*_dispatch_block_special_invoke)(void*) = DISPATCH_BLOCK_SPECIAL_INVOKE;
118114
}
119115

src/event/event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ _dispatch_unote_create(dispatch_source_type_t dst,
4949
du->du_can_be_wlh = dst->dst_per_trigger_qos;
5050
du->du_ident = (uint32_t)handle;
5151
du->du_filter = dst->dst_filter;
52-
du->du_fflags = (typeof(du->du_fflags))mask;
52+
du->du_fflags = (__typeof__(du->du_fflags))mask;
5353
if (dst->dst_flags & EV_UDATA_SPECIFIC) {
5454
du->du_is_direct = true;
5555
}

src/event/event_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
#if DISPATCH_TIMER_ASSERTIONS
6262
#define DISPATCH_TIMER_ASSERT(a, op, b, text) ({ \
63-
typeof(a) _a = (a); \
63+
__typeof__(a) _a = (a); \
6464
if (unlikely(!(_a op (b)))) { \
6565
DISPATCH_CLIENT_CRASH(_a, "Timer: " text); \
6666
} \

src/event/event_kevent.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define DISPATCH_KEVENT_MUXED_MARKER 1ul
3333
#define DISPATCH_MACH_AUDIT_TOKEN_PID (5)
3434

35-
#define dispatch_kevent_udata_t typeof(((dispatch_kevent_t)NULL)->udata)
35+
#define dispatch_kevent_udata_t __typeof__(((dispatch_kevent_t)NULL)->udata)
3636

3737
typedef struct dispatch_muxnote_s {
3838
TAILQ_ENTRY(dispatch_muxnote_s) dmn_list;
@@ -738,9 +738,9 @@ _dispatch_kq_unote_set_kevent(dispatch_unote_t _du, dispatch_kevent_t dk,
738738
.flags = flags,
739739
.udata = (dispatch_kevent_udata_t)du,
740740
.fflags = du->du_fflags | dst->dst_fflags,
741-
.data = (typeof(dk->data))dst->dst_data,
741+
.data = (__typeof__(dk->data))dst->dst_data,
742742
#if DISPATCH_USE_KEVENT_QOS
743-
.qos = (typeof(dk->qos))pp,
743+
.qos = (__typeof__(dk->qos))pp,
744744
#endif
745745
};
746746
(void)pp; // if DISPATCH_USE_KEVENT_QOS == 0
@@ -1778,7 +1778,7 @@ _dispatch_mach_notify_update(dispatch_muxnote_t dmn, uint32_t new_flags,
17781778
mach_port_mscount_t notify_sync)
17791779
{
17801780
mach_port_t previous, port = (mach_port_t)dmn->dmn_kev.ident;
1781-
typeof(dmn->dmn_kev.data) prev = dmn->dmn_kev.data;
1781+
__typeof__(dmn->dmn_kev.data) prev = dmn->dmn_kev.data;
17821782
kern_return_t kr, krr = 0;
17831783

17841784
// Update notification registration state.

src/firehose/firehose_buffer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
#define DISPATCH_PURE_C 1
2929
#define _safe_cast_to_long(x) \
30-
({ _Static_assert(sizeof(typeof(x)) <= sizeof(long), \
30+
({ _Static_assert(sizeof(__typeof__(x)) <= sizeof(long), \
3131
"__builtin_expect doesn't support types wider than long"); \
3232
(long)(x); })
33-
#define fastpath(x) ((typeof(x))__builtin_expect(_safe_cast_to_long(x), ~0l))
34-
#define slowpath(x) ((typeof(x))__builtin_expect(_safe_cast_to_long(x), 0l))
33+
#define fastpath(x) ((__typeof__(x))__builtin_expect(_safe_cast_to_long(x), ~0l))
34+
#define slowpath(x) ((__typeof__(x))__builtin_expect(_safe_cast_to_long(x), 0l))
3535
#define os_likely(x) __builtin_expect(!!(x), 1)
3636
#define os_unlikely(x) __builtin_expect(!!(x), 0)
3737
#define likely(x) __builtin_expect(!!(x), 1)
@@ -54,7 +54,7 @@
5454
#endif
5555

5656
#define _dispatch_wait_until(c) ({ \
57-
typeof(c) _c; \
57+
__typeof__(c) _c; \
5858
for (;;) { \
5959
if (likely(_c = (c))) break; \
6060
dispatch_hardware_pause(); \

src/firehose/firehose_inline_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
})
2828

2929
#define firehose_atomic_max2o(p, f, v, m) ({ \
30-
typeof((p)->f) _old; \
30+
__typeof__((p)->f) _old; \
3131
firehose_atomic_maxv2o(p, f, v, &_old, m); \
3232
})
3333

src/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ void
897897
_dispatch_temporary_resource_shortage(void)
898898
{
899899
sleep(1);
900-
asm(""); // prevent tailcall
900+
__asm__ __volatile__(""); // prevent tailcall
901901
}
902902

903903
void *

src/inline_internal.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ _dispatch_queue_drain_try_unlock(dispatch_queue_t dq, uint64_t owned, bool done)
14841484
// type_t * {volatile,const,_Atomic,...} -> type_t *
14851485
// type_t[] -> type_t *
14861486
#define os_unqualified_pointer_type(expr) \
1487-
typeof(typeof(*(expr)) *)
1487+
__typeof__(__typeof__(*(expr)) *)
14881488

14891489
#define os_mpsc_node_type(q, _ns) \
14901490
os_unqualified_pointer_type((q)->_ns##_head)
@@ -1525,7 +1525,7 @@ _dispatch_queue_drain_try_unlock(dispatch_queue_t dq, uint64_t owned, bool done)
15251525
_dispatch_wait_until(os_atomic_load2o(_n, _o_next, dependency))
15261526

15271527
#define os_mpsc_pop_head(q, _ns, head, _o_next) ({ \
1528-
typeof(q) _q = (q); \
1528+
__typeof__(q) _q = (q); \
15291529
os_mpsc_node_type(_q, _ns) _head = (head), _n; \
15301530
_n = os_atomic_load2o(_head, _o_next, dependency); \
15311531
os_atomic_store2o(_q, _ns##_head, _n, relaxed); \
@@ -1540,7 +1540,7 @@ _dispatch_queue_drain_try_unlock(dispatch_queue_t dq, uint64_t owned, bool done)
15401540
})
15411541

15421542
#define os_mpsc_undo_pop_head(q, _ns, head, next, _o_next) ({ \
1543-
typeof(q) _q = (q); \
1543+
__typeof__(q) _q = (q); \
15441544
os_mpsc_node_type(_q, _ns) _head = (head), _n = (next); \
15451545
if (unlikely(!_n && \
15461546
!os_atomic_cmpxchg2o(_q, _ns##_tail, NULL, _head, relaxed))) { \
@@ -1551,7 +1551,7 @@ _dispatch_queue_drain_try_unlock(dispatch_queue_t dq, uint64_t owned, bool done)
15511551
})
15521552

15531553
#define os_mpsc_capture_snapshot(q, _ns, tail) ({ \
1554-
typeof(q) _q = (q); \
1554+
__typeof__(q) _q = (q); \
15551555
os_mpsc_node_type(_q, _ns) _head = os_mpsc_get_head(q, _ns); \
15561556
os_atomic_store2o(_q, _ns##_head, NULL, relaxed); \
15571557
/* 22708742: set tail to NULL with release, so that NULL write */ \
@@ -1568,7 +1568,7 @@ _dispatch_queue_drain_try_unlock(dispatch_queue_t dq, uint64_t owned, bool done)
15681568
_n; })
15691569

15701570
#define os_mpsc_prepend(q, _ns, head, tail, _o_next) ({ \
1571-
typeof(q) _q = (q); \
1571+
__typeof__(q) _q = (q); \
15721572
os_mpsc_node_type(_q, _ns) _head = (head), _tail = (tail), _n; \
15731573
os_atomic_store2o(_tail, _o_next, NULL, relaxed); \
15741574
if (unlikely(!os_atomic_cmpxchg2o(_q, _ns##_tail, NULL, _tail, release))) { \

src/internal.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,11 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
354354
/* I wish we had __builtin_expect_range() */
355355
#if __GNUC__
356356
#define _safe_cast_to_long(x) \
357-
({ _Static_assert(sizeof(typeof(x)) <= sizeof(long), \
357+
({ _Static_assert(sizeof(__typeof__(x)) <= sizeof(long), \
358358
"__builtin_expect doesn't support types wider than long"); \
359359
(long)(x); })
360-
#define fastpath(x) ((typeof(x))__builtin_expect(_safe_cast_to_long(x), ~0l))
361-
#define slowpath(x) ((typeof(x))__builtin_expect(_safe_cast_to_long(x), 0l))
360+
#define fastpath(x) ((__typeof__(x))__builtin_expect(_safe_cast_to_long(x), ~0l))
361+
#define slowpath(x) ((__typeof__(x))__builtin_expect(_safe_cast_to_long(x), 0l))
362362
#define likely(x) __builtin_expect(!!(x), 1)
363363
#define unlikely(x) __builtin_expect(!!(x), 0)
364364
#else
@@ -455,7 +455,7 @@ void _dispatch_log(const char *msg, ...);
455455
if (__builtin_constant_p(e)) { \
456456
dispatch_static_assert(e); \
457457
} else { \
458-
typeof(e) _e = (e); /* always eval 'e' */ \
458+
__typeof__(e) _e = (e); /* always eval 'e' */ \
459459
if (unlikely(DISPATCH_DEBUG && !_e)) { \
460460
_dispatch_abort(__LINE__, (long)_e); \
461461
} \
@@ -479,7 +479,7 @@ _dispatch_assert(long e, size_t line)
479479
if (__builtin_constant_p(e)) { \
480480
dispatch_static_assert(e); \
481481
} else { \
482-
typeof(e) _e = (e); /* always eval 'e' */ \
482+
__typeof__(e) _e = (e); /* always eval 'e' */ \
483483
if (unlikely(DISPATCH_DEBUG && _e)) { \
484484
_dispatch_abort(__LINE__, (long)_e); \
485485
} \
@@ -502,7 +502,7 @@ _dispatch_assert_zero(long e, size_t line)
502502
*/
503503
#if __GNUC__
504504
#define dispatch_assume(e) ({ \
505-
typeof(e) _e = (e); /* always eval 'e' */ \
505+
__typeof__(e) _e = (e); /* always eval 'e' */ \
506506
if (unlikely(!_e)) { \
507507
if (__builtin_constant_p(e)) { \
508508
dispatch_static_assert(e); \
@@ -527,7 +527,7 @@ _dispatch_assume(long e, long line)
527527
*/
528528
#if __GNUC__
529529
#define dispatch_assume_zero(e) ({ \
530-
typeof(e) _e = (e); /* always eval 'e' */ \
530+
__typeof__(e) _e = (e); /* always eval 'e' */ \
531531
if (unlikely(_e)) { \
532532
if (__builtin_constant_p(e)) { \
533533
dispatch_static_assert(e); \
@@ -554,7 +554,7 @@ _dispatch_assume_zero(long e, long line)
554554
if (__builtin_constant_p(e)) { \
555555
dispatch_static_assert(e); \
556556
} else { \
557-
typeof(e) _e = (e); /* always eval 'e' */ \
557+
__typeof__(e) _e = (e); /* always eval 'e' */ \
558558
if (unlikely(DISPATCH_DEBUG && !_e)) { \
559559
_dispatch_log("%s() 0x%lx: " msg, __func__, (long)_e, ##args); \
560560
abort(); \
@@ -563,7 +563,7 @@ _dispatch_assume_zero(long e, long line)
563563
} while (0)
564564
#else
565565
#define dispatch_debug_assert(e, msg, args...) do { \
566-
typeof(e) _e = (e); /* always eval 'e' */ \
566+
__typeof__(e) _e = (e); /* always eval 'e' */ \
567567
if (unlikely(DISPATCH_DEBUG && !_e)) { \
568568
_dispatch_log("%s() 0x%lx: " msg, __FUNCTION__, _e, ##args); \
569569
abort(); \
@@ -594,7 +594,7 @@ _dispatch_object_debug(dispatch_object_t object, const char *message, ...);
594594
((dispatch_function_t)((struct Block_layout *)bb)->invoke)
595595
void *_dispatch_Block_copy(void *block);
596596
#if __GNUC__
597-
#define _dispatch_Block_copy(x) ((typeof(x))_dispatch_Block_copy(x))
597+
#define _dispatch_Block_copy(x) ((__typeof__(x))_dispatch_Block_copy(x))
598598
#endif
599599
void _dispatch_call_block_and_release(void *block);
600600
#endif /* __BLOCKS__ */

src/introspection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,15 @@ dispatch_introspection_hooks_s _dispatch_introspection_hook_callouts_enabled = {
439439
(slowpath(_dispatch_introspection_hooks.h))
440440

441441
#define DISPATCH_INTROSPECTION_HOOK_CALLOUT(h, ...) ({ \
442-
typeof(_dispatch_introspection_hooks.h) _h; \
442+
__typeof__(_dispatch_introspection_hooks.h) _h; \
443443
_h = _dispatch_introspection_hooks.h; \
444444
if (slowpath((void*)(_h) != DISPATCH_INTROSPECTION_NO_HOOK)) { \
445445
_h(__VA_ARGS__); \
446446
} })
447447

448448
#define DISPATCH_INTROSPECTION_INTERPOSABLE_HOOK(h) \
449449
DISPATCH_EXPORT void _dispatch_introspection_hook_##h(void) \
450-
asm("_dispatch_introspection_hook_" #h); \
450+
__asm__("_dispatch_introspection_hook_" #h); \
451451
void _dispatch_introspection_hook_##h(void) {}
452452

453453
#define DISPATCH_INTROSPECTION_INTERPOSABLE_HOOK_CALLOUT(h, ...)\

src/io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ enum {
119119
};
120120

121121
#define _dispatch_io_Block_copy(x) \
122-
((typeof(x))_dispatch_Block_copy((dispatch_block_t)(x)))
122+
((__typeof__(x))_dispatch_Block_copy((dispatch_block_t)(x)))
123123

124124
#pragma mark -
125125
#pragma mark dispatch_io_debug
@@ -211,7 +211,7 @@ static struct dispatch_io_defaults_s {
211211
};
212212

213213
#define _dispatch_iocntl_set_default(p, v) do { \
214-
dispatch_io_defaults.p = (typeof(dispatch_io_defaults.p))(v); \
214+
dispatch_io_defaults.p = (__typeof__(dispatch_io_defaults.p))(v); \
215215
} while (0)
216216

217217
void
@@ -1829,7 +1829,7 @@ _dispatch_stream_cleanup_operations(dispatch_stream_t stream,
18291829
{
18301830
// On stream queue
18311831
dispatch_operation_t op, tmp;
1832-
typeof(*stream->operations) *operations;
1832+
__typeof__(*stream->operations) *operations;
18331833
operations = &stream->operations[DISPATCH_IO_RANDOM];
18341834
TAILQ_FOREACH_SAFE(op, operations, operation_list, tmp) {
18351835
if (!channel || op->channel == channel) {

src/object_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#if USE_OBJC
5151
#define DISPATCH_OBJC_CLASS_DECL(name) \
5252
extern void *DISPATCH_CLASS_SYMBOL(name) \
53-
asm(DISPATCH_CLASS_RAW_SYMBOL_NAME(name))
53+
__asm__(DISPATCH_CLASS_RAW_SYMBOL_NAME(name))
5454
#endif
5555

5656
// define a new proper class
@@ -65,7 +65,7 @@
6565
}; \
6666
OS_OBJECT_EXTRA_VTABLE_DECL(name, name) \
6767
extern const struct name##_vtable_s OS_OBJECT_CLASS_SYMBOL(name) \
68-
asm(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name)))
68+
__asm__(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name)))
6969

7070
#if OS_OBJECT_SWIFT3
7171
#define OS_OBJECT_INTERNAL_CLASS_DECL(name, super, ...) \
@@ -101,7 +101,7 @@
101101
struct name##_s; \
102102
OS_OBJECT_EXTRA_VTABLE_DECL(name, super) \
103103
extern const struct super##_vtable_s OS_OBJECT_CLASS_SYMBOL(name) \
104-
asm(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name)))
104+
__asm__(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name)))
105105

106106
#define DISPATCH_SUBCLASS_DECL(name, super) \
107107
OS_OBJECT_SUBCLASS_DECL(dispatch_##name, super)
@@ -590,7 +590,7 @@ size_t _dispatch_objc_debug(dispatch_object_t dou, char* buf, size_t bufsiz);
590590
* reached -1.
591591
*/
592592
#define _os_atomic_refcnt_perform2o(o, f, op, n, m) ({ \
593-
typeof(o) _o = (o); \
593+
__typeof__(o) _o = (o); \
594594
int _ref_cnt = _o->f; \
595595
if (fastpath(_ref_cnt != _OS_OBJECT_GLOBAL_REFCNT)) { \
596596
_ref_cnt = os_atomic_##op##2o(_o, f, n, m); \

src/queue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,9 +2248,9 @@ _dispatch_pthread_root_queue_create(const char *label, unsigned long flags,
22482248
sizeof(struct dispatch_root_queue_context_s) +
22492249
sizeof(struct dispatch_pthread_root_queue_context_s));
22502250
qc = (void*)dq + dqs;
2251-
dispatch_assert((uintptr_t)qc % _Alignof(typeof(*qc)) == 0);
2251+
dispatch_assert((uintptr_t)qc % _Alignof(__typeof__(*qc)) == 0);
22522252
pqc = (void*)qc + sizeof(struct dispatch_root_queue_context_s);
2253-
dispatch_assert((uintptr_t)pqc % _Alignof(typeof(*pqc)) == 0);
2253+
dispatch_assert((uintptr_t)pqc % _Alignof(__typeof__(*pqc)) == 0);
22542254
if (label) {
22552255
const char *tmp = _dispatch_strdup_if_mutable(label);
22562256
if (tmp != label) {

src/shims.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void __builtin_trap(void);
247247

248248
#if __has_feature(c_static_assert)
249249
#define __dispatch_is_array(x) \
250-
_Static_assert(!__builtin_types_compatible_p(typeof((x)[0]) *, typeof(x)), \
250+
_Static_assert(!__builtin_types_compatible_p(__typeof__((x)[0]) *, __typeof__(x)), \
251251
#x " isn't an array")
252252
#define countof(x) \
253253
({ __dispatch_is_array(x); sizeof(x) / sizeof((x)[0]); })

src/shims/atomic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
#define os_atomic(type) type _Atomic
4444

4545
#define _os_atomic_c11_atomic(p) \
46-
((typeof(*(p)) _Atomic *)(p))
46+
((__typeof__(*(p)) _Atomic *)(p))
4747

4848
// This removes the _Atomic and volatile qualifiers on the type of *p
4949
#define _os_atomic_basetypeof(p) \
50-
typeof(atomic_load_explicit(_os_atomic_c11_atomic(p), memory_order_relaxed))
50+
__typeof__(atomic_load_explicit(_os_atomic_c11_atomic(p), memory_order_relaxed))
5151

5252
#define os_atomic_load(p, m) \
5353
atomic_load_explicit(_os_atomic_c11_atomic(p), memory_order_##m)
@@ -71,7 +71,7 @@
7171
#define _os_atomic_c11_op(p, v, m, o, op) \
7272
({ _os_atomic_basetypeof(p) _v = (v), _r = \
7373
atomic_fetch_##o##_explicit(_os_atomic_c11_atomic(p), _v, \
74-
memory_order_##m); (typeof(*(p)))(_r op _v); })
74+
memory_order_##m); (__typeof__(*(p)))(_r op _v); })
7575
#define _os_atomic_c11_op_orig(p, v, m, o, op) \
7676
atomic_fetch_##o##_explicit(_os_atomic_c11_atomic(p), v, \
7777
memory_order_##m)
@@ -156,7 +156,7 @@
156156

157157
#define os_atomic_rmw_loop(p, ov, nv, m, ...) ({ \
158158
bool _result = false; \
159-
typeof(p) _p = (p); \
159+
__typeof__(p) _p = (p); \
160160
ov = os_atomic_load(_p, relaxed); \
161161
do { \
162162
__VA_ARGS__; \

src/shims/atomic_sfb.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max)
5050
"mov %[_all_ones], %[_bit]" "\n\t"
5151
"3: \n\t"
5252
: [_p] "=m" (*p), [_val] "=&r" (val), [_bit] "=&r" (bit)
53-
: [_all_ones] "i" ((typeof(bit))UINT_MAX) : "memory", "cc");
53+
: [_all_ones] "i" ((__typeof__(bit))UINT_MAX) : "memory", "cc");
5454
} else {
5555
__asm__ (
5656
"1: \n\t"
@@ -68,8 +68,8 @@ os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max)
6868
"mov %[_all_ones], %[_bit]" "\n\t"
6969
"3: \n\t"
7070
: [_p] "=m" (*p), [_val] "=&r" (val), [_bit] "=&r" (bit)
71-
: [_all_ones] "i" ((typeof(bit))UINT_MAX),
72-
[_max] "g" ((typeof(bit))max) : "memory", "cc");
71+
: [_all_ones] "i" ((__typeof__(bit))UINT_MAX),
72+
[_max] "g" ((__typeof__(bit))max) : "memory", "cc");
7373
}
7474
return (unsigned int)bit;
7575
}

0 commit comments

Comments
 (0)