Zth (libzth)
assert.cpp
Go to the documentation of this file.
1 /*
2  * Zth (libzth), a cooperative userspace multitasking library.
3  * Copyright (C) 2019-2022 Jochem Rutgers
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
8  */
9 
10 #include <libzth/util.h>
11 
12 namespace zth {
13 
14 #ifndef ZTH_OS_WINDOWS
15 __attribute__((weak))
16 #endif
17 void assert_handler(char const* file, int line, char const* expr)
18 {
20  abort("assertion failed at %s:%d: %s", file ? file : "?", line, expr ? expr : "?");
21  else
22  abort("assertion failed at %s:%d", file ? file : "?", line);
23 }
24 
25 } // namespace zth
void abort(char const *fmt,...) noexcept
Aborts the process after printing the given printf() formatted message.
Definition: util.cpp:130
Definition: allocator.h:23
void assert_handler(char const *file, int line, char const *expr)
Definition: assert.cpp:17
static bool const EnableFullAssert
Show failing expression in case of a failed assert.
Definition: config.h:69