svn commit: r361722 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Tue Jun 2 09:45:44 UTC 2020


Author: hselasky
Date: Tue Jun  2 09:45:43 2020
New Revision: 361722
URL: https://svnweb.freebsd.org/changeset/base/361722

Log:
  Implement BUILD_BUG_ON_ZERO() in the LinuxKPI.
  Tested using gcc and clang.
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 03:44:22 2020	(r361721)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 09:45:43 2020	(r361722)
@@ -94,6 +94,9 @@
 #define	BUILD_BUG_ON_NOT_POWER_OF_2(x)	BUILD_BUG_ON(!powerof2(x))
 #define	BUILD_BUG_ON_INVALID(expr)	while (0) { (void)(expr); }
 
+extern const volatile int lkpi_build_bug_on_zero;
+#define	BUILD_BUG_ON_ZERO(x)	((x) ? lkpi_build_bug_on_zero : 0)
+
 #define	BUG()			panic("BUG at %s:%d", __FILE__, __LINE__)
 #define	BUG_ON(cond)		do {				\
 	if (cond) {						\


More information about the svn-src-head mailing list