[PATCH 17/38] backports: define __is_constexpr() for older kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gregory Greenman <gregory.greenman@xxxxxxxxx>

type=maint
ticket=none

Signed-off-by: Gregory Greenman <gregory.greenman@xxxxxxxxx>
---
 backport/backport-include/linux/kernel.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h
index 36bb755e353c..2555e3c4a0a8 100644
--- a/backport/backport-include/linux/kernel.h
+++ b/backport/backport-include/linux/kernel.h
@@ -5,6 +5,17 @@
 #include <linux/bug.h>
 #include <linux/version.h>
 
+#if LINUX_VERSION_IS_LESS(4,17,0)
+
+/*
+ * This returns a constant expression while determining if an argument is
+ * a constant expression, most importantly without evaluating the argument.
+ * Glory to Martin Uecker <Martin.Uecker@xxxxxxxxxxxxxxxxxxxxx>
+ */
+#define __is_constexpr(x) \
+	(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
+
+#endif /* < 4.17.0 */
 
 #if LINUX_VERSION_IS_LESS(4,6,0)
 #define kstrtobool LINUX_BACKPORT(kstrtobool)
-- 
2.37.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux