mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 08:23:56 +01:00
ircd::simt: Improve assert related; fix 83114172
argument name.
This commit is contained in:
parent
2609c21913
commit
a50f9fbd1b
1 changed files with 14 additions and 8 deletions
|
@ -15,17 +15,23 @@
|
|||
// Trapping assert() on supporting platforms.
|
||||
//
|
||||
|
||||
#if defined(__OPENCL_VERSION__)
|
||||
// assert macro is ignored/untouched unless outer conditions met
|
||||
#if defined(__OPENCL_VERSION__) \
|
||||
&& !defined(assert) \
|
||||
&& true
|
||||
|
||||
// assert expression is enabled or elided
|
||||
#if __OPENCL_VERSION__ >= 200 \
|
||||
&& !defined(assert) \
|
||||
&& __has_builtin(__builtin_trap) \
|
||||
&& !defined(NDEBUG) \
|
||||
&& __has_builtin(__builtin_trap)
|
||||
#define assert(expr) \
|
||||
({ \
|
||||
if(unlikely(!(bool)(x))) \
|
||||
__builtin_trap(); \
|
||||
&& true
|
||||
#define assert(expr) \
|
||||
({ \
|
||||
if(unlikely(!(bool)(expr))) \
|
||||
__builtin_trap(); \
|
||||
})
|
||||
#else
|
||||
#define assert(x)
|
||||
#define assert(expr)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue