aboutsummaryrefslogtreecommitdiff
path: root/src/core/assert.h
blob: eee1c963647d85550f11c86b24832c62d9c95ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

#include "core/log.h"

#include <exception>

#ifdef HSDBG_DIST
    #define HSDBG_ASSERT(condition, message) ((void)0)
#else
    #define HSDBG_ASSERT(condition, message)                                             \
        do                                                                               \
        {                                                                                \
            if (!(condition))                                                            \
            {                                                                            \
                ::Hsdbg::Log::error("assertion failed: {}", #condition);                 \
                ::Hsdbg::Log::error("  {}:{}: {}", __FILE__, __LINE__, message);         \
                std::terminate();                                                        \
            }                                                                            \
        } while (false)
#endif