summaryrefslogblamecommitdiffstats
path: root/src/common/assert.cpp
blob: 1a85faccfee44dad0b86b83ba2f7526cf9854003 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                               

                          

                                
                            
 
                                                                            
                             




                                                 
     
 




                                                 
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "common/assert.h"
#include "common/common_funcs.h"

#include "common/settings.h"

void assert_check_condition(bool cond, std::function<void()>&& on_failure) {
    if (!cond) [[unlikely]] {
        on_failure();

        if (Settings::values.use_debug_asserts) {
            Crash();
        }
    }
}

[[noreturn]] void unreachable_impl() {
    Crash();
    throw std::runtime_error("Unreachable code");
}