Browse Source
Merge pull request #4577 from lioncash/asserts
common/assert: Make use of C++ attribute syntax
pull/15/merge
bunnei
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
3 deletions
-
src/common/assert.h
|
|
|
@ -17,11 +17,12 @@ |
|
|
|
// enough for our purposes. |
|
|
|
template <typename Fn> |
|
|
|
#if defined(_MSC_VER) |
|
|
|
__declspec(noinline, noreturn) |
|
|
|
[[msvc::noinline, noreturn]] |
|
|
|
#elif defined(__GNUC__) |
|
|
|
__attribute__((noinline, noreturn, cold)) |
|
|
|
[[gnu::cold, gnu::noinline, noreturn]] |
|
|
|
#endif |
|
|
|
static void assert_noinline_call(const Fn& fn) { |
|
|
|
static void |
|
|
|
assert_noinline_call(const Fn& fn) { |
|
|
|
fn(); |
|
|
|
Crash(); |
|
|
|
exit(1); // Keeps GCC's mouth shut about this actually returning |
|
|
|
|