netbsd_fixup.patch raw

   1  Improve portability on NetBSD
   2  
   3  According to GCC documentation, "the various `-std` options disable
   4  certain keywords".
   5  This change adheres to GCC's recommendation by replacing the `typeof`
   6  keyword with its alternative, `__typeof__`.
   7  
   8  See https://github.com/libevent/libevent/commit/1759485e9a59147a47a674f5132fcfe764e7748c.
   9  
  10  
  11  --- a/kqueue.c
  12  +++ b/kqueue.c
  13  @@ -52,8 +52,8 @@
  14    * intptr_t, whereas others define it as void*.  There doesn't seem to be an
  15    * easy way to tell them apart via autoconf, so we need to use OS macros. */
  16   #if defined(__NetBSD__)
  17  -#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x))
  18  -#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
  19  +#define PTR_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(x))
  20  +#define INT_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(intptr_t)(x))
  21   #elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
  22   #define PTR_TO_UDATA(x)	((intptr_t)(x))
  23   #define INT_TO_UDATA(x) ((intptr_t)(x))
  24