diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-02 19:22:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-02 19:22:12 (GMT) |
commit | 918973d9fc5b96cd559546eb5e09c87542ce598d (patch) | |
tree | 50901a0e86600485efe4bb15087b142092c83673 /src/H5Eprivate.h | |
parent | 763e6be682e7da0697063b7fea788de5d8580a45 (diff) | |
download | hdf5-918973d9fc5b96cd559546eb5e09c87542ce598d.zip hdf5-918973d9fc5b96cd559546eb5e09c87542ce598d.tar.gz hdf5-918973d9fc5b96cd559546eb5e09c87542ce598d.tar.bz2 |
[svn-r17143] Description:
Bring r17084:17142 from trunk to revise_chunks brach
Tested on:
FreeBSD/32 6.3 (duty)
(h5committest not required on this branch)
Diffstat (limited to 'src/H5Eprivate.h')
-rw-r--r-- | src/H5Eprivate.h | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index c6adb67..3ca05e7 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -76,15 +76,6 @@ typedef struct H5E_t H5E_t; */ #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} -/* Library-private functions defined in H5E package */ -H5_DLL herr_t H5E_init(void); -H5_DLL herr_t H5E_push_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 *desc); -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_DLL herr_t H5E_clear_stack(H5E_t *estack); -H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); - /* * Macros handling system error messages as described in C standard. * These macros assume errnum is a valid system error code. @@ -127,5 +118,58 @@ extern int H5E_mpi_error_str_len; } #endif /* H5_HAVE_PARALLEL */ + +/******************************************************************************/ +/* Revisions to Error Macros, to go with Revisions to FUNC_ENTER/LEAVE Macros */ +/******************************************************************************/ + +/* + * H5E_PRINTF macro, used to facilitate error reporting between a BEGIN_FUNC() + * and an END_FUNC() within a function body. The arguments are the minor + * 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__, FUNCNAME, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) + +/* + * H5_LEAVE macro, used to facilitate control flow between a + * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is + * the return value. + * 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; \ +} + +/* + * H5E_THROW macro, used to facilitate error reporting between a + * FUNC_ENTER() and a FUNC_LEAVE() within a function body. The arguments are + * the minor error number, and an error string. + * 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) \ +} + +/* 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 past_catch = TRUE; catch_except:; + + +/* Library-private functions defined in H5E package */ +H5_DLL herr_t H5E_init(void); +H5_DLL herr_t H5E_push_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 *desc); +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_DLL herr_t H5E_clear_stack(H5E_t *estack); +H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); + #endif /* _H5Eprivate_H */ |