30 #define perr_exit(...) _generic_err_exit( 1, NULL, 1, __VA_ARGS__ ) |
30 #define perr_exit(...) _generic_err_exit( 1, NULL, 1, __VA_ARGS__ ) |
31 #define err_func(func, ...) _generic_err( 1, func, 0, __VA_ARGS__ ) |
31 #define err_func(func, ...) _generic_err( 1, func, 0, __VA_ARGS__ ) |
32 #define err_func_exit(func, ...) _generic_err_exit( 1, func, 0, __VA_ARGS__ ) |
32 #define err_func_exit(func, ...) _generic_err_exit( 1, func, 0, __VA_ARGS__ ) |
33 #define perr_func(func, ...) _generic_err( 1, func, 1, __VA_ARGS__ ) |
33 #define perr_func(func, ...) _generic_err( 1, func, 1, __VA_ARGS__ ) |
34 #define perr_func_exit(func, ...) _generic_err_exit( 1, func, 1, __VA_ARGS__ ) |
34 #define perr_func_exit(func, ...) _generic_err_exit( 1, func, 1, __VA_ARGS__ ) |
|
35 #define eerr_func(func, err, ...) _generic_err( 1, func, err,__VA_ARGS__ ) |
35 |
36 |
36 // error(func + colon + msg, ...) + goto error |
37 /* |
|
38 * error(func + colon + msg, ...) + goto error |
|
39 * err = negative error code |
|
40 */ |
37 #define ERROR(...) do { err_func(__func__, __VA_ARGS__); goto error; } while (0) |
41 #define ERROR(...) do { err_func(__func__, __VA_ARGS__); goto error; } while (0) |
38 #define PERROR(...) do { perr_func(__func__, __VA_ARGS__); goto error; } while (0) |
42 #define PERROR(...) do { perr_func(__func__, __VA_ARGS__); goto error; } while (0) |
|
43 #define EERROR(err, ...) do { eerr_func(__func__, (err), __VA_ARGS__); goto error; } while (0) |
39 #define FATAL(...) err_func_exit(__func__, __VA_ARGS__) |
44 #define FATAL(...) err_func_exit(__func__, __VA_ARGS__) |
40 #define PFATAL(...) perr_func_exit(__func__, __VA_ARGS__) |
45 #define PFATAL(...) perr_func_exit(__func__, __VA_ARGS__) |
41 #define WARNING(...) err_func(__func__, __VA_ARGS__) |
46 #define WARNING(...) err_func(__func__, __VA_ARGS__) |
42 #define PWARNING(...) perr_func(__func__, __VA_ARGS__) |
47 #define PWARNING(...) perr_func(__func__, __VA_ARGS__) |
|
48 #define EWARNING(err, ...) eerr_func(__func__, (err), __VA_ARGS__) |
43 |
49 |
44 #ifdef DEBUG_ENABLED |
50 #ifdef DEBUG_ENABLED |
45 #define DEBUG(...) err_func(__func__, __VA_ARGS__) |
51 #define DEBUG(...) err_func(__func__, __VA_ARGS__) |
46 #else |
52 #else |
47 #define DEBUG(...) (void) (0) |
53 #define DEBUG(...) (void) (0) |