fix some MSVC compile problems
[reactos.git] / reactos / lib / crt / include / internal / debug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: include/msvcrt/msvcrtdbg.h
5 * PURPOSE: Useful debugging macros
6 * PROGRAMMER:
7 * UPDATE HISTORY:
8 *
9 */
10
11 /*
12 * NOTE: Define NDEBUG before including this header to disable debugging
13 * macros
14 */
15
16 #ifndef __MSVCRT_DEBUG
17 #define __MSVCRT_DEBUG
18
19 #include <roscfg.h>
20 #include <windows.h>
21
22
23 #define MK_STR(s) #s
24
25 #ifdef _UNICODE
26 #define sT "S"
27 #else
28 #define sT "s"
29 #endif
30
31 unsigned long DbgPrint(char *Format,...);
32
33 #ifdef __GNUC__
34 #define TRACE(...)
35 #endif
36
37 #ifdef DBG
38 #ifdef __GNUC__
39 #define DPRINT1(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
40 #else
41 #define DPRINT1 DbgPrint
42 #endif
43 #define CHECKPOINT1 do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
44 #else
45 #ifdef __GNUC__
46 #define DPRINT1(args...)
47 #else
48 #define DPRINT DbgPrint
49 #endif
50 #define CHECKPOINT1
51 #endif
52
53 #if !defined(NDEBUG) && defined(DBG)
54 #ifdef __GNUC__
55 #define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
56 #endif
57 #define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
58 #else
59 #ifdef __GNUC__
60 #define DPRINT(args...)
61 #else
62 #define DPRINT DbgPrint
63 #endif
64 #define CHECKPOINT
65 #endif /* NDEBUG */
66
67
68 #if 0
69
70 #define TRACE_RETURN(format_str, ret_type) \
71 ret_type __return_value__; \
72 static char* __return_format_str__ = "%s ret: "format_str"\n"
73
74 #define FUNCTION(func) \
75 static char* __func_name__ = #func
76
77 #define TRACE(a,b...) DPRINT1(a"\n", b)
78
79 #define RETURN(a) \
80 do{ __return_value__ = (a); DPRINT1(__return_format_str__ ,__func_name__,__return_value__); return __return_value__ ; }while(0)
81
82 #endif
83
84
85 /* ULONG CDECL DbgPrint(PCH Format, ...); */
86 ULONG DbgPrint(PCH Format,...);
87 /* unsigned long DbgPrint(const char* Format, ...); */
88
89
90
91 /* #define TRACE 0 ? (void)0 : Trace */
92
93 /* void Trace(TCHAR* lpszFormat, ...); */
94
95
96
97 #endif /* __MSVCRT_DEBUG */