Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jun 2020 09:45:44 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361722 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <202006020945.0529jiWs041821@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {						\



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