common: add simple DBG_ENABLED() macros
[cdsspec-compiler.git] / common.h
1 #ifndef __COMMON_H__
2 #define __COMMON_H__
3
4 #include <stdio.h>
5
6 //#define CONFIG_DEBUG
7
8 #ifdef CONFIG_DEBUG
9 #define DEBUG(fmt, ...) do { printf("*** %25s(): line %-4d *** " fmt, __func__, __LINE__, ##__VA_ARGS__); } while (0)
10 #define DBG() DEBUG("\n");
11 #define DBG_ENABLED() (1)
12 #else
13 #define DEBUG(fmt, ...)
14 #define DBG()
15 #define DBG_ENABLED() (0)
16 #endif
17
18 void * myMalloc(size_t size);
19 void myFree(void *ptr);
20
21 #define userMalloc(size)        malloc(size)
22 #define userFree(ptr)           free(ptr)
23
24 #endif /* __COMMON_H__ */