I propose the following patch to enhance the EV_SET compat with
alternative kqueue/kevent implementations:

http://netbsd.org/~kamil/patch-00133-EV_SET-cpp.4.txt

The current problem:

Cast of udata from void* to intptr_t shall be done with
reinterpret_cast<> otherwise a C++ compiler errors.

Defining __REINTERPRET_CAST [1] and using it, did not work as a compiler
protested for NULL argument "warning: passing NULL to non-pointer argument".

Using double cast __REINTERPRET_CAST(intptr_t, __CAST(void *, (udata)))
pacified the warning/error about passing NULL in C++, but it created the
problem of calling EV_SET using the native argument type intptr_t.

Proposed solution:
 - use C code as it is

 - add C++ ifdef block that replaces cast with the C++ feature to
overload function with a custom argument; define _EV_SET that accepts
void* in udata; hide reinterpret_cast<>() inside the second function

Tested by nia@.

I would like to pull it into -9 and maybe into -8.

[1]
 #ifdef __cplusplus
-#define __CAST(__dt, __st)     static_cast<__dt>(__st)
+#define __CAST(__dt, __st)             static_cast<__dt>(__st)
+#define __REINTERPRET_CAST(__dt, __st) reinterpret_cast<__dt>(__st)
 #else
-#define __CAST(__dt, __st)     ((__dt)(__st))
+#define __CAST(__dt, __st)             ((__dt)(__st))
+#define __REINTERPRET_CAST(__dt, __st) ((__dt)(__st))
 #endif

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to