Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-video-z64/src/rgl_assert.h
2 views
1
/*
2
* z64
3
*
4
* Copyright (C) 2007 ziggy
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, write to the Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
**/
21
22
#ifndef _RGL_ASSERT_H_
23
#define _RGL_ASSERT_H_
24
25
#include <stdio.h>
26
27
#ifdef RGL_ASSERT
28
inline void _rglAssert(int test, const char * s, int line, const char * file) {
29
if (!test) {
30
fprintf(stderr, "z64 assert failed (%s : %d) : %s\n", file, line, s);
31
fflush(stdout);
32
fflush(stderr);
33
*(unsigned int *)0 = 0xdeadbeef; // hopefully will generate a segfault
34
exit(-1);
35
}
36
}
37
#define rglAssert(test) _rglAssert((test), #test, __LINE__, __FILE__)
38
#else
39
#define rglAssert(test)
40
#endif
41
42
#endif
43
44