Skip to content

Commit

Permalink
unix: suppress -Waddress-of-packed-member warning
Browse files Browse the repository at this point in the history
Fixes: libuv#2418
PR-URL: libuv#2584
Refs: libuv#2580
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
  • Loading branch information
bnoordhuis committed Dec 30, 2019
1 parent af45b6b commit 5cb8860
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/unix/linux-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,19 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
have_signals = 0;
nevents = 0;

assert(loop->watchers != NULL);
loop->watchers[loop->nwatchers] = (void*) events;
loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
{
/* Squelch a -Waddress-of-packed-member warning with gcc >= 9. */
union {
struct epoll_event* events;
uv__io_t* watchers;
} x;

x.events = events;
assert(loop->watchers != NULL);
loop->watchers[loop->nwatchers] = x.watchers;
loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
}

for (i = 0; i < nfds; i++) {
pe = events + i;
fd = pe->data.fd;
Expand Down

0 comments on commit 5cb8860

Please sign in to comment.