straighten out header includes, comment on Forward declarations
[c11tester.git] / common.h
1 #ifndef __COMMON_H__
2 #define __COMMON_H__
3
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 //#define CONFIG_DEBUG
8
9 #ifdef CONFIG_DEBUG
10 #define DEBUG(fmt, ...) do { printf("*** %25s(): line %-4d *** " fmt, __func__, __LINE__, ##__VA_ARGS__); } while (0)
11 #define DBG() DEBUG("\n");
12 #define DBG_ENABLED() (1)
13 #else
14 #define DEBUG(fmt, ...)
15 #define DBG()
16 #define DBG_ENABLED() (0)
17 #endif
18
19 #define ASSERT(expr) \
20 do { \
21         if (!(expr)) { \
22                 fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \
23                 exit(1); \
24         } \
25 } while (0);
26
27
28 void * myMalloc(size_t size);
29 void myFree(void *ptr);
30
31 #define userMalloc(size)        malloc(size)
32 #define userFree(ptr)           free(ptr)
33
34 #endif /* __COMMON_H__ */