[PATCH 17/75] 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 | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 backport/backport-include/linux/kernel.h

diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h
new file mode 100644
index 00000000..e2cd309e
--- /dev/null
+++ b/backport/backport-include/linux/kernel.h
@@ -0,0 +1,18 @@
+#ifndef __BACKPORT_KERNEL_H
+#define __BACKPORT_KERNEL_H
+#include_next <linux/kernel.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 */
+
+#endif /* __BACKPORT_KERNEL_H */
-- 
2.45.2





[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