Rodrigo Arias
2046833700
- Transform asserts into unconditional checks - Abort as soon as an error is encountered - Remove return errors
20 lines
417 B
C
20 lines
417 B
C
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
|
|
/* Debug macros */
|
|
|
|
#ifdef ENABLE_DEBUG
|
|
# define dbg(...) fprintf(stderr, __VA_ARGS__);
|
|
#else
|
|
# define dbg(...)
|
|
#endif
|
|
|
|
#define err(...) fprintf(stderr, __VA_ARGS__);
|
|
#define die(...) do { err("fatal: " __VA_ARGS__); abort(); } while (0)
|
|
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
#define UNUSED(x) (void)(x)
|
|
|
|
#endif /* COMMON_H */
|