2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2017-2022 Mnemosyne LLC.
|
2022-02-07 16:25:02 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2017-06-08 07:24:12 +00:00
|
|
|
|
2021-10-17 20:17:18 +00:00
|
|
|
#include <cstdarg>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
2017-06-08 07:24:12 +00:00
|
|
|
|
|
|
|
#include "tr-assert.h"
|
|
|
|
|
|
|
|
#if !defined(NDEBUG) || defined(TR_FORCE_ASSERTIONS)
|
|
|
|
|
2021-10-15 03:16:52 +00:00
|
|
|
[[noreturn]] bool tr_assert_report(char const* file, int line, char const* message_fmt, ...)
|
2017-06-08 07:24:12 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, message_fmt);
|
|
|
|
|
|
|
|
fprintf(stderr, "assertion failed: ");
|
|
|
|
vfprintf(stderr, message_fmt, args);
|
|
|
|
fprintf(stderr, " (%s:%d)\n", file, line);
|
|
|
|
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|