Skip to content

Commit

Permalink
Fix compat with NetBSD >= 10
Browse files Browse the repository at this point in the history
kevent::udata was switched from intptr_t to void*.

Handle both cases with the GCC extension typeof().
  • Loading branch information
krytarowski committed Oct 3, 2019
1 parent 8d5c565 commit 72e6eff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
/* Some platforms apparently define the udata field of struct kevent as
* intptr_t, whereas others define it as void*. There doesn't seem to be an
* easy way to tell them apart via autoconf, so we need to use OS macros. */
#if defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
#if defined(__NetBSD__)
#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x))
#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
#elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
#define PTR_TO_UDATA(x) ((intptr_t)(x))
#define INT_TO_UDATA(x) ((intptr_t)(x))
#else
Expand Down

0 comments on commit 72e6eff

Please sign in to comment.