fix various problems with my 64-bit clean hack
[model-checker.git] / common.h
1 #ifndef __COMMON_H__
2 #define __COMMON_H__
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include "mymemory.h"
7
8 #define CONFIG_DEBUG
9
10 #ifdef CONFIG_DEBUG
11 #define DEBUG(fmt, ...) do { printf("*** %25s(): line %-4d *** " fmt, __func__, __LINE__, ##__VA_ARGS__); } while (0)
12 #define DBG() DEBUG("\n");
13 #define DBG_ENABLED() (1)
14 #else
15 #define DEBUG(fmt, ...)
16 #define DBG()
17 #define DBG_ENABLED() (0)
18 #endif
19
20 #define ASSERT(expr) \
21 do { \
22         if (!(expr)) { \
23                 fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \
24                 exit(1); \
25         } \
26 } while (0);
27
28
29 #define userMalloc(size)        malloc(size)
30 #define userFree(ptr)           free(ptr)
31
32 #endif /* __COMMON_H__ */