Zth (libzth)
Loading...
Searching...
No Matches
zth_assert_handler.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019-2026 Jochem Rutgers
3 *
4 * SPDX-License-Identifier: MPL-2.0
5 */
6
7#include <libzth/util.h>
8
10
11#ifndef ZTH_OS_WINDOWS
12__attribute__((weak))
13#endif
14void zth_assert_handler(char const* file, int line, char const* expr)
15{
17 ::zth_indirection.zth_assert_handler(file, line, expr);
19 }
20
23 "assertion failed at %s:%d: %s", file ? file : "?", line,
24 expr ? expr : "?");
25 else
26 zth::abort("assertion failed at %s:%d", file ? file : "?", line);
27}
void abort(char const *fmt,...) noexcept
Aborts the process after printing the given printf() formatted message.
Definition util.cpp:149
zth_indirection_t zth_indirection
static bool const EnableFullAssert
Show failing expression in case of a failed assert.
Definition config.h:85
zth_assert_handler_t * zth_assert_handler
Definition indirection.h:50
void zth_terminate()
Terminate immediately.
void zth_assert_handler(char const *file, int line, char const *expr)