X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Ferror.h;h=6c239fe56e2ea2c041069490a79d3fff1d3f0284;hb=9bbd8e06acdcc06e6a6b22670c79a4da3e793f70;hp=3ab1d46e7126ebee9e358b6c30544919e2fe4132;hpb=354e78e57049c8cf53af0bc5cf2bfafd753affc4;p=lttng-tools.git diff --git a/src/common/error.h b/src/common/error.h index 3ab1d46e7..6c239fe56 100644 --- a/src/common/error.h +++ b/src/common/error.h @@ -75,20 +75,23 @@ extern int lttng_opt_mi; */ #define __lttng_print(type, fmt, args...) \ do { \ - if (!lttng_opt_quiet&& !lttng_opt_mi && \ - type == PRINT_MSG) { \ + if (!lttng_opt_quiet && !lttng_opt_mi && \ + (type) == PRINT_MSG) { \ fprintf(stdout, fmt, ## args); \ } else if (!lttng_opt_quiet && !lttng_opt_mi && \ - (((type & PRINT_DBG) && lttng_opt_verbose == 1) || \ - ((type & (PRINT_DBG | PRINT_DBG2)) && \ + ((((type) & PRINT_DBG) && lttng_opt_verbose == 1) || \ + (((type) & (PRINT_DBG | PRINT_DBG2)) && \ lttng_opt_verbose == 2) || \ - ((type & (PRINT_DBG | PRINT_DBG2 | PRINT_DBG3)) && \ + (((type) & (PRINT_DBG | PRINT_DBG2 | PRINT_DBG3)) && \ lttng_opt_verbose == 3))) { \ fprintf(stderr, fmt, ## args); \ } else if (!lttng_opt_quiet && \ - (type & (PRINT_WARN | PRINT_ERR | PRINT_BUG))) { \ + ((type) & (PRINT_WARN | PRINT_ERR | PRINT_BUG))) { \ fprintf(stderr, fmt, ## args); \ } \ + if ((type) & (PRINT_ERR | PRINT_BUG)) { \ + lttng_abort_on_error(); \ + } \ } while (0); /* Three level of debug. Use -v, -vv or -vvv for the levels */ @@ -103,7 +106,7 @@ extern int lttng_opt_mi; #define ERR(fmt, args...) \ __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args) #define WARN(fmt, args...) \ - __lttng_print(PRINT_ERR, "Warning: " fmt "\n", ## args) + __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args) #define BUG(fmt, args...) _ERRMSG("BUG", PRINT_BUG, fmt, ## args) @@ -174,4 +177,6 @@ const char *error_get_str(int32_t code); */ const char *log_add_time(); +void lttng_abort_on_error(void); + #endif /* _ERROR_H */