2022-04-23 20:49:07 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2021-04-08 00:30:26 +02:00
|
|
|
|
|
|
|
#include "common/assert.h"
|
2021-04-14 05:52:45 +02:00
|
|
|
#include "common/common_funcs.h"
|
2021-04-08 00:30:26 +02:00
|
|
|
|
2021-04-15 04:05:28 +02:00
|
|
|
#include "common/settings.h"
|
2021-04-14 05:52:45 +02:00
|
|
|
|
2022-06-10 22:06:26 +02:00
|
|
|
void assert_check_condition(bool cond, std::function<void()>&& on_failure) {
|
|
|
|
if (!cond) [[unlikely]] {
|
|
|
|
on_failure();
|
|
|
|
|
|
|
|
if (Settings::values.use_debug_asserts) {
|
|
|
|
Crash();
|
|
|
|
}
|
2021-04-14 05:52:45 +02:00
|
|
|
}
|
|
|
|
}
|
2022-06-10 22:06:26 +02:00
|
|
|
|
|
|
|
[[noreturn]] void unreachable_impl() {
|
|
|
|
Crash();
|
|
|
|
throw std::runtime_error("Unreachable code");
|
|
|
|
}
|