diff options
Diffstat (limited to 'prelude')
| -rw-r--r-- | prelude/slang-cpp-prelude.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/prelude/slang-cpp-prelude.h b/prelude/slang-cpp-prelude.h index b2a8dd6ac..84a61f929 100644 --- a/prelude/slang-cpp-prelude.h +++ b/prelude/slang-cpp-prelude.h @@ -207,6 +207,9 @@ Any platforms not detected by the above logic are now now explicitly zeroed out. // GCC Specific #if SLANG_GCC_FAMILY # define SLANG_ALIGN_OF(T) __alignof__(T) + +# define SLANG_BREAKPOINT(id) __builtin_trap() + // Use this macro instead of offsetof, because gcc produces warning if offsetof is used on a // non POD type, even though it produces the correct result # define SLANG_OFFSET_OF(T, ELEMENT) (size_t(&((T*)1)->ELEMENT) - 1) @@ -215,6 +218,9 @@ Any platforms not detected by the above logic are now now explicitly zeroed out. // Microsoft VC specific #if SLANG_VC # define SLANG_ALIGN_OF(T) __alignof(T) + +# define SLANG_BREAKPOINT(id) __debugbreak(); + #endif // SLANG_VC // Default impls @@ -223,6 +229,11 @@ Any platforms not detected by the above logic are now now explicitly zeroed out. # define SLANG_OFFSET_OF(X, Y) offsetof(X, Y) #endif +#ifndef SLANG_BREAKPOINT +// Make it crash with a write to 0! +# define SLANG_BREAKPOINT(id) (*((int*)0) = int(id)); +#endif + // If slang.h has been included we don't need any of these definitions #ifndef SLANG_H |
