diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
commit | feb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch) | |
tree | e15d7e751af4e3c42e77ea955d91db4cf27a71cf /src/H5Eprivate.h | |
parent | bdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff) | |
download | hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2 |
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'src/H5Eprivate.h')
-rw-r--r-- | src/H5Eprivate.h | 132 |
1 files changed, 73 insertions, 59 deletions
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 9deb695..7a1014e 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -30,16 +30,17 @@ typedef struct H5E_t H5E_t; * and a FUNC_LEAVE() within a function body. The arguments are the major * 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__) +#define HERROR(maj_id, min_id, ...) \ + H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) /* * 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! */ +#define HCOMMON_ERROR(maj, min, ...) \ + HERROR(maj, min, __VA_ARGS__); \ + err_occurred = TRUE; \ + err_occurred = err_occurred; /* Shut GCC warnings up! */ /* * HDONE_ERROR macro, used to facilitate error reporting between a @@ -50,10 +51,11 @@ typedef struct H5E_t H5E_t; * (This macro can also be used to push an error and set the return value * without jumping to any labels) */ -#define HDONE_ERROR(maj, min, ret_val, ...) { \ - HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - ret_value = ret_val; \ -} +#define HDONE_ERROR(maj, min, ret_val, ...) \ + { \ + HCOMMON_ERROR(maj, min, __VA_ARGS__); \ + ret_value = ret_val; \ + } /* * HGOTO_ERROR macro, used to facilitate error reporting between a @@ -62,20 +64,22 @@ typedef struct H5E_t H5E_t; * error string. The return value is assigned to a variable `ret_value' and * control branches to the `done' label. */ -#define HGOTO_ERROR(maj, min, ret_val, ...) { \ - HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - HGOTO_DONE(ret_val) \ -} +#define HGOTO_ERROR(maj, min, ret_val, ...) \ + { \ + HCOMMON_ERROR(maj, min, __VA_ARGS__); \ + HGOTO_DONE(ret_val) \ + } /* * HGOTO_ERROR_TAG macro, used like HGOTO_ERROR between H5_BEGIN_TAG and * H5_END_TAG statements. Resets the metadata tag before leaving the function. */ -#define HGOTO_ERROR_TAG(maj, min, ret_val, ...) { \ - H5AC_tag(prv_tag, NULL); \ - HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - HGOTO_DONE(ret_val) \ -} +#define HGOTO_ERROR_TAG(maj, min, ret_val, ...) \ + { \ + H5AC_tag(prv_tag, NULL); \ + HCOMMON_ERROR(maj, min, __VA_ARGS__); \ + HGOTO_DONE(ret_val) \ + } /* * HGOTO_DONE macro, used to facilitate normal return between a FUNC_ENTER() @@ -83,16 +87,21 @@ typedef struct H5E_t H5E_t; * value which is assigned to the `ret_value' variable. Control branches to * the `done' label. */ -#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} +#define HGOTO_DONE(ret_val) \ + { \ + ret_value = ret_val; \ + goto done; \ + } /* * 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) { \ - H5AC_tag(prv_tag, NULL); \ - HGOTO_DONE(ret_val) \ -} +#define HGOTO_DONE_TAG(ret_val) \ + { \ + H5AC_tag(prv_tag, NULL); \ + HGOTO_DONE(ret_val) \ + } /* * Macros handling system error messages as described in C standard. @@ -122,11 +131,11 @@ typedef struct H5E_t H5E_t; HDstrerror(myerrno)); \ } #else /* H5_HAVE_WIN32_API */ - /* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a - * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will - * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero, - * though I wouldn't count on that. - */ +/* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a + * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will + * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero, + * though I wouldn't count on that. + */ #define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \ { \ int myerrno = errno; \ @@ -156,23 +165,25 @@ typedef struct H5E_t H5E_t; * MPI error handling macros. */ -extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; -extern int H5E_mpi_error_str_len; - -#define HMPI_ERROR(mpierr){ \ - MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ - HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \ -} -#define HMPI_DONE_ERROR(retcode, str, mpierr){ \ - HMPI_ERROR(mpierr); \ - HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \ -} -#define HMPI_GOTO_ERROR(retcode, str, mpierr){ \ - HMPI_ERROR(mpierr); \ - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \ -} -#endif /* H5_HAVE_PARALLEL */ +extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; +extern int H5E_mpi_error_str_len; +#define HMPI_ERROR(mpierr) \ + { \ + MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ + HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \ + } +#define HMPI_DONE_ERROR(retcode, str, mpierr) \ + { \ + HMPI_ERROR(mpierr); \ + HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \ + } +#define HMPI_GOTO_ERROR(retcode, str, mpierr) \ + { \ + HMPI_ERROR(mpierr); \ + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \ + } +#endif /* H5_HAVE_PARALLEL */ /******************************************************************************/ /* Revisions to Error Macros, to go with Revisions to FUNC_ENTER/LEAVE Macros */ @@ -184,7 +195,8 @@ extern int H5E_mpi_error_str_len; * error number, a description of the error (as a printf-like format string), * and an optional set of arguments for the printf format arguments. */ -#define H5E_PRINTF(...) H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) +#define H5E_PRINTF(...) \ + H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) /* * H5_LEAVE macro, used to facilitate control flow between a @@ -193,11 +205,12 @@ extern int H5E_mpi_error_str_len; * The return value is assigned to a variable `ret_value' and control branches * to the `catch_except' label, if we're not already past it. */ -#define H5_LEAVE(v) { \ - ret_value = v; \ - if(!past_catch) \ - goto catch_except; \ -} +#define H5_LEAVE(v) \ + { \ + ret_value = v; \ + if (!past_catch) \ + goto catch_except; \ + } /* * H5E_THROW macro, used to facilitate error reporting between a @@ -206,23 +219,24 @@ extern int H5E_mpi_error_str_len; * The return value is assigned to a variable `ret_value' and control branches * to the `catch_except' label, if we're not already past it. */ -#define H5E_THROW(...) { \ - H5E_PRINTF(__VA_ARGS__); \ - H5_LEAVE(fail_value) \ -} +#define H5E_THROW(...) \ + { \ + H5E_PRINTF(__VA_ARGS__); \ + H5_LEAVE(fail_value) \ + } /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. */ -#define CATCH catch_except:; past_catch = TRUE; - +#define CATCH \ +catch_except:; \ + past_catch = TRUE; /* Library-private functions defined in H5E package */ H5_DLL herr_t H5E_init(void); -H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, - unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) H5_ATTR_FORMAT(printf, 8, 9); +H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, + hid_t maj_id, hid_t min_id, const char *fmt, ...) H5_ATTR_FORMAT(printf, 8, 9); H5_DLL herr_t H5E_clear_stack(H5E_t *estack); H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); #endif /* _H5Eprivate_H */ - |