[PATCH 1/2] kernel.h: introduce BUILD_BUG_ON_NOT_SAME_TYPE

From: Marc Kleine-Budde
Date: Wed Feb 16 2011 - 16:56:08 EST


This patch introduces BUILD_BUG_ON_NOT_SAME_TYPE which forces a compilation
error if the two supplied variables don't have the same type.

Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
include/linux/kernel.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2fe6e84..b637d57 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -612,6 +612,8 @@ extern int __build_bug_on_failed;
} while(0)
#endif

+#define BUILD_BUG_ON_NOT_SAME_TYPE(a, b) BUILD_BUG_ON(!__same_type((a), (b)));
+
/* Trap pasters of __FUNCTION__ at compile-time */
#define __FUNCTION__ (__func__)

--
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/