git » swiftpm » main » tree

[main] / Sources / c_borogove / iinclude / CrashHandler.h

#pragma once
#include <string>
#include <cstdio>

namespace AppCore {
    [[noreturn]] void TerminateWithMessage(const std::string& message);
}

#define myassert(cond) \
    do { \
        if (!(cond)) { \
            char buffer[1024]; \
            snprintf(buffer, sizeof(buffer), "ASSERT FAILED: %s (%s:%d)", \
                     #cond, __FILE__, __LINE__); \
            AppCore::TerminateWithMessage(buffer); \
        } \
    } while(0)