1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_ERROR_H
|
---|
8 | #define CR_ERROR_H
|
---|
9 |
|
---|
10 | #include <iprt/cdefs.h>
|
---|
11 |
|
---|
12 | #ifdef __cplusplus
|
---|
13 | extern "C" {
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #ifndef __GNUC__
|
---|
17 | #define NORETURN_PRINTF
|
---|
18 | #define PRINTF
|
---|
19 | #elif defined IN_GUEST
|
---|
20 | #define NORETURN_PRINTF __attribute__ ((__noreturn__,format(printf,1,2)))
|
---|
21 | #define PRINTF __attribute__ ((format(printf,1,2)))
|
---|
22 | #else
|
---|
23 | #define NORETURN_PRINTF
|
---|
24 | #define PRINTF
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | DECLEXPORT(void) crEnableWarnings(int onOff);
|
---|
28 |
|
---|
29 | DECLEXPORT(void) crDebug(const char *format, ... ) PRINTF;
|
---|
30 | DECLEXPORT(void) crWarning(const char *format, ... ) PRINTF;
|
---|
31 | DECLEXPORT(void) crInfo(const char *format, ... ) PRINTF;
|
---|
32 |
|
---|
33 | DECLEXPORT(void) crError(const char *format, ... ) NORETURN_PRINTF;
|
---|
34 |
|
---|
35 | /* Throw more info while opengl is not stable */
|
---|
36 | #if defined(DEBUG) || 1
|
---|
37 | # ifdef DEBUG_misha
|
---|
38 | # include <iprt/assert.h>
|
---|
39 | # define CRASSERT Assert
|
---|
40 | //extern int g_VBoxFbgFBreakDdi;
|
---|
41 | # define CR_DDI_PROLOGUE() do { /*if (g_VBoxFbgFBreakDdi) {Assert(0);}*/ } while (0)
|
---|
42 | # else
|
---|
43 | # define CRASSERT( PRED ) ((PRED)?(void)0:crError( "Assertion failed: %s, file %s, line %d", #PRED, __FILE__, __LINE__))
|
---|
44 | # define CR_DDI_PROLOGUE() do {} while (0)
|
---|
45 | # endif
|
---|
46 | # define THREADASSERT( PRED ) ((PRED)?(void)0:crError( "Are you trying to run a threaded app ?\nBuild with 'make threadsafe'\nAssertion failed: %s, file %s, line %d", #PRED, __FILE__, __LINE__))
|
---|
47 | #else
|
---|
48 | # define CRASSERT( PRED ) ((void)0)
|
---|
49 | # define THREADASSERT( PRED ) ((void)0)
|
---|
50 | # define CR_DDI_PROLOGUE() do {} while (0)
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #ifdef __cplusplus
|
---|
54 | }
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | #endif /* CR_ERROR_H */
|
---|