summaryrefslogtreecommitdiff
path: root/include/linux/typecheck.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/typecheck.h')
-rw-r--r--include/linux/typecheck.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h
index eb5b74a575be..46b15e2aaefb 100644
--- a/include/linux/typecheck.h
+++ b/include/linux/typecheck.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef TYPECHECK_H_INCLUDED
#define TYPECHECK_H_INCLUDED
@@ -21,4 +22,13 @@
(void)__tmp; \
})
+/*
+ * Check at compile time that something is a pointer type.
+ */
+#define typecheck_pointer(x) \
+({ typeof(x) __dummy; \
+ (void)sizeof(*__dummy); \
+ 1; \
+})
+
#endif /* TYPECHECK_H_INCLUDED */