diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-07 22:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-07 22:35:41 +0200 |
commit | 3173a53db9f9b97bb45d510467c939ab33eeac1e (patch) | |
tree | 7c4dfba755429a8cdffd23b7db598662f6c2023d /src/common/assert.h | |
parent | Merge pull request #6153 from lioncash/svcrange (diff) | |
parent | common: Move assert failure handling into a cpp file. (diff) | |
download | yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.tar yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.tar.gz yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.tar.bz2 yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.tar.lz yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.tar.xz yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.tar.zst yuzu-3173a53db9f9b97bb45d510467c939ab33eeac1e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/assert.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/assert.h b/src/common/assert.h index 06d7b5612..b3ba35c0f 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -4,10 +4,13 @@ #pragma once -#include <cstdlib> -#include "common/common_funcs.h" #include "common/logging/log.h" +// Sometimes we want to try to continue even after hitting an assert. +// However touching this file yields a global recompilation as this header is included almost +// everywhere. So let's just move the handling of the failed assert to a single cpp file. +void assert_handle_failure(); + // For asserts we'd like to keep all the junk executed when an assert happens away from the // important code in the function. One way of doing this is to put all the relevant code inside a // lambda and force the compiler to not inline it. Unfortunately, MSVC seems to have no syntax to @@ -17,15 +20,14 @@ // enough for our purposes. template <typename Fn> #if defined(_MSC_VER) -[[msvc::noinline, noreturn]] +[[msvc::noinline]] #elif defined(__GNUC__) -[[gnu::cold, gnu::noinline, noreturn]] +[[gnu::cold, gnu::noinline]] #endif static void assert_noinline_call(const Fn& fn) { fn(); - Crash(); - exit(1); // Keeps GCC's mouth shut about this actually returning + assert_handle_failure(); } #define ASSERT(_a_) \ |