Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Feb 2020 16:56:59 +0000 (UTC)
From:      Pawel Biernacki <kaktus@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357921 - head/sys/sys
Message-ID:  <202002141656.01EGuxYO033976@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kaktus
Date: Fri Feb 14 16:56:59 2020
New Revision: 357921
URL: https://svnweb.freebsd.org/changeset/base/357921

Log:
  sysctl(9): properly use xor in ENFORCE_FLAGS macro
  
  Assert on not specifying any of the (soon to be) required flags as well
   as specifying both of them.
  
  Pointed out by:	cem, hselasky
  Reviewed by:	hselasky, kib
  Approved by:	kib (mentor)
  Differential Revision:	https://reviews.freebsd.org/D23678

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Fri Feb 14 15:04:56 2020	(r357920)
+++ head/sys/sys/sysctl.h	Fri Feb 14 16:56:59 2020	(r357921)
@@ -270,9 +270,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
 #define	__DESCR(d) ""
 #endif
 
-#ifdef notyet
+#ifdef	notyet
 #define	SYSCTL_ENFORCE_FLAGS(x)						\
-    _Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)),	\
+    _Static_assert((((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0), \
         "Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")
 #else
 #define	SYSCTL_ENFORCE_FLAGS(x)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002141656.01EGuxYO033976>