Merge pull request #4577 from lioncash/asserts

common/assert: Make use of C++ attribute syntax
This commit is contained in:
bunnei 2020-08-27 11:09:02 -04:00 committed by GitHub
commit 3f7b0e0772
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,11 +17,12 @@
// enough for our purposes. // enough for our purposes.
template <typename Fn> template <typename Fn>
#if defined(_MSC_VER) #if defined(_MSC_VER)
__declspec(noinline, noreturn) [[msvc::noinline, noreturn]]
#elif defined(__GNUC__) #elif defined(__GNUC__)
__attribute__((noinline, noreturn, cold)) [[gnu::cold, gnu::noinline, noreturn]]
#endif #endif
static void assert_noinline_call(const Fn& fn) { static void
assert_noinline_call(const Fn& fn) {
fn(); fn();
Crash(); Crash();
exit(1); // Keeps GCC's mouth shut about this actually returning exit(1); // Keeps GCC's mouth shut about this actually returning