[Midnightbsd-cvs] src [11928] trunk/sys/sys/event.h: Bring in a fix for EV_SET macro from FreeBSD that allows newer compilers to

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jul 20 18:38:48 EDT 2018


Revision: 11928
          http://svnweb.midnightbsd.org/src/?rev=11928
Author:   laffer1
Date:     2018-07-20 18:38:47 -0400 (Fri, 20 Jul 2018)
Log Message:
-----------
Bring in a fix for EV_SET macro from FreeBSD that allows newer compilers to
to use C99 features to fix issues rather than introducing a var into the mix.

Modified Paths:
--------------
    trunk/sys/sys/event.h

Modified: trunk/sys/sys/event.h
===================================================================
--- trunk/sys/sys/event.h	2018-07-20 22:36:04 UTC (rev 11927)
+++ trunk/sys/sys/event.h	2018-07-20 22:38:47 UTC (rev 11928)
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: stable/10/sys/sys/event.h 311772 2017-01-09 10:13:53Z kib $
+ * $FreeBSD: stable/10/sys/sys/event.h 336200 2018-07-11 14:56:38Z dab $
  */
 
 #ifndef _SYS_EVENT_H_
@@ -45,6 +45,21 @@
 #define EVFILT_USER		(-11)	/* User events */
 #define EVFILT_SYSCOUNT		11
 
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define	EV_SET(kevp_, a, b, c, d, e, f) do {	\
+	*(kevp_) = (struct kevent){		\
+	    .ident = (a),			\
+	    .filter = (b),			\
+	    .flags = (c),			\
+	    .fflags = (d),			\
+	    .data = (e),			\
+	    .udata = (f),			\
+	};					\
+} while(0)
+#else /* Pre-C99 or not STDC (e.g., C++) */
+/* The definition of the local variable kevp could possibly conflict
+ * with a user-defined value passed in parameters a-f.
+ */
 #define EV_SET(kevp_, a, b, c, d, e, f) do {	\
 	struct kevent *kevp = (kevp_);		\
 	(kevp)->ident = (a);			\
@@ -54,6 +69,7 @@
 	(kevp)->data = (e);			\
 	(kevp)->udata = (f);			\
 } while(0)
+#endif
 
 struct kevent {
 	uintptr_t	ident;		/* identifier for this event */



More information about the Midnightbsd-cvs mailing list