1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 18:18:10 +00:00
transmission/libtransmission/tr-assert.cc

31 lines
620 B
C++

/*
* This file Copyright (C) 2017 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include "tr-assert.h"
#if !defined(NDEBUG) || defined(TR_FORCE_ASSERTIONS)
[[noreturn]] bool tr_assert_report(char const* file, int line, char const* message_fmt, ...)
{
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