Print the argument return value in QPMS_ENSURE_SUCCESS.

Former-commit-id: 2aa9742b6bb1a10b963a197419af7ef57b7999c1
This commit is contained in:
Marek Nečada 2019-08-23 11:26:22 +03:00
parent 32c9c2a434
commit 947f499bbf
1 changed files with 6 additions and 1 deletions

View File

@ -82,7 +82,12 @@ qpms_dbgmsg_flags qpms_dbgmsg_enable(qpms_dbgmsg_flags types);
#define QPMS_PR_ERROR(msg, ...) qpms_pr_error_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__) #define QPMS_PR_ERROR(msg, ...) qpms_pr_error_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__)
// TODO replace this macro with an inline function? // TODO replace this macro with an inline function?
#define QPMS_ENSURE_SUCCESS(x) {if(x) QPMS_WTF;} #define QPMS_ENSURE_SUCCESS(x) { \
int errorcode = (x); \
if(errorcode) \
qpms_pr_error_at_flf(__FILE__,__LINE__,__func__,"Unexpected error (%d)", errorcode); \
}
#define QPMS_ENSURE(x, msg, ...) {if(!(x)) qpms_pr_error_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__); } #define QPMS_ENSURE(x, msg, ...) {if(!(x)) qpms_pr_error_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__); }