Blender  V2.93
BLI_assert.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
23 #include "BLI_assert.h" /* Own include. */
24 #include "BLI_system.h"
25 
26 #include <stdio.h>
27 #include <stdlib.h>
28 
29 void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id)
30 {
31  fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", file, line, function, id);
32 }
33 
34 void _BLI_assert_unreachable_print(const char *file, const int line, const char *function)
35 {
36  fprintf(stderr, "Code marked as unreachable has been executed. Please report this as a bug.\n");
37  fprintf(stderr, "Error found at %s:%d in %s.\n", file, line, function);
38 }
39 
41 {
42 #ifndef NDEBUG
43  BLI_system_backtrace(stderr);
44 #endif
45 }
46 
55 {
56  abort();
57 }
void _BLI_assert_print_backtrace(void)
Definition: BLI_assert.c:40
void _BLI_assert_unreachable_print(const char *file, const int line, const char *function)
Definition: BLI_assert.c:34
void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id)
Definition: BLI_assert.c:29
void _BLI_assert_abort(void)
Definition: BLI_assert.c:54
void BLI_system_backtrace(FILE *fp)
Definition: system.c:79
FILE * file