| 1 | // Licensed to the .NET Foundation under one or more agreements. | 
|---|
| 2 | // The .NET Foundation licenses this file to you under the MIT license. | 
|---|
| 3 | // See the LICENSE file in the project root for more information. | 
|---|
| 4 |  | 
|---|
| 5 | /*****************************************************************************/ | 
|---|
| 6 |  | 
|---|
| 7 | #ifdef DEBUG | 
|---|
| 8 |  | 
|---|
| 9 | #undef printf | 
|---|
| 10 | #define printf logf | 
|---|
| 11 |  | 
|---|
| 12 | #undef fprintf | 
|---|
| 13 | #define fprintf flogf | 
|---|
| 14 |  | 
|---|
| 15 | class Compiler; | 
|---|
| 16 | class LogEnv | 
|---|
| 17 | { | 
|---|
| 18 | public: | 
|---|
| 19 | LogEnv(ICorJitInfo* aCompHnd); | 
|---|
| 20 | void setCompiler(Compiler* val) | 
|---|
| 21 | { | 
|---|
| 22 | const_cast<Compiler*&>(compiler) = val; | 
|---|
| 23 | } | 
|---|
| 24 |  | 
|---|
| 25 | ICorJitInfo* const compHnd; | 
|---|
| 26 | Compiler* const    compiler; | 
|---|
| 27 | }; | 
|---|
| 28 |  | 
|---|
| 29 | BOOL vlogf(unsigned level, const char* fmt, va_list args); | 
|---|
| 30 | int vflogf(FILE* file, const char* fmt, va_list args); | 
|---|
| 31 |  | 
|---|
| 32 | int logf(const char* fmt, ...); | 
|---|
| 33 | int flogf(FILE* file, const char* fmt, ...); | 
|---|
| 34 | void gcDump_logf(const char* fmt, ...); | 
|---|
| 35 |  | 
|---|
| 36 | void logf(unsigned level, const char* fmt, ...); | 
|---|
| 37 |  | 
|---|
| 38 | extern "C"void __cdecl assertAbort(const char* why, const char* file, unsigned line); | 
|---|
| 39 |  | 
|---|
| 40 | #undef assert | 
|---|
| 41 | #define assert(p) (void)((p) || (assertAbort(#p, __FILE__, __LINE__), 0)) | 
|---|
| 42 |  | 
|---|
| 43 | #else // DEBUG | 
|---|
| 44 |  | 
|---|
| 45 | #undef assert | 
|---|
| 46 | #define assert(p) (void)0 | 
|---|
| 47 | #endif // DEBUG | 
|---|
| 48 |  | 
|---|
| 49 | /*****************************************************************************/ | 
|---|
| 50 | #ifndef _HOST_H_ | 
|---|
| 51 | #define _HOST_H_ | 
|---|
| 52 | /*****************************************************************************/ | 
|---|
| 53 |  | 
|---|
| 54 | extern FILE* jitstdout; | 
|---|
| 55 |  | 
|---|
| 56 | inline FILE* procstdout() | 
|---|
| 57 | { | 
|---|
| 58 | return stdout; | 
|---|
| 59 | } | 
|---|
| 60 | #undef stdout | 
|---|
| 61 | #define stdout use_jitstdout | 
|---|
| 62 |  | 
|---|
| 63 | /*****************************************************************************/ | 
|---|
| 64 | #endif | 
|---|
| 65 | /*****************************************************************************/ | 
|---|
| 66 |  | 
|---|