blob: 7817ba3dadbc41ddad55aa94f7bc32f14e108e14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* libmisc/assert.h - More assertions
*
* Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <stdio.h> /* for fprintf(), stderr */
#include <stdlib.h> /* for abort() */
#include <libmisc/assert.h>
#ifndef NDEBUG
__attribute__((__noreturn__)) void
__assert_msg_fail(const char *expr,
const char *file, unsigned int line, const char *func,
const char *msg) {
fprintf(stderr, "error: %s:%u:%s(): assertion \"%s\" failed%s%s\n",
file, line, func,
expr,
msg ? ": " : "", msg);
abort();
}
#endif
|