added the ASSERT and VERIFY macros to logging to help detect problems
This commit is contained in:
12
src/log.h
12
src/log.h
@@ -8,5 +8,17 @@
|
||||
#define LDEBUG 4
|
||||
|
||||
extern void Log(int level, const char *format, ...);
|
||||
extern void Log_assert_failed(const char *test, const char *file, int line);
|
||||
|
||||
#define THIS_FILE __FILE__
|
||||
#define DECLARE_THIS_FILE() static const char THIS_FILE[] = __FILE__
|
||||
|
||||
#ifdef DEBUG_ASSERT
|
||||
#define ASSERT(x) ((x) ? (void)0 : Log_assert_failed(#x, THIS_FILE, __LINE__))
|
||||
#define VERIFY(x) ASSERT(x)
|
||||
#else
|
||||
#define ASSERT(x) ((void)0)
|
||||
#define VERIFY(x) ((void)(x))
|
||||
#endif
|
||||
|
||||
#endif /* __LOG_H_INCLUDED */
|
||||
|
||||
Reference in New Issue
Block a user