Skip to content

Commit 3b06f54

Browse files
authored
Merge pull request swiftlang#318 from nettlep/master
A few updates to enable building on Raspberry PI/Ubuntu 16.04
2 parents 44f3640 + 4be13e6 commit 3b06f54

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/event/event_epoll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ _dispatch_timeout_program(uint32_t tidx, uint64_t target,
419419

420420
if (target < INT64_MAX) {
421421
struct itimerspec its = { .it_value = {
422-
.tv_sec = target / NSEC_PER_SEC,
422+
.tv_sec = (time_t)(target / NSEC_PER_SEC),
423423
.tv_nsec = target % NSEC_PER_SEC,
424424
} };
425425
dispatch_assume_zero(timerfd_settime(timer->det_fd, TFD_TIMER_ABSTIME,

src/source.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,15 +2023,15 @@ static inline unsigned long
20232023
_dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
20242024
{
20252025
dispatch_timer_source_refs_t dr = du._dt;
2026-
unsigned long data, prev, clear_prev = 0;
2026+
uint64_t data, prev, clear_prev = 0;
20272027

20282028
os_atomic_rmw_loop2o(ds, ds_pending_data, prev, clear_prev, relaxed, {
20292029
data = prev >> 1;
20302030
if (unlikely(prev & DISPATCH_TIMER_MISSED_MARKER)) {
20312031
os_atomic_rmw_loop_give_up(goto handle_missed_intervals);
20322032
}
20332033
});
2034-
return data;
2034+
return (unsigned long)data;
20352035

20362036
handle_missed_intervals:
20372037
// The timer may be in _dispatch_source_invoke2() already for other
@@ -2046,7 +2046,7 @@ _dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
20462046
uint64_t now = _dispatch_time_now(DISPATCH_TIMER_CLOCK(dr->du_ident));
20472047
if (now >= dr->dt_timer.target) {
20482048
OS_COMPILER_CAN_ASSUME(dr->dt_timer.interval < INT64_MAX);
2049-
data = _dispatch_source_timer_compute_missed(dr, now, data);
2049+
data = _dispatch_source_timer_compute_missed(dr, now, (unsigned long)data);
20502050
}
20512051

20522052
// When we see the MISSED_MARKER the manager has given up on this timer
@@ -2059,7 +2059,7 @@ _dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
20592059
// on the manager and make the changes to `ds_timer` above visible.
20602060
_dispatch_queue_atomic_flags_clear(ds->_as_dq, DSF_ARMED);
20612061
os_atomic_store2o(ds, ds_pending_data, 0, relaxed);
2062-
return data;
2062+
return (unsigned long)data;
20632063
}
20642064

20652065
static inline void

tests/dispatch_starfish.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ collect(void *context __attribute__((unused)))
7272

7373
printf("lap: %zd\n", lap_count_down);
7474
printf("count: %lu\n", COUNT);
75-
printf("delta: %lu ns\n", delta);
75+
printf("delta: %lu ns\n", (unsigned long)delta);
7676
printf("math: %Lf ns / lap\n", math);
7777

7878
for (i = 0; i < COUNT; i++) {

tests/dispatch_timer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ test_timer(void)
6363

6464
dispatch_source_set_event_handler(s, ^{
6565
if (!finalized) {
66-
test_long_less_than("timer number", j, stop_at);
67-
fprintf(stderr, "timer[%lu]\n", j);
66+
test_long_less_than("timer number", (long)j, stop_at);
67+
fprintf(stderr, "timer[%lu]\n", (unsigned long)j);
6868
}
6969
dispatch_release(s);
7070
});

0 commit comments

Comments
 (0)