diff options
Diffstat (limited to 'src/H5Eprivate.h')
-rw-r--r-- | src/H5Eprivate.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 1d1c5b0..0491439 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -30,16 +30,20 @@ typedef struct H5E_t H5E_t; * error number, the minor error number, and a description of the error. */ #define HERROR(maj_id, min_id, ...) \ - H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) + do { \ + H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \ + } while (0) /* * HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR * (Shouldn't need to be used outside this header file) */ #define HCOMMON_ERROR(maj, min, ...) \ - HERROR(maj, min, __VA_ARGS__); \ - err_occurred = TRUE; \ - err_occurred = err_occurred; /* Shut GCC warnings up! */ + do { \ + HERROR(maj, min, __VA_ARGS__); \ + err_occurred = TRUE; \ + err_occurred = err_occurred; /* Shut GCC warnings up! */ \ + } while (0) /* * HDONE_ERROR macro, used to facilitate error reporting between a @@ -51,10 +55,10 @@ typedef struct H5E_t H5E_t; * without jumping to any labels) */ #define HDONE_ERROR(maj, min, ret_val, ...) \ - { \ + do { \ HCOMMON_ERROR(maj, min, __VA_ARGS__); \ ret_value = ret_val; \ - } + } while (0) /* * HGOTO_ERROR macro, used to facilitate error reporting between a @@ -66,7 +70,7 @@ typedef struct H5E_t H5E_t; #define HGOTO_ERROR(maj, min, ret_val, ...) \ { \ HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - HGOTO_DONE(ret_val) \ + HGOTO_DONE(ret_val); \ } /* @@ -74,11 +78,11 @@ typedef struct H5E_t H5E_t; * H5_END_TAG statements. Resets the metadata tag before leaving the function. */ #define HGOTO_ERROR_TAG(maj, min, ret_val, ...) \ - { \ + do { \ H5AC_tag(prv_tag, NULL); \ HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - HGOTO_DONE(ret_val) \ - } + HGOTO_DONE(ret_val); \ + } while (0) /* * HGOTO_DONE macro, used to facilitate normal return between a FUNC_ENTER() @@ -87,20 +91,20 @@ typedef struct H5E_t H5E_t; * the `done' label. */ #define HGOTO_DONE(ret_val) \ - { \ + do { \ ret_value = ret_val; \ goto done; \ - } + } while (0) /* * HGOTO_DONE_TAG macro, used like HGOTO_DONE between H5_BEGIN_TAG and * H5_END_TAG statements. Resets the metadata tag before leaving the function. */ #define HGOTO_DONE_TAG(ret_val) \ - { \ + do { \ H5AC_tag(prv_tag, NULL); \ - HGOTO_DONE(ret_val) \ - } + HGOTO_DONE(ret_val); \ + } while (0) /* * Macros handling system error messages as described in C standard. |