From b604f9dea81b91f888fc723c6601e62b0c5b2350 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Thu, 9 Mar 2017 18:31:12 +0100 Subject: [PATCH] compiler.h: Mock up a __builtin_types_compatible_p for C++ As g++/clang++ does not have one. --- include/linux/compiler.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 0a047fd..16410cf 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -78,6 +78,18 @@ extern void __chk_io_ptr(const volatile void __iomem *); #include #endif +#ifdef __cplusplus +/* C++ does not have __builtin_types_compatible_p, mock one up */ +template struct _types_compatible_p { + static const int result = 0; +}; + +template struct _types_compatible_p { + static const int result = 1; +}; + +#define __builtin_types_compatible_p( type1, type2 ) _types_compatible_p< type1, type2 >::result +#endif /* * Generic compiler-dependent macros required for kernel * build go below this comment. Actual compiler/compiler version -- 2.10.2