diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2022-10-30 00:41:21 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2022-10-30 01:14:59 +0300 |
commit | bc37e8d8399eef686b71341aa90eced9bc117786 (patch) | |
tree | 92e4af388150209df9bc44e2cba6f2f303aa7baf /intern/cycles/util/defines.h | |
parent | 552abb838c76d44a0d7d1226b59a1ab381e88386 (diff) | |
parent | d1d2f002c7caaf4ab457ec27bbc44666d7aac624 (diff) |
Merge remote-tracking branch 'origin/master' into principled-v2
Diffstat (limited to 'intern/cycles/util/defines.h')
-rw-r--r-- | intern/cycles/util/defines.h | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/intern/cycles/util/defines.h b/intern/cycles/util/defines.h index 115a747cf1c..1969529eff0 100644 --- a/intern/cycles/util/defines.h +++ b/intern/cycles/util/defines.h @@ -81,7 +81,7 @@ /* macros */ /* hints for branch prediction, only use in code that runs a _lot_ */ -#if defined(__GNUC__) && defined(__KERNEL_CPU__) +#if defined(__GNUC__) && !defined(__KERNEL_GPU__) # define LIKELY(x) __builtin_expect(!!(x), 1) # define UNLIKELY(x) __builtin_expect(!!(x), 0) #else @@ -89,46 +89,6 @@ # define UNLIKELY(x) (x) #endif -#if defined(__GNUC__) || defined(__clang__) -# if defined(__cplusplus) -/* Some magic to be sure we don't have reference in the type. */ -template<typename T> static inline T decltype_helper(T x) -{ - return x; -} -# define TYPEOF(x) decltype(decltype_helper(x)) -# else -# define TYPEOF(x) typeof(x) -# endif -#endif - -/* Causes warning: - * incompatible types when assigning to type 'Foo' from type 'Bar' - * ... the compiler optimizes away the temp var */ -#ifdef __GNUC__ -# define CHECK_TYPE(var, type) \ - { \ - TYPEOF(var) * __tmp; \ - __tmp = (type *)NULL; \ - (void)__tmp; \ - } \ - (void)0 - -# define CHECK_TYPE_PAIR(var_a, var_b) \ - { \ - TYPEOF(var_a) * __tmp; \ - __tmp = (typeof(var_b) *)NULL; \ - (void)__tmp; \ - } \ - (void)0 -#else -# define CHECK_TYPE(var, type) -# define CHECK_TYPE_PAIR(var_a, var_b) -#endif - -/* can be used in simple macros */ -#define CHECK_TYPE_INLINE(val, type) ((void)(((type)0) != (val))) - #ifndef __KERNEL_GPU__ # include <cassert> # define util_assert(statement) assert(statement) @@ -136,4 +96,7 @@ template<typename T> static inline T decltype_helper(T x) # define util_assert(statement) #endif +#define CONCAT_HELPER(a, ...) a##__VA_ARGS__ +#define CONCAT(a, ...) CONCAT_HELPER(a, __VA_ARGS__) + #endif /* __UTIL_DEFINES_H__ */ |