Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Add fallback defintion for C++ of _EV_SET with the l...



details:   https://anonhg.NetBSD.org/src/rev/312e1abc2879
branches:  trunk
changeset: 964638:312e1abc2879
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Aug 10 11:20:50 2019 +0000

description:
Add fallback defintion for C++ of _EV_SET with the last argument of type 0

Converting 0 to intptr and void* is ambiguous according to a C++ compiler.
New _EV_SET() accepts int type and casts it with static_cast<int>() to
intptr_t.

Reported and fix tested by <John D. Baker>

diffstat:

 sys/sys/event.h |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 49574fa7dca7 -r 312e1abc2879 sys/sys/event.h
--- a/sys/sys/event.h   Sat Aug 10 08:46:09 2019 +0000
+++ b/sys/sys/event.h   Sat Aug 10 11:20:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: event.h,v 1.33 2019/08/06 11:21:59 kamil Exp $ */
+/*     $NetBSD: event.h,v 1.34 2019/08/10 11:20:50 kamil Exp $ */
 
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon%FreeBSD.org@localhost>
@@ -79,6 +79,14 @@
        _EV_SET(_kevp, _ident, _filter, _flags, _fflags, _data,
            reinterpret_cast<intptr_t>(_udata));
 }
+
+static __inline void
+_EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter,
+    uint32_t _flags, uint32_t _fflags, int64_t _data, int _udata)
+{
+       _EV_SET(_kevp, _ident, _filter, _flags, _fflags, _data,
+           static_cast<intptr_t>(_udata));
+}
 #else
 #define EV_SET(kevp, ident, filter, flags, fflags, data, udata)        \
     _EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \



Home | Main Index | Thread Index | Old Index