| 1 | #ifndef USTERR_H |
| 2 | #define USTERR_H |
| 3 | |
| 4 | //#define DEBUG |
| 5 | #ifdef DEBUG |
| 6 | # define DBG(fmt, args...) do { fprintf(stderr, fmt "\n", ## args); fflush(stderr); } while(0) |
| 7 | #else |
| 8 | # define DBG(fmt, args...) do {} while(0) |
| 9 | #endif |
| 10 | #define WARN(fmt, args...) fprintf(stderr, "libust: WARNING: " fmt "\n", ## args); fflush(stderr) |
| 11 | #define ERR(fmt, args...) fprintf(stderr, "libust: ERROR: " fmt "\n", ## args); fflush(stderr) |
| 12 | #define BUG(fmt, args...) fprintf(stderr, "libust: BUG: " fmt "\n", ## args); fflush(stderr) |
| 13 | #define PERROR(call) perror("ust: ERROR: " call) |
| 14 | |
| 15 | #define BUG_ON(condition) do { if (unlikely(condition)) ERR("condition not respected (BUG)"); } while(0) |
| 16 | #define WARN_ON(condition) do { if (unlikely(condition)) WARN("condition not respected on line %s:%d", __FILE__, __LINE__); } while(0) |
| 17 | |
| 18 | #endif /* USTERR_H */ |