* [B.A.T.M.A.N.] [PATCH] batman-adv: Add compat code for BUILD_BUG_ON_NOT_POWER_OF_2
@ 2016-01-20 9:09 Sven Eckelmann
0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2016-01-20 9:09 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
Fixes: 2c2fe0ba9ea5 ("batman-adv: ELP - creating neighbor structures")
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
---
compat-include/linux/bug.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/compat-include/linux/bug.h b/compat-include/linux/bug.h
index 124fd28..0c46158 100644
--- a/compat-include/linux/bug.h
+++ b/compat-include/linux/bug.h
@@ -24,6 +24,19 @@
#include <linux/version.h>
#include_next <linux/bug.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+
+#undef BUILD_BUG_ON_NOT_POWER_OF_2
+#ifdef __CHECKER__
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
+#else
+/* Force a compilation error if a constant expression is not a power of 2 */
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
+ BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
+#endif
+
+#endif /* < KERNEL_VERSION(2, 6, 33) */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
#undef BUILD_BUG_ON
--
2.7.0.rc3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-20 9:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 9:09 [B.A.T.M.A.N.] [PATCH] batman-adv: Add compat code for BUILD_BUG_ON_NOT_POWER_OF_2 Sven Eckelmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).