Repository navigation
Expand file tree
/
Copy pathdebug.h
More file actions
42 lines (37 loc) · 2.11 KB
/
Copy pathdebug.h
File metadata and controls
42 lines (37 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef DEBUG_H
#define DEBUG_H
#ifndef DEBUG
#define DEBUG 0
#endif
#include <stdio.h>
#include <stdlib.h>
#define UNUSED(x) (void)(x)
#define UNIMPLEMENTED(func_name) \
do { \
if (DEBUG) { \
frintf("INFO: '%s' is not implemented in file: %s line: %d \n", \
func_name, __FILE__, __LINE__); \
exit(1); \
} \
} while (0)
#define TODO(action) \
do { \
if (DEBUG) { \
printf("TODO: '%s' in file: %s line: %d \n", action, __FILE__, \
__LINE__); \
} \
} while (0)
#define LOG_ERROR(...) \
do { \
if (DEBUG) { \
fprintf(stderr, "ERROR:"); \
fprintf(stderr, __VA_ARGS__); \
} \
} while (0)
#define LOG_INFO(...) \
do { \
if (DEBUG) { \
fprintf(stderr, __VA_ARGS__); \
} \
} while (0)
#endif