From cb7f03a26ff906175e5bf37af57547681683770f Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Wed, 1 Sep 2004 12:43:30 -0500 Subject: [svn-r9183] Purpose: New feature Description: Restore 6 old error API functions back to the library to be backward compatible with v1.6. They are H5Epush, H5Eprint, H5Ewalk, H5Eclear, H5Eset_auto, H5Eget_auto. These functions do not have error stack as parameter. Solution: Internally, these functions use default error stack. Platforms tested: h5committest and fuss. Misc. update: RELEASE.txt --- c++/src/H5Exception.cpp | 12 +-- fortran/src/H5Ef.c | 10 +-- perform/overhead.c | 13 +-- release_docs/RELEASE.txt | 6 ++ src/H5.c | 6 +- src/H5A.c | 8 +- src/H5AC.c | 2 +- src/H5D.c | 8 +- src/H5Distore.c | 4 +- src/H5E.c | 202 +++++++++++++++++++---------------------------- src/H5Eprivate.h | 6 +- src/H5Epublic.h | 79 ++++++------------ src/H5F.c | 2 +- src/H5FDfamily.c | 2 +- src/H5FDmulti.c | 156 ++++++------------------------------ src/H5FDstdio.c | 72 +++-------------- src/H5G.c | 12 +-- src/H5Gnode.c | 6 +- src/H5HL.c | 2 +- src/H5I.c | 2 +- src/H5MPprivate.h | 6 ++ src/H5O.c | 6 +- src/H5T.c | 14 ++-- src/H5Z.c | 8 +- src/H5private.h | 2 +- src/hdf5.lnt | 2 +- test/enum.c | 6 +- test/err_compat.c | 3 +- test/error_test.c | 31 ++++---- test/filename.c | 17 +--- test/gheap.c | 42 ++-------- test/h5test.c | 22 +----- test/lheap.c | 42 ++-------- test/ohdr.c | 134 ++++++------------------------- test/testframe.c | 6 +- test/testhdf5.h | 88 +++------------------ testpar/t_dset.c | 24 +++--- tools/h5dump/h5dump.c | 15 +--- tools/h5jam/h5jam.c | 9 +-- tools/h5jam/h5unjam.c | 9 +-- tools/h5jam/tellub.c | 9 +-- tools/h5ls/h5ls.c | 6 +- 42 files changed, 305 insertions(+), 806 deletions(-) diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index b94751b..2ea07c3 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -113,7 +113,7 @@ void Exception::setAutoPrint( H5E_auto_t& func, void* client_data ) { // calls the C API routine H5Eset_auto to set the auto printing to // the specified function. - herr_t ret_value = H5Eset_auto( H5E_DEFAULT, func, client_data ); + herr_t ret_value = H5Eset_auto_stack( H5E_DEFAULT, func, client_data ); if( ret_value < 0 ) throw Exception( "Exception::setAutoPrint", "H5Eset_auto failed" ); } @@ -127,7 +127,7 @@ void Exception::dontPrint() { // calls the C API routine H5Eset_auto with NULL parameters to turn // off the automatic error printing. - herr_t ret_value = H5Eset_auto( H5E_DEFAULT, NULL, NULL ); + herr_t ret_value = H5Eset_auto_stack( H5E_DEFAULT, NULL, NULL ); if( ret_value < 0 ) throw Exception( "Exception::dontPrint", "H5Eset_auto failed" ); } @@ -146,7 +146,7 @@ void Exception::getAutoPrint( H5E_auto_t& func, void** client_data ) { // calls the C API routine H5Eget_auto to get the current setting of // the automatic error printing - herr_t ret_value = H5Eget_auto( H5E_DEFAULT, &func, client_data ); + herr_t ret_value = H5Eget_auto_stack( H5E_DEFAULT, &func, client_data ); if( ret_value < 0 ) throw Exception( "Exception::getAutoPrint", "H5Eget_auto failed" ); } @@ -162,7 +162,7 @@ void Exception::getAutoPrint( H5E_auto_t& func, void** client_data ) void Exception::clearErrorStack() { // calls the C API routine H5Eclear to clear the error stack - herr_t ret_value = H5Eclear(H5E_DEFAULT); + herr_t ret_value = H5Eclear_stack(H5E_DEFAULT); if( ret_value < 0 ) throw Exception( "Exception::clearErrorStack", "H5Eclear failed" ); } @@ -211,7 +211,7 @@ void Exception::clearErrorStack() void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk_t func, void* client_data ) { // calls the C API routine H5Ewalk to walk the error stack - herr_t ret_value = H5Ewalk( H5E_DEFAULT, direction, func, client_data ); + herr_t ret_value = H5Ewalk_stack( H5E_DEFAULT, direction, func, client_data ); if( ret_value < 0 ) throw Exception( "Exception::walkErrorStack", "H5Ewalk failed" ); } @@ -270,7 +270,7 @@ const char* Exception::getCFuncName() const //-------------------------------------------------------------------------- void Exception::printError( FILE* stream ) const { - herr_t ret_value = H5Eprint( H5E_DEFAULT, stream ); // print to stderr + herr_t ret_value = H5Eprint_stack( H5E_DEFAULT, stream ); // print to stderr if( ret_value < 0 ) throw Exception( "Exception::printError", "H5Eprint failed" ); } diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c index 8199a90..80be243 100644 --- a/fortran/src/H5Ef.c +++ b/fortran/src/H5Ef.c @@ -37,7 +37,7 @@ nh5eclear_c( ) /* * Call H5Eclear function. */ - status = H5Eclear(H5E_DEFAULT); + status = H5Eclear_stack(H5E_DEFAULT); if(status < 0) return ret_val; ret_val = 0; return ret_val; @@ -71,7 +71,7 @@ nh5eprint_c1(_fcd name, int_f* namelen) /* * Call H5Eprint function. */ - status = H5Eprint(H5E_DEFAULT, file); + status = H5Eprint_stack(H5E_DEFAULT, file); if (status >=0 ) ret_val = 0; fclose(file); @@ -101,7 +101,7 @@ nh5eprint_c2() /* * Call H5Eprint function. */ - status = H5Eprint(H5E_DEFAULT, NULL); + status = H5Eprint_stack(H5E_DEFAULT, NULL); if(status >= 0) ret_val = 0; return ret_val; } @@ -183,9 +183,9 @@ nh5eset_auto_c(int_f* printflag) herr_t status; if (*printflag == 1) - status = H5Eset_auto(H5E_DEFAULT, (H5E_auto_t)H5Eprint, stderr); + status = H5Eset_auto_stack(H5E_DEFAULT, (H5E_auto_t)H5Eprint, stderr); if (*printflag == 0) - status = H5Eset_auto(H5E_DEFAULT, NULL,NULL); + status = H5Eset_auto_stack(H5E_DEFAULT, NULL,NULL); if (status >= 0) ret_val = 0; return ret_val; } diff --git a/perform/overhead.c b/perform/overhead.c index 42d9d92..915d468 100644 --- a/perform/overhead.c +++ b/perform/overhead.c @@ -165,11 +165,7 @@ static herr_t display_error_cb (hid_t estack, void UNUSED *client_data) { puts ("*FAILED*"); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(estack, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(estack, stdout); return 0; } @@ -375,11 +371,8 @@ main(int argc, char *argv[]) int i, j, nerrors=0; /* Default split ratios */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eset_auto(display_error_cb, NULL); -#else - H5Eset_auto(H5E_DEFAULT, display_error_cb, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eset_auto_stack(H5E_DEFAULT, display_error_cb, NULL); + if ((xfer=H5Pcreate(H5P_DATASET_XFER))<0) goto error; if (H5Pget_btree_ratios(xfer, splits+0, splits+1, splits+2)<0) { goto error; diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 888590c..b65e50a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -50,6 +50,12 @@ New Features Library: -------- + - Put back 6 old error API functions to be backward compatible with + version 1.6. They are H5Epush, H5Eprint, H5Ewalk, H5Eclear, + H5Eset_auto, H5Eget_auto. Their new equivalent functions are + called H5Epush_stack, H5Eprint_stack, H5Ewalk_stack, + H5Eclear_stack, H5Eset_auto_stack, H5Eget_auto_stack. SLU - + 2004/9/2 - 4 new API functions, H5Tencode, H5Tdecode, H5Sencode, H5Sdecode were added to the library. Given object ID, these functions encode and decode HDF5 objects(data type and space) information into and from diff --git a/src/H5.c b/src/H5.c index b81e36e..4078883 100644 --- a/src/H5.c +++ b/src/H5.c @@ -194,11 +194,7 @@ H5_term_library(void) goto done; /* Check if we should display error output */ -#ifdef H5_WANT_H5_V1_6_COMPAT - (void)H5Eget_auto(&func,NULL); -#else - (void)H5Eget_auto(H5E_DEFAULT,&func,NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + (void)H5Eget_auto_stack(H5E_DEFAULT,&func,NULL); /* * Terminate each interface. The termination functions return a positive diff --git a/src/H5A.c b/src/H5A.c index 872d3fe..a40c402 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -293,7 +293,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") seq++; } - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Create the attribute message and save the attribute index */ if (H5O_modify(&(attr->ent), H5O_ATTR_ID, H5O_NEW_MESG, 0, 1, attr, dxpl_id) < 0) @@ -365,7 +365,7 @@ H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id) HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") i++; } - H5E_clear(NULL); + H5E_clear_stack(NULL); if(ret_value<0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found") @@ -1346,7 +1346,7 @@ H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, void *op_data) if(H5O_reset (H5O_ATTR_ID, &found_attr)<0) HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") } - H5E_clear(NULL); + H5E_clear_stack(NULL); } else if(start_idx>0) @@ -1421,7 +1421,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") idx++; } - H5E_clear(NULL); + H5E_clear_stack(NULL); if (found<0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found") diff --git a/src/H5AC.c b/src/H5AC.c index f07ec33..3f8ff53 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -276,7 +276,7 @@ H5AC_term_interface(void) if (H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_noblock_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) - H5E_clear(NULL); /*ignore error*/ + H5E_clear_stack(NULL); /*ignore error*/ else { /* Reset static IDs */ H5AC_dxpl_id=(-1); diff --git a/src/H5D.c b/src/H5D.c index 434faee..71c8a07 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -2487,7 +2487,7 @@ H5D_open(H5G_entry_t *ent, hid_t dxpl_id) H5D_t *dataset; /*the dataset which was found */ /* Clear any errors from H5FO_opened() */ - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Open the dataset object */ if ((dataset=H5D_open_oid(ent, dxpl_id)) ==NULL) @@ -2593,7 +2593,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) /* Get the optional filters message */ if(NULL == H5O_read(&(dataset->ent), H5O_PLINE_ID, 0, &pline, dxpl_id)) { - H5E_clear(NULL); + H5E_clear_stack(NULL); HDmemset(&pline, 0, sizeof(pline)); } if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) @@ -2668,7 +2668,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) /* Get the new fill value message */ if(NULL == H5O_read(&(dataset->ent), H5O_FILL_NEW_ID, 0, &fill, dxpl_id)) { - H5E_clear(NULL); + H5E_clear_stack(NULL); HDmemset(&fill, 0, sizeof(fill)); /* Set the space allocation time appropriately, based on the type of dataset storage */ @@ -2699,7 +2699,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) /* For compatibility with v1.4. Retrieve the old fill value message. * If size is 0, make it -1 for undefined. */ if(NULL == H5O_read(&(dataset->ent), H5O_FILL_ID, 0, fill_prop, dxpl_id)) { - H5E_clear(NULL); + H5E_clear_stack(NULL); HDmemset(fill_prop, 0, sizeof(H5O_fill_t)); } if(fill_prop->size == 0) { diff --git a/src/H5Distore.c b/src/H5Distore.c index 5182d29..6135e83 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1571,7 +1571,7 @@ H5D_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, #ifdef OLD_WAY /* Clear the error stack from not finding the chunk on disk */ - H5E_clear(NULL); + H5E_clear_stack(NULL); #endif /* OLD_WAY */ /* Chunk size on disk isn't [likely] the same size as the final chunk @@ -2266,7 +2266,7 @@ H5D_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * if a chunk exists in the B-tree or not. -QAK */ #ifdef OLD_WAY - H5E_clear(NULL); + H5E_clear_stack(NULL); HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info"); #else /* OLD_WAY */ diff --git a/src/H5E.c b/src/H5E.c index 8ac0a86..36d105f 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -108,17 +108,13 @@ static herr_t H5E_set_current_stack(H5E_t *estack); static herr_t H5E_close_stack(H5E_t *err_stack); static int H5E_get_num(const H5E_t *err_stack); static herr_t H5E_pop(H5E_t *err_stack, size_t count); -static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries); -static herr_t H5E_print(const H5E_t *estack, FILE *stream); -static herr_t H5E_walk (const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, +static herr_t H5E_clear_entries(H5E_t *estack, unsigned nentries); +static herr_t H5E_print_stack(const H5E_t *estack, FILE *stream); +static herr_t H5E_walk_stack(const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void *client_data); -#ifdef H5_WANT_H5_V1_6_COMPAT -static herr_t H5E_walk_cb(int n, H5E_error_t *err_desc, void *client_data); -#else /* H5_WANT_H5_V1_6_COMPAT */ static herr_t H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data); -#endif /* H5_WANT_H5_V1_6_COMPAT */ -static herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_t *func, void **client_data); -static herr_t H5E_set_auto(H5E_t *estack, H5E_auto_t func, void *client_data); +static herr_t H5E_get_auto_stack(const H5E_t *estack, H5E_auto_t *func, void **client_data); +static herr_t H5E_set_auto_stack(H5E_t *estack, H5E_auto_t func, void *client_data); /*------------------------------------------------------------------------- @@ -186,7 +182,11 @@ H5E_init_interface(void) #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; +#ifdef H5_WANT_H5_V1_6_COMPAT H5E_stack_g[0].func = (H5E_auto_t)H5Eprint; +#else /*H5_WANT_H5_V1_6_COMPAT*/ + H5E_stack_g[0].func = (H5E_auto_t)H5Eprint_stack; +#endif /*H5_WANT_H5_V1_6_COMPAT*/ H5E_stack_g[0].auto_data = NULL; #endif /* H5_HAVE_THREADSAFE */ @@ -310,7 +310,7 @@ H5E_get_stack(void) /* no associated value with current thread - create one */ estack = (H5E_t *)H5MM_malloc(sizeof(H5E_t)); estack->nused = 0; - estack->func = (H5E_auto_t)H5Eprint; + estack->func = (H5E_auto_t)H5Eprint_stack; estack->auto_data = NULL; pthread_setspecific(H5TS_errstk_key_g, (void *)estack); } @@ -767,7 +767,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Eget_major @@ -867,7 +866,6 @@ H5Eget_minor(H5E_minor_t min) done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- @@ -1054,7 +1052,7 @@ H5E_get_current_stack(void) } /* end for */ /* Empty current error stack */ - H5E_clear(current_stack); + H5E_clear_stack(current_stack); /* Set the return value */ ret_value = estack_copy; @@ -1137,7 +1135,7 @@ H5E_set_current_stack(H5E_t *estack) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Empty current error stack */ - H5E_clear(current_stack); + H5E_clear_stack(current_stack); /* Copy new stack to current error stack */ current_stack->nused = estack->nused; @@ -1233,7 +1231,7 @@ H5E_close_stack(H5E_t *estack) assert(estack); /* Release the stack's error information */ - H5E_clear(estack); + H5E_clear_stack(estack); /* Free the stack structure */ H5MM_xfree((void*)estack); @@ -1274,7 +1272,7 @@ H5Eget_num(hid_t error_stack_id) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Get the error stack to operate on */ if((estack = H5I_object_verify(error_stack_id, H5I_ERROR_STACK))==NULL) @@ -1351,7 +1349,7 @@ H5Epop(hid_t err_stack, size_t count) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Get the error stack to operate on */ if((estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))==NULL) @@ -1405,7 +1403,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Epush @@ -1420,7 +1417,10 @@ done: * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 * - * Notes: Basically a public API wrapper around the H5E_push function. + * Notes: Basically a public API wrapper around the H5E_push_stack + * function. For backward compatibility, it maintains the + * same parameter as the old function, in contrary to + * H5Epush_stack. * * Modifications: * @@ -1438,17 +1438,16 @@ H5Epush(const char *file, const char *func, unsigned line, H5TRACE6("e","ssIuiis",file,func,line,maj,min,str); /* Push the error on the stack */ - if(H5E_push(estack, file, func, line, H5E_ERR_CLS_g, maj, min, str)<0) + if(H5E_push_stack(estack, file, func, line, H5E_ERR_CLS_g, maj, min, str)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack") done: FUNC_LEAVE_API(ret_value) } -#else /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- - * Function: H5Epush + * Function: H5Epush_stack * * Purpose: Pushes a new error record onto error stack for the current * thread. The error has major and minor IDs MAJ_ID and @@ -1463,7 +1462,8 @@ done: * Programmer: Quincey Koziol * Monday, October 18, 1999 * - * Notes: Basically a public API wrapper around the H5E_push function. + * Notes: Basically a new public API wrapper around the H5E_push_stack + * function. * * Modifications: * Raymond Lu @@ -1476,7 +1476,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Epush(hid_t err_stack, const char *file, const char *func, unsigned line, +H5Epush_stack(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) { va_list ap; /* Varargs info */ @@ -1486,14 +1486,14 @@ H5Epush(hid_t err_stack, const char *file, const char *func, unsigned line, herr_t ret_value=SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Epush, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Epush_stack, FAIL) H5TRACE7("e","issIuiis",err_stack,file,func,line,maj_id,min_id,fmt); if(err_stack == H5E_DEFAULT) estack = NULL; else { /* Only clear the error stack if it's not the default stack */ - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Get the error stack to operate on */ if((estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))==NULL) @@ -1514,17 +1514,16 @@ H5Epush(hid_t err_stack, const char *file, const char *func, unsigned line, va_end(ap); /* Push the error on the stack */ - if(H5E_push(estack, file, func, line, cls_id, maj_id, min_id, tmp)<0) + if(H5E_push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack") done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- - * Function: H5E_push + * Function: H5E_push_stack * * Purpose: Pushes a new error record onto error stack for the current * thread. The error has major and minor IDs MAJ_ID and @@ -1552,7 +1551,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_push(H5E_t *estack, const char *file, const char *func, unsigned line, +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) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1564,7 +1563,7 @@ H5E_push(H5E_t *estack, const char *file, const char *func, unsigned line, * HERROR(). HERROR() is called by HRETURN_ERROR() which could * be called by FUNC_ENTER(). */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_push) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_push_stack) /* Sanity check */ assert(cls_id>0); @@ -1614,7 +1613,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Eclear @@ -1642,17 +1640,16 @@ H5Eclear(void) H5TRACE0("e",""); /* Clear the error stack */ - if(H5E_clear(estack)<0) + if(H5E_clear_stack(estack)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") done: FUNC_LEAVE_API(ret_value) } -#else /*------------------------------------------------------------------------- - * Function: H5Eclear + * Function: H5Eclear_stack * * Purpose: Clears the error stack for the specified error stack. * @@ -1666,13 +1663,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eclear(hid_t err_stack) +H5Eclear_stack(hid_t err_stack) { H5E_t *estack; /* Error stack to operate on */ herr_t ret_value=SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Eclear, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Eclear_stack, FAIL) H5TRACE1("e","i",err_stack); /* Need to check for errors */ @@ -1680,20 +1677,19 @@ H5Eclear(hid_t err_stack) estack = NULL; else { /* Only clear the error stack if it's not the default stack */ - H5E_clear(NULL); + H5E_clear_stack(NULL); if((estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ /* Clear the error stack */ - if(H5E_clear(estack)<0) + if(H5E_clear_stack(estack)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- @@ -1712,7 +1708,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_clear_entries(H5E_t *estack, size_t nentries) +H5E_clear_entries(H5E_t *estack, unsigned nentries) { H5E_error_t *error; /* Pointer to error stack entry to clear */ unsigned u; /* Local index variable */ @@ -1755,7 +1751,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_clear + * Function: H5E_clear_stack * * Purpose: Private function to clear the error stack for the * specified error stack. @@ -1770,11 +1766,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_clear(H5E_t *estack) +H5E_clear_stack(H5E_t *estack) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5E_clear, FAIL) + FUNC_ENTER_NOAPI(H5E_clear_stack, FAIL) /* Check for 'default' error stack */ if(estack==NULL) @@ -1791,7 +1787,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Eprint * @@ -1828,17 +1823,16 @@ H5Eprint(FILE *stream) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Print error stack */ - if(H5E_print(estack, stream)<0) + if(H5E_print_stack(estack, stream)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: FUNC_LEAVE_API(ret_value) } -#else /*------------------------------------------------------------------------- - * Function: H5Eprint + * Function: H5Eprint_stack * * Purpose: Prints the error stack in some default way. This is just a * convenience function for H5Ewalk() with a function that @@ -1864,13 +1858,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eprint(hid_t err_stack, FILE *stream) +H5Eprint_stack(hid_t err_stack, FILE *stream) { H5E_t *estack; /* Error stack to operate on */ herr_t ret_value=SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Eprint, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Eprint_stack, FAIL) /*NO TRACE*/ /* Need to check for errors */ @@ -1880,29 +1874,29 @@ H5Eprint(hid_t err_stack, FILE *stream) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear(NULL); + H5E_clear_stack(NULL); if((estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ /* Print error stack */ - if(H5E_print(estack, stream)<0) + if(H5E_print_stack(estack, stream)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- - * Function: H5E_print + * Function: H5E_print_stack * * Purpose: Private function to print the error stack in some default - * way. This is just a convenience function for H5Ewalk() - * with a function that prints error messages. Users are - * encouraged to write there own more specific error handlers. + * way. This is just a convenience function for H5Ewalk() and + * H5Ewalk_stack() with a function that prints error messages. + * Users are encouraged to write there own more specific error + * handlers. * * Return: Non-negative on success/Negative on failure * @@ -1923,13 +1917,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_print(const H5E_t *estack, FILE *stream) +H5E_print_stack(const H5E_t *estack, FILE *stream) { H5E_print_t eprint; /* Callback information to pass to H5E_walk_cb() */ herr_t ret_value = SUCCEED; /* Don't clear the error stack! :-) */ - FUNC_ENTER_NOAPI(H5E_print, FAIL) + FUNC_ENTER_NOAPI(H5E_print_stack, FAIL) /* Sanity check */ assert(estack); @@ -1944,14 +1938,13 @@ H5E_print(const H5E_t *estack, FILE *stream) HDmemset(&eprint.cls,0,sizeof(H5E_cls_t)); /* Walk the error stack */ - if(H5E_walk (estack, H5E_WALK_DOWNWARD, H5E_walk_cb, (void*)&eprint)<0) + if(H5E_walk_stack(estack, H5E_WALK_DOWNWARD, H5E_walk_cb, (void*)&eprint)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: FUNC_LEAVE_NOAPI(ret_value) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Ewalk @@ -1983,17 +1976,16 @@ H5Ewalk(H5E_direction_t direction, H5E_walk_t func, void *client_data) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Walk the error stack */ - if(H5E_walk (estack, direction, func, client_data)<0) + if(H5E_walk_stack(estack, direction, func, client_data)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: FUNC_LEAVE_API(ret_value) } -#else /*------------------------------------------------------------------------- - * Function: H5Ewalk + * Function: H5Ewalk_stack * * Purpose: Walks the error stack for the current thread and calls some * function for each error along the way. @@ -2012,13 +2004,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Ewalk(hid_t err_stack, H5E_direction_t direction, H5E_walk_t func, void *client_data) +H5Ewalk_stack(hid_t err_stack, H5E_direction_t direction, H5E_walk_t func, void *client_data) { H5E_t *estack; /* Error stack to operate on */ herr_t ret_value=SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Ewalk, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Ewalk_stack, FAIL) /*NO TRACE*/ /* Need to check for errors */ @@ -2028,24 +2020,23 @@ H5Ewalk(hid_t err_stack, H5E_direction_t direction, H5E_walk_t func, void *clien } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear(NULL); + H5E_clear_stack(NULL); if((estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ /* Walk the error stack */ - if(H5E_walk (estack, direction, func, client_data)<0) + if(H5E_walk_stack(estack, direction, func, client_data)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- - * Function: H5E_walk + * Function: H5E_walk_stack * * Purpose: Private function for H5Ewalk. * Walks the error stack, calling the specified function for @@ -2076,13 +2067,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_walk (const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void *client_data) +H5E_walk_stack(const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void *client_data) { int i; /* Local index variable */ herr_t status; /* Status from callback function */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5E_walk, FAIL) + FUNC_ENTER_NOAPI(H5E_walk_stack, FAIL) /* Sanity check */ assert (estack); @@ -2094,16 +2085,7 @@ H5E_walk (const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void /* Walk the stack if a callback function was given */ if(func) { status=SUCCEED; -#ifdef H5_WANT_H5_V1_6_COMPAT - if (H5E_WALK_UPWARD==direction) { - for (i=0; i<(int)estack->nused && status>=0; i++) - status = (func)(i, estack->slot+i, client_data); - } else { - H5_CHECK_OVERFLOW(estack->nused-1,size_t,int); - for (i=(int)(estack->nused-1); i>=0 && status>=0; i--) - status = (func)((int)estack->nused-(i+1), estack->slot+i, client_data); - } -#else /* H5_WANT_H5_V1_6_COMPAT */ + if (H5E_WALK_UPWARD==direction) { for (i=0; i<(int)estack->nused && status>=0; i++) status = (func)((unsigned)i, estack->slot+i, client_data); @@ -2112,7 +2094,7 @@ H5E_walk (const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void for (i=(int)(estack->nused-1); i>=0 && status>=0; i--) status = (func)((unsigned)(estack->nused-(size_t)(i+1)), estack->slot+i, client_data); } -#endif /* H5_WANT_H5_V1_6_COMPAT */ + if(status<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") } /* end if */ @@ -2155,13 +2137,8 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -static herr_t -H5E_walk_cb(int n, H5E_error_t *err_desc, void *client_data) -#else /* H5_WANT_H5_V1_6_COMPAT */ static herr_t H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -2225,24 +2202,16 @@ H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data) have_desc=0; /* Print error message */ -#ifdef H5_WANT_H5_V1_6_COMPAT - fprintf (stream, "%*s#%03d: %s line %u in %s()%s%s\n", - H5E_INDENT, "", n, err_desc->file_name, err_desc->line, - err_desc->func_name, (have_desc ? ": " : ""), - (err_desc->desc ? err_desc->desc : "")); -#else /* H5_WANT_H5_V1_6_COMPAT */ fprintf (stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); -#endif /* H5_WANT_H5_V1_6_COMPAT */ fprintf (stream, "%*smajor: %s\n", H5E_INDENT*2, "", maj_str); fprintf (stream, "%*sminor: %s\n", H5E_INDENT*2, "", min_str); FUNC_LEAVE_NOAPI(SUCCEED) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Eget_auto @@ -2276,17 +2245,16 @@ H5Eget_auto(H5E_auto_t *func, void **client_data) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, func, client_data)<0) + if(H5E_get_auto_stack(estack, func, client_data)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") done: FUNC_LEAVE_API(ret_value) } -#else /*------------------------------------------------------------------------- - * Function: H5Eget_auto + * Function: H5Eget_auto_stack * * Purpose: Returns the current settings for the automatic error stack * traversal function and its data for specific error stack. @@ -2307,12 +2275,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eget_auto(hid_t estack_id, H5E_auto_t *func, void **client_data) +H5Eget_auto_stack(hid_t estack_id, H5E_auto_t *func, void **client_data) { H5E_t *estack; /* Error stack to operate on */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Eget_auto, FAIL) + FUNC_ENTER_API(H5Eget_auto_stack, FAIL) H5TRACE3("e","i*xx",estack_id,func,client_data); if(estack_id == H5E_DEFAULT) { @@ -2324,17 +2292,16 @@ H5Eget_auto(hid_t estack_id, H5E_auto_t *func, void **client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, func, client_data)<0) + if(H5E_get_auto_stack(estack, func, client_data)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- - * Function: H5E_get_auto + * Function: H5E_get_auto_stack * * Purpose: Private function to return the current settings for the * automatic error stack traversal function and its data @@ -2351,11 +2318,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_get_auto(const H5E_t *estack, H5E_auto_t *func, void **client_data) +H5E_get_auto_stack(const H5E_t *estack, H5E_auto_t *func, void **client_data) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5E_get_auto, FAIL) + FUNC_ENTER_NOAPI(H5E_get_auto_stack, FAIL) assert (estack); @@ -2367,7 +2334,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -#ifdef H5_WANT_H5_V1_6_COMPAT /*------------------------------------------------------------------------- * Function: H5Eset_auto @@ -2409,17 +2375,16 @@ H5Eset_auto(H5E_auto_t func, void *client_data) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Set the automatic error reporting information */ - if(H5E_set_auto(estack, func, client_data)<0) + if(H5E_set_auto_stack(estack, func, client_data)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: FUNC_LEAVE_API(ret_value) } -#else /*------------------------------------------------------------------------- - * Function: H5Eset_auto + * Function: H5Eset_auto_stack * * Purpose: Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any @@ -2445,12 +2410,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eset_auto(hid_t estack_id, H5E_auto_t func, void *client_data) +H5Eset_auto_stack(hid_t estack_id, H5E_auto_t func, void *client_data) { H5E_t *estack; /* Error stack to operate on */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Eset_auto, FAIL) + FUNC_ENTER_API(H5Eset_auto_stack, FAIL) H5TRACE3("e","ixx",estack_id,func,client_data); if(estack_id == H5E_DEFAULT) { @@ -2462,17 +2427,16 @@ H5Eset_auto(hid_t estack_id, H5E_auto_t func, void *client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the automatic error reporting information */ - if(H5E_set_auto(estack, func, client_data)<0) + if(H5E_set_auto_stack(estack, func, client_data)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: FUNC_LEAVE_API(ret_value) } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- - * Function: H5E_set_auto + * Function: H5E_set_auto_stack * * Purpose: Private function to turn on or off automatic printing of * errors for certain error stack. When turned on (non-null @@ -2499,11 +2463,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_set_auto(H5E_t *estack, H5E_auto_t func, void *client_data) +H5E_set_auto_stack(H5E_t *estack, H5E_auto_t func, void *client_data) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5E_set_auto, FAIL) + FUNC_ENTER_NOAPI(H5E_set_auto_stack, FAIL) assert(estack); @@ -2545,11 +2509,7 @@ H5E_dump_api_stack(int is_api) assert(estack); if (estack->func) -#ifdef H5_WANT_H5_V1_6_COMPAT - (void)((estack->func)(estack->auto_data)); -#else /*H5_WANT_H5_V1_6_COMPAT*/ (void)((estack->func)(H5E_DEFAULT, estack->auto_data)); -#endif /* H5_WANT_H5_V1_6_COMPAT */ } /* end if */ done: diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index b874157..4dbb670 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -63,7 +63,7 @@ typedef struct H5E_print_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, str) H5E_push(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, str) +#define HERROR(maj_id, min_id, str) H5E_push_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, str) /* * HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR @@ -109,9 +109,9 @@ typedef struct H5E_print_t { /* Library-private functions defined in H5E package */ H5_DLL herr_t H5E_init(void); -H5_DLL herr_t H5E_push(H5E_t *estack, const char *file, const char *func, unsigned line, +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_clear(H5E_t *estack); +H5_DLL herr_t H5E_clear_stack(H5E_t *estack); H5_DLL herr_t H5E_dump_api_stack(int is_api); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Epublic.h b/src/H5Epublic.h index e9cf481..247767c 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -36,10 +36,9 @@ typedef enum H5E_type_t { H5E_MINOR } H5E_type_t; -#ifdef H5_WANT_H5_V1_6_COMPAT +/* For backward compatibility with v1.6 */ typedef hid_t H5E_major_t; typedef hid_t H5E_minor_t; -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Information about an error; element of error stack */ typedef struct H5E_error_t { @@ -81,69 +80,43 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * * Warning: don't break, return, or longjmp() from the body of the loop or * the error reporting won't be properly restored! + * + * These two macros still use the old API functions for backward compatibility + * purpose. */ -#ifdef H5_WANT_H5_V1_6_COMPAT #define H5E_BEGIN_TRY { \ H5E_auto_t H5E_saved_efunc; \ void *H5E_saved_edata; \ - (void)H5Eget_auto(&H5E_saved_efunc, &H5E_saved_edata); \ - (void)H5Eset_auto(NULL, NULL); + (void)H5Eget_auto_stack(H5E_DEFAULT, &H5E_saved_efunc, &H5E_saved_edata); \ + (void)H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); #define H5E_END_TRY \ - (void)H5Eset_auto (H5E_saved_efunc, H5E_saved_edata); \ + (void)H5Eset_auto_stack(H5E_DEFAULT, H5E_saved_efunc, H5E_saved_edata); \ } -#else /* H5_WANT_H5_V1_6_COMPAT */ -#define H5E_BEGIN_TRY { \ - H5E_auto_t H5E_saved_efunc; \ - void *H5E_saved_edata; \ - (void)H5Eget_auto(H5E_DEFAULT, &H5E_saved_efunc, &H5E_saved_edata); \ - (void)H5Eset_auto(H5E_DEFAULT, NULL, NULL); - -#define H5E_END_TRY \ - (void)H5Eset_auto (H5E_DEFAULT, H5E_saved_efunc, H5E_saved_edata); \ -} -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* * Public API Convenience Macros for Error reporting - Documented */ /* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */ -#ifdef H5_WANT_H5_V1_6_COMPAT -#define H5Epush_sim(func,cls,maj,min,str) H5Epush(__FILE__,func,__LINE__,maj,min,str) -#else -#define H5Epush_sim(func,cls,maj,min,str) H5Epush(H5E_DEFAULT,__FILE__,func,__LINE__,cls,maj,min,str) -#endif /* H5_WANT_H5_V1_6_COMPAT */ +#define H5Epush_sim(func,cls,maj,min,str) H5Epush_stack(H5E_DEFAULT,__FILE__,func,__LINE__,cls,maj,min,str) /* * Public API Convenience Macros for Error reporting - Undocumented */ /* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */ /* And return after pushing error onto stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT #define H5Epush_ret(func,cls,maj,min,str,ret) { \ - H5Epush(__FILE__,func,__LINE__,maj,min,str); \ + H5Epush_stack(H5E_DEFAULT,__FILE__,func,__LINE__,cls,maj,min,str); \ return(ret); \ } -#else -#define H5Epush_ret(func,cls,maj,min,str,ret) { \ - H5Epush(H5E_DEFAULT,__FILE__,func,__LINE__,cls,maj,min,str); \ - return(ret); \ -} -#endif /* H5_WANT_H5_V1_6_COMPAT */ -/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */ -/* And goto a label after pushing error onto stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT -#define H5Epush_goto(func,cls,maj,min,str,label) { \ - H5Epush(__FILE__,func,__LINE__,maj,min,str); \ - goto label; \ -} -#else +/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in + * And goto a label after pushing error onto stack. + */ #define H5Epush_goto(func,cls,maj,min,str,label) { \ - H5Epush(H5E_DEFAULT,__FILE__,func,__LINE__,cls,maj,min,str); \ + H5Epush_stack(H5E_DEFAULT,__FILE__,func,__LINE__,cls,maj,min,str); \ goto label; \ } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Error stack traversal direction */ typedef enum H5E_direction_t { @@ -157,13 +130,8 @@ extern "C" { #endif /* Error stack traversal callback function pointers */ -#ifdef H5_WANT_H5_V1_6_COMPAT -typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data); -typedef herr_t (*H5E_auto_t)(void *client_data); -#else typedef herr_t (*H5E_walk_t)(unsigned n, const H5E_error_t *err_desc, void *client_data); typedef herr_t (*H5E_auto_t)(hid_t estack, void *client_data); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Public API functions */ H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version); @@ -177,7 +145,9 @@ H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, size_t size H5_DLL int H5Eget_num(hid_t error_stack_id); H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); -#ifdef H5_WANT_H5_V1_6_COMPAT + +/* These old APIs are kept for backward compatibility. They don't have + * the error stack in the parameters. */ H5_DLL herr_t H5Epush(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str); H5_DLL herr_t H5Eprint(FILE *stream); @@ -188,16 +158,17 @@ H5_DLL herr_t H5Eset_auto(H5E_auto_t func, void *client_data); H5_DLL herr_t H5Eclear(void); H5_DLL const char * H5Eget_major(H5E_major_t maj); H5_DLL const char * H5Eget_minor(H5E_minor_t min); -#else -H5_DLL herr_t H5Epush(hid_t err_stack, const char *file, const char *func, unsigned line, + +/* New APIs function the same as the old ones above, with the error stack + * in the parameters */ +H5_DLL herr_t H5Epush_stack(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...); -H5_DLL herr_t H5Eprint(hid_t err_stack, FILE *stream); -H5_DLL herr_t H5Ewalk(hid_t err_stack, H5E_direction_t direction, H5E_walk_t func, +H5_DLL herr_t H5Eprint_stack(hid_t err_stack, FILE *stream); +H5_DLL herr_t H5Ewalk_stack(hid_t err_stack, H5E_direction_t direction, H5E_walk_t func, void *client_data); -H5_DLL herr_t H5Eget_auto(hid_t estack_id, H5E_auto_t *func, void **client_data); -H5_DLL herr_t H5Eset_auto(hid_t estack_id, H5E_auto_t func, void *client_data); -H5_DLL herr_t H5Eclear(hid_t err_stack); -#endif /* H5_WANT_H5_V1_6_COMPAT */ +H5_DLL herr_t H5Eget_auto_stack(hid_t estack_id, H5E_auto_t *func, void **client_data); +H5_DLL herr_t H5Eset_auto_stack(hid_t estack_id, H5E_auto_t func, void *client_data); +H5_DLL herr_t H5Eclear_stack(hid_t err_stack); #ifdef __cplusplus } #endif diff --git a/src/H5F.c b/src/H5F.c index b181357..8ee1e94 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1748,7 +1748,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d if (NULL==(lf=H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) { if (tent_flags == flags) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - H5E_clear(NULL); + H5E_clear_stack(NULL); tent_flags = flags; if (NULL==(lf=H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 5f94b68..7d35b41 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -651,7 +651,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, if (!file->memb[file->nmembs]) { if (0==file->nmembs) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file") - H5E_clear(NULL); + H5E_clear_stack(NULL); break; } file->nmembs++; diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 01048d6..d1d0b6e 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -231,11 +231,7 @@ hid_t H5FD_multi_init(void) { /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (H5I_VFL!=H5Iget_type(H5FD_MULTI_g)) { H5FD_MULTI_g = H5FDregister(&H5FD_multi_g); @@ -304,11 +300,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, /*NO TRACE*/ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Initialize */ for (mt=H5FD_MEM_DEFAULT; mtfa.memb_map, mt) { @@ -797,11 +769,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, static const char *func="H5FD_multi_sb_encode"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Name and version number */ strncpy(name, "NCSAmulti",8); @@ -886,11 +854,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) static const char *func="H5FD_multi_sb_decode"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Make sure the name/version number is correct */ if (strcmp(name, "NCSAmult")) @@ -1032,11 +996,7 @@ H5FD_multi_fapl_get(H5FD_t *_file) H5FD_multi_t *file = (H5FD_multi_t*)_file; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); return H5FD_multi_fapl_copy(&(file->fa)); } @@ -1070,11 +1030,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) assert(new_fa); /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t)); for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) @@ -1172,11 +1124,7 @@ H5FD_multi_dxpl_copy(const void *_old_dx) assert(new_dx); /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); memcpy(new_dx, old_dx, sizeof(H5FD_multi_dxpl_t)); for (mt=H5FD_MEM_DEFAULT; mtmemb_dxpl[mt]>=0) @@ -1264,11 +1208,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, static const char *func="H5FD_multi_open"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Check arguments */ if (!name || !*name) @@ -1363,11 +1303,7 @@ H5FD_multi_close(H5FD_t *_file) static const char *func="H5FD_multi_close"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Close as many members as possible */ ALL_MEMBERS(mt) { @@ -1433,11 +1369,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) int cmp=0; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); for (mt=H5FD_MEM_DEFAULT; mtmemb[mt] && f2->memb[mt]) break; @@ -1511,11 +1443,7 @@ H5FD_multi_get_eoa(H5FD_t *_file) H5FD_multi_t *file = (H5FD_multi_t*)_file; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); return file->eoa; } @@ -1549,11 +1477,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) static const char *func="H5FD_multi_set_eoa"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Find the subfile in which the new EOA value falls */ for (mt=H5FD_MEM_SUPER; mtfa.memb_map, mt) { if (file->memb[mt]) { @@ -1735,11 +1655,7 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi H5FD_mem_t mmt; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); mmt = file->fa.memb_map[type]; if (H5FD_MEM_DEFAULT==mmt) mmt = type; @@ -1779,11 +1695,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz haddr_t start_addr=0; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Get the data transfer properties */ if (H5P_FILE_ACCESS_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) { @@ -1838,11 +1750,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si haddr_t start_addr=0; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Get the data transfer properties */ if (H5P_FILE_ACCESS_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) { @@ -1926,11 +1834,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) #endif /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Flush each file */ for (mt=H5FD_MEM_SUPER; mtmemb_next[mt] = HADDR_UNDEF; @@ -2019,11 +1919,7 @@ open_members(H5FD_multi_t *file) static const char *func="(H5FD_multi)open_members"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); UNIQUE_MEMBERS(file->fa.memb_map, mt) { if (file->memb[mt]) continue; /*already open*/ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 77864e0..5b5747f 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -216,11 +216,7 @@ hid_t H5FD_stdio_init(void) { /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (H5I_VFL!=H5Iget_type(H5FD_STDIO_g)) H5FD_STDIO_g = H5FDregister(&H5FD_stdio_g); @@ -276,11 +272,7 @@ H5Pset_fapl_stdio(hid_t fapl_id) /*NO TRACE*/ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if(0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1) @@ -340,11 +332,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, fapl_id=fapl_id; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Check arguments */ if (!name || !*name) @@ -432,11 +420,7 @@ H5FD_stdio_close(H5FD_t *_file) static const char *func="H5FD_stdio_close"; /* Function Name for error reporting */ /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (fclose(file->fp) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1) @@ -473,11 +457,7 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) const H5FD_stdio_t *f2 = (const H5FD_stdio_t*)_f2; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); #ifdef WIN32 if (f1->fileindexhi < f2->fileindexhi) return -1; @@ -567,11 +547,7 @@ H5FD_stdio_get_eoa(H5FD_t *_file) H5FD_stdio_t *file = (H5FD_stdio_t*)_file; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); return(file->eoa); } @@ -602,11 +578,7 @@ H5FD_stdio_set_eoa(H5FD_t *_file, haddr_t addr) H5FD_stdio_t *file = (H5FD_stdio_t*)_file; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); file->eoa = addr; @@ -641,11 +613,7 @@ H5FD_stdio_get_eof(H5FD_t *_file) H5FD_stdio_t *file = (H5FD_stdio_t*)_file; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); return(MAX(file->eof, file->eoa)); } @@ -675,11 +643,7 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) fapl=fapl; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); *file_handle = &(file->fp); if(*file_handle==NULL) @@ -725,11 +689,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz dxpl_id=dxpl_id; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Check for overflow */ if (HADDR_UNDEF==addr) @@ -827,11 +787,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, type=type; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Check for overflow conditions */ if (HADDR_UNDEF==addr) @@ -908,11 +864,7 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) dxpl_id=dxpl_id; /* Clear the error stack */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); /* Only try to flush the file if we have write access */ if(file->write_access) { diff --git a/src/H5G.c b/src/H5G.c index 310ee5f..1cbba96 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -2393,7 +2393,7 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, if (H5G_namei(new_loc, norm_new_name, &rest, &grp_ent, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)>=0) HGOTO_ERROR (H5E_SYM, H5E_EXISTS, FAIL, "already exists"); - H5E_clear (NULL); /*it's okay that we didn't find it*/ + H5E_clear_stack (NULL); /*it's okay that we didn't find it*/ rest = H5G_component (rest, &nchars); /* @@ -2588,14 +2588,14 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, statbuf->objno = obj_ent.header; statbuf->nlink = H5O_link (&obj_ent, 0, dxpl_id); if (NULL==H5O_read(&obj_ent, H5O_MTIME_ID, 0, &(statbuf->mtime), dxpl_id)) { - H5E_clear(NULL); + H5E_clear_stack(NULL); if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW_ID, 0, &(statbuf->mtime), dxpl_id)) { - H5E_clear(NULL); + H5E_clear_stack(NULL); statbuf->mtime = 0; } } statbuf->type = H5G_get_type(&obj_ent, dxpl_id); - H5E_clear(NULL); /*clear errors resulting from checking type*/ + H5E_clear_stack(NULL); /*clear errors resulting from checking type*/ /* Get object header information */ if(H5O_get_info(&obj_ent, &(statbuf->ohdr), dxpl_id)<0) @@ -2868,7 +2868,7 @@ H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_ /* Remove the previous comment message if any */ if (H5O_remove(&obj_ent, H5O_NAME_ID, 0, dxpl_id)<0) - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Add the new message */ if (buf && *buf) { @@ -3159,7 +3159,7 @@ H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id) H5G_free_ent_name(&grp_ent); HGOTO_ERROR(H5E_SYM, H5E_EXISTS, NULL, "name already exists"); } /* end if */ - H5E_clear(NULL); + H5E_clear_stack(NULL); /* Make sure only the last component wasn't resolved */ rest = H5G_component(rest, &size); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 52194cc..1b3bbb7 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1310,7 +1310,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, if (found) H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset, len); - H5E_clear(NULL); /* no big deal */ + H5E_clear_stack(NULL); /* no big deal */ } else { /* Decrement the reference count */ assert(H5F_addr_defined(sn->entry[idx].header)); @@ -1338,7 +1338,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, if (found) H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off, len); - H5E_clear(NULL); /* no big deal */ + H5E_clear_stack(NULL); /* no big deal */ /* Remove the entry from the symbol table node */ if (1==sn->nsyms) { @@ -1880,7 +1880,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) { H5G_bt_ud1_t udata; /*data to pass through B-tree */ - H5E_clear(NULL); /* discard that error */ + H5E_clear_stack(NULL); /* discard that error */ udata.heap_addr = heap; if ( H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_SNODE, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to debug B-tree node"); diff --git a/src/H5HL.c b/src/H5HL.c index e0202f2..0c8e4a6 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -438,7 +438,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Release old space on disk */ H5_CHECK_OVERFLOW(heap->disk_alloc, size_t, hsize_t); H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->disk_alloc); - H5E_clear(NULL); /* don't really care if the free failed */ + H5E_clear_stack(NULL); /* don't really care if the free failed */ /* Allocate new space on disk */ H5_CHECK_OVERFLOW(heap->mem_alloc, size_t, hsize_t); diff --git a/src/H5I.c b/src/H5I.c index 3beed36..aaa1e54 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -751,7 +751,7 @@ herr_t H5I_destroy_type(H5I_type_t type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); H5I_clear_type(type, TRUE); - H5E_clear(NULL); /*don't care about errors*/ + H5E_clear_stack(NULL); /*don't care about errors*/ H5MM_xfree(type_ptr->id_list); H5MM_free(type_ptr); diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h index a47a6fe..401d407 100644 --- a/src/H5MPprivate.h +++ b/src/H5MPprivate.h @@ -97,10 +97,12 @@ #define color_H5Dget_offset "red" #define color_H5Eclear "red" +#define color_H5Eclear_stack "red" #define color_H5Eclose_msg "red" #define color_H5Eclose_stack "red" #define color_H5Ecreate_msg "red" #define color_H5Eget_auto "red" +#define color_H5Eget_auto_stack "red" #define color_H5Eget_class_name "red" #define color_H5Eget_current_stack "red" #define color_H5Eget_major "red" @@ -109,12 +111,16 @@ #define color_H5Eget_num "red" #define color_H5Epop "red" #define color_H5Eprint "red" +#define color_H5Eprint_stack "red" #define color_H5Epush "red" +#define color_H5Epush_stack "red" #define color_H5Eregister_class "red" #define color_H5Eset_auto "red" +#define color_H5Eset_auto_stack "red" #define color_H5Eset_current_stack "red" #define color_H5Eunregister_class "red" #define color_H5Ewalk "red" +#define color_H5Ewalk_stack "red" #define color_H5Fis_hdf5 "red" #define color_H5Fcreate "red" diff --git a/src/H5O.c b/src/H5O.c index cab251b..75d18d2 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1598,7 +1598,7 @@ H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mes ret_value = (H5O_fast_g[cache_type]) (cache, type, mesg); if (ret_value) HGOTO_DONE(ret_value); - H5E_clear(NULL); /*don't care, try reading from header */ + H5E_clear_stack(NULL); /*don't care, try reading from header */ } /* copy the message to the user-supplied buffer */ @@ -2140,7 +2140,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type, * If the message isn't shared then turn off the shared bit * and treat it as an unshared message. */ - H5E_clear (NULL); + H5E_clear_stack (NULL); *flags &= ~H5O_FLAG_SHARED; } else { /* Change type & message to use shared information */ @@ -2993,7 +2993,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) if ((idx = H5O_alloc_extend_chunk(f, oh, chunkno, size)) != UFAIL) { break; } - H5E_clear(NULL); + H5E_clear_stack(NULL); } /* diff --git a/src/H5T.c b/src/H5T.c index cdd7d20..a8189e7 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1287,7 +1287,7 @@ H5T_term_interface(void) (unsigned long)(path->func), path->name); } #endif - H5E_clear(NULL); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ } } @@ -2198,7 +2198,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5I_dec_ref(tmp_sid); H5I_dec_ref(tmp_did); tmp_sid = tmp_did = -1; - H5E_clear(NULL); + H5E_clear_stack(NULL); continue; } /* end if */ @@ -2240,7 +2240,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, tmp_sid = tmp_did = -1; /* We don't care about any failures during the freeing process */ - H5E_clear(NULL); + H5E_clear_stack(NULL); } /* end for */ } /* end else */ @@ -2406,7 +2406,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_close(path->src); H5T_close(path->dst); H5FL_FREE(H5T_path_t,path); - H5E_clear(NULL); /*ignore all shutdown errors*/ + H5E_clear_stack(NULL); /*ignore all shutdown errors*/ } /* end else */ } /* end for */ @@ -4011,7 +4011,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, "conversion function (ignored)\n"); } #endif - H5E_clear(NULL); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ } H5T_g.path[0]->is_noop = TRUE; H5T_g.npaths = 1; @@ -4122,7 +4122,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata), 0, 0, 0, NULL, NULL, dxpl_id)<0) { HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); - H5E_clear(NULL); /*ignore the error*/ + H5E_clear_stack(NULL); /*ignore the error*/ } else { HDstrcpy (path->name, H5T_g.soft[i].name); path->func = H5T_g.soft[i].func; @@ -4172,7 +4172,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, (unsigned long)(path->func), path->name); } #endif - H5E_clear(NULL); /*ignore the failure*/ + H5E_clear_stack(NULL); /*ignore the failure*/ } if (table->src) H5T_close(table->src); if (table->dst) H5T_close(table->dst); diff --git a/src/H5Z.c b/src/H5Z.c index 78a80fa..fa52ec8 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -518,7 +518,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty if (NULL==(fclass=H5Z_find(dcpl_pline.filter[u].id))) { /* Ignore errors from optional filters */ if (dcpl_pline.filter[u].flags & H5Z_FLAG_OPTIONAL) - H5E_clear(NULL); + H5E_clear_stack(NULL); else HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") } /* end if */ @@ -956,7 +956,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, *nbytes = *buf_size; failed |= (unsigned)1 << idx; - H5E_clear(NULL); + H5E_clear_stack(NULL); } else { *nbytes = new_nbytes; } @@ -973,7 +973,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") failed |= (unsigned)1 << idx; - H5E_clear(NULL); + H5E_clear_stack(NULL); continue; /*filter excluded*/ } fclass=&H5Z_table_g[fclass_idx]; @@ -998,7 +998,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } failed |= (unsigned)1 << idx; - H5E_clear(NULL); + H5E_clear_stack(NULL); } else { *nbytes = new_nbytes; } diff --git a/src/H5private.h b/src/H5private.h index 38484f0..f09ae7d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1179,7 +1179,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_API_THREADSAFE; \ FUNC_ENTER_API_COMMON(func_name,err); \ /* Clear thread error stack entering public functions */ \ - H5E_clear(NULL); \ + H5E_clear_stack(NULL); \ { /* diff --git a/src/hdf5.lnt b/src/hdf5.lnt index c66de8a..b3576ce 100755 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -3,7 +3,7 @@ // Turn off warnings about not using the return value from these functions: -esym(534, HDfprintf, HDsnprintf, HDvsnprintf) --esym(534, H5E_clear, H5E_push) +-esym(534, H5E_clear_stack, H5E_push_stack) -esym(534, H5FL_arr_free, H5FL_blk_free, H5FL_reg_free) -esym(534, H5I_clear_group, H5I_destroy_group) -esym(534, H5MM_xfree) diff --git a/test/enum.c b/test/enum.c index bd8397b..b80d488 100644 --- a/test/enum.c +++ b/test/enum.c @@ -376,11 +376,7 @@ test_value_dsnt_exist(void) TESTING("for non-existing name and value"); /* Turn off error reporting since we expect failure in this test */ -#ifdef H5_WANT_H5_V1_6_COMPAT - if (H5Eset_auto(NULL, NULL) < 0) goto error; -#else - if (H5Eset_auto(H5E_DEFAULT, NULL, NULL) < 0) goto error; -#endif /* H5_WANT_H5_V1_6_COMPAT */ + if (H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL) < 0) goto error; if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error; diff --git a/test/err_compat.c b/test/err_compat.c index f06ca10..740fe42 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -226,7 +226,6 @@ main(void) const char *FUNC_main="main"; fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); - /*h5_reset();*/ fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -262,4 +261,4 @@ main(void) printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /* H5_WANT_H5_V1_6_COMPAT */ +#endif /*H5_WANT_H5_V1_6_COMPAT*/ diff --git a/test/error_test.c b/test/error_test.c index ebe0b7e..bd5ee2c 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -119,35 +119,35 @@ test_error(hid_t file) /* Create the dataset */ if ((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT))<0) { - H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, + H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "H5Dcreate failed"); goto error; } /* Test enabling and disabling default printing */ - if (H5Eget_auto(H5E_DEFAULT, &old_func, &old_data)<0) + if (H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_data)<0) TEST_ERROR; if (old_data != NULL) TEST_ERROR; - if (old_func != (H5E_auto_t)H5Eprint) + if (old_func != (H5E_auto_t)H5Eprint_stack) TEST_ERROR; - if(H5Eset_auto(H5E_DEFAULT, NULL, NULL)<0) + if(H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL)<0) TEST_ERROR; /* Make H5Dwrite fail, verify default print is disabled */ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)>=0) { - H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, + H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, "H5Dwrite shouldn't succeed"); goto error; } - if(H5Eset_auto(H5E_DEFAULT, old_func, old_data)<0) + if(H5Eset_auto_stack(H5E_DEFAULT, old_func, old_data)<0) TEST_ERROR; /* Test saving and restoring the current error stack */ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) { - H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, + H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, "H5Dwrite failed as supposed to"); estack_id = H5Eget_current_stack(); H5Dclose(dataset); @@ -269,7 +269,7 @@ error_stack(void) /* Make it push error, force this function to fail */ if((err_num = H5Eget_num(ERR_STACK))==0) { - H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM, + H5Epush_stack(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM, "Get number test failed, returned %d", err_num); goto error; } @@ -307,12 +307,12 @@ dump_error(hid_t estack) { /* Print errors in library default way */ fprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); - if(H5Eprint(estack, stderr)<0) + if(H5Eprint_stack(estack, stderr)<0) TEST_ERROR; /* Customized way to print errors */ fprintf(stderr, "\n********* Print error stack in customized way *********\n"); - if(H5Ewalk(estack, H5E_WALK_UPWARD, custom_print_cb, stderr)<0) + if(H5Ewalk_stack(estack, H5E_WALK_UPWARD, custom_print_cb, stderr)<0) TEST_ERROR; return 0; @@ -432,7 +432,6 @@ main(void) const char *FUNC_main="main"; fprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); - /*h5_reset();*/ /* Initialize errors */ if(init_error()<0) @@ -447,7 +446,7 @@ main(void) /* Test error stack */ if(error_stack()<0) { /* Push an error onto error stack */ - H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, + H5Epush_stack(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, "Error stack test failed"); /* Delete an error from the top of error stack */ @@ -457,7 +456,7 @@ main(void) dump_error(ERR_STACK); /* Empty error stack */ - H5Eclear(ERR_STACK); + H5Eclear_stack(ERR_STACK); /* Close error stack */ H5Eclose_stack(ERR_STACK); @@ -465,10 +464,10 @@ main(void) /* Test error API */ if(test_error(file)<0) { - H5Epush(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, + H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "Error test failed, %s", "it's wrong"); estack_id = H5Eget_current_stack(); - H5Eprint(estack_id, stderr); + H5Eprint_stack(estack_id, stderr); H5Eclose_stack(estack_id); } @@ -486,4 +485,4 @@ main(void) printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /* H5_WANT_H5_V1_6_COMPAT */ +#endif /*H5_WANT_H5_V1_6_COMPAT*/ diff --git a/test/filename.c b/test/filename.c index 9a4af54..5439d14 100644 --- a/test/filename.c +++ b/test/filename.c @@ -41,7 +41,6 @@ typedef struct s1_t { } s1_t; /* Used to make certain a return name _is_ the file name */ -#ifdef H5_WANT_H5_V1_6_COMPAT #define VERIFY_NAME(x, val, where) do { \ if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ @@ -50,24 +49,10 @@ typedef struct s1_t { if (strcmp(x, val)) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ HDstrcmp(x, ""); \ } while(0) -#else /* H5_WANT_H5_V1_6_COMPAT */ -#define VERIFY_NAME(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ - } \ - if (strcmp(x, val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ - "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ - HDstrcmp(x, ""); \ -} while(0) -#endif /* H5_WANT_H5_V1_6_COMPAT */ int main( void ) { diff --git a/test/gheap.c b/test/gheap.c index d7098ea..9417e73 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -89,11 +89,7 @@ test_1 (hid_t fapl) for (i=0; i<1024; i++) { size = i+1; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); @@ -112,11 +108,7 @@ test_1 (hid_t fapl) for (i=0; i<1024; i++) { size = i+1; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) { H5_FAILED(); puts(" Unable to read object"); @@ -189,11 +181,7 @@ test_2 (hid_t fapl) for (i=0; i<1024; i++) { size = 1024-i; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i)<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -207,11 +195,7 @@ test_2 (hid_t fapl) for (i=0; i<1024; i++) { size = 1024-i; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) { H5_FAILED(); puts(" Unable to read object"); @@ -282,11 +266,7 @@ test_3 (hid_t fapl) for (i=0; i<1024; i++) { size = i%30+100; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); @@ -365,11 +345,7 @@ test_4 (hid_t fapl) /* Insert */ size = i%30+100; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); @@ -383,11 +359,7 @@ test_4 (hid_t fapl) * remove B, insert D, E, F; remove E; etc. */ if (1==i%3) { -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i-1); if (status<0) { H5_FAILED(); diff --git a/test/h5test.c b/test/h5test.c index 1338b5b..042c763 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -89,11 +89,7 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; -#ifdef H5_WANT_H5_V1_6_COMPAT -static herr_t h5_errors(void *client_data); -#else /* H5_WANT_H5_V1_6_COMPAT */ static herr_t h5_errors(hid_t err_stack, void *client_data); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- @@ -112,20 +108,11 @@ static herr_t h5_errors(hid_t err_stack, void *client_data); * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -static herr_t -h5_errors(void UNUSED *client_data) -#else static herr_t h5_errors(hid_t err_stack, void UNUSED *client_data) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint (stdout); -#else - H5Eprint (err_stack, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(err_stack, stdout); return 0; } @@ -228,11 +215,8 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eset_auto (h5_errors, NULL); -#else - H5Eset_auto (H5E_DEFAULT, h5_errors, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + + H5Eset_auto_stack(H5E_DEFAULT, h5_errors, NULL); /* * Cause the library to emit some diagnostics early so they don't diff --git a/test/lheap.c b/test/lheap.c index e1694ba..76c11a0 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -74,20 +74,12 @@ main(void) goto error; if (NULL==(f=H5I_object(file))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5HL_create(f, H5P_DATASET_XFER_DEFAULT, 0, &heap_addr/*out*/)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } for (i = 0; i < NOBJS; i++) { @@ -98,11 +90,7 @@ main(void) if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap_addr, strlen(buf)+1, buf))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } } @@ -118,11 +106,7 @@ main(void) if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error; if (NULL==(f=H5I_object(file))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } for (i=0; i=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ "in %s returned %ld \n", \ @@ -40,7 +39,7 @@ if ((ret) == (val)) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } while(0) @@ -52,117 +51,50 @@ if ((ret)<0) { \ TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } #define CHECK_PTR(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ (where), (int)__LINE__, __FILE__, (ret)); \ } \ if (!(ret)) { \ TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ (where), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } /* Used to make certain a return value _is_ a value */ #define VERIFY(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ } \ if ((x) != (val)) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } while(0) /* Used to document process through a test and to check for errors */ #define RESULT(ret,func) do { \ - if (GetTestVerbosity()>VERBO_MED) { \ + if (GetTestVerbosity()>VERBO_MED) { \ print_func(" Call to routine: %15s at line %4d in %s returned " \ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (GetTestVerbosity()>=VERBO_HI) \ - H5Eprint(stdout); \ + if (GetTestVerbosity()>=VERBO_HI) \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ if ((ret) == FAIL) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } while(0) -#else -#define CHECK(ret, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ - "in %s returned %ld \n", \ - where, (int)__LINE__, __FILE__, \ - (long)(ret)); \ - if ((ret) == (val)) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} while(0) - -#define CHECK_I(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ - (where), (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if ((ret)<0) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ - (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} - -#define CHECK_PTR(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (!(ret)) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} - -/* Used to make certain a return value _is_ a value */ -#define VERIFY(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ - } \ - if ((x) != (val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ - "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} while(0) - -/* Used to document process through a test and to check for errors */ -#define RESULT(ret,func) do { \ - if (GetTestVerbosity()>VERBO_MED) { \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if (GetTestVerbosity()>=VERBO_HI) \ - H5Eprint(H5E_DEFAULT, stdout); \ - if ((ret) == FAIL) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} while(0) - -#endif /* H5_WANT_H5_V1_6_COMPAT */ - /* Used to document process through a test */ #define MESSAGE(V,A) {if (GetTestVerbosity()>(V)) print_func A;} diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 5ff0a6e..6bc36c0 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -1244,8 +1244,8 @@ extend_writeInd(void) /* Try write to dataset2 beyond its current dim sizes. Should fail. */ /* Temporary turn off auto error reporting */ - H5Eget_auto(&old_func, &old_client_data); - H5Eset_auto(NULL, NULL); + H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset2); @@ -1259,7 +1259,7 @@ extend_writeInd(void) VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ - H5Eset_auto(old_func, old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ @@ -1534,8 +1534,8 @@ extend_readInd(void) /* Try extend dataset1 which is open RDONLY. Should fail. */ /* first turn off auto error reporting */ - H5Eget_auto(&old_func, &old_client_data); - H5Eset_auto(NULL, NULL); + H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); @@ -1546,7 +1546,7 @@ extend_readInd(void) VRFY((ret < 0), "H5Dextend failed as expected"); /* restore auto error reporting */ - H5Eset_auto(old_func, old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); @@ -1831,8 +1831,8 @@ extend_writeAll(void) /* Try write to dataset2 beyond its current dim sizes. Should fail. */ /* Temporary turn off auto error reporting */ - H5Eget_auto(&old_func, &old_client_data); - H5Eset_auto(NULL, NULL); + H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset2); @@ -1846,7 +1846,7 @@ extend_writeAll(void) VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ - H5Eset_auto(old_func, old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ @@ -1956,8 +1956,8 @@ extend_readAll(void) /* Try extend dataset1 which is open RDONLY. Should fail. */ /* first turn off auto error reporting */ - H5Eget_auto(&old_func, &old_client_data); - H5Eset_auto(NULL, NULL); + H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); @@ -1968,7 +1968,7 @@ extend_readAll(void) VRFY((ret < 0), "H5Dextend failed as expected"); /* restore auto error reporting */ - H5Eset_auto(old_func, old_client_data); + H5Eset_auto_stack(H5E_DEFAULT, old_func, old_client_data); H5Sclose(file_dataspace); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index add1450..5d12db3 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -3378,13 +3378,8 @@ main(int argc, const char *argv[]) dump_function_table = &ddl_function_table; /* Disable error reporting */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else - H5Eget_auto(H5E_DEFAULT, &func, &edata); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eget_auto_stack(H5E_DEFAULT, &func, &edata); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); /* Initialize h5tools lib */ h5tools_init(); @@ -3609,11 +3604,7 @@ done: /* To Do: clean up XML table */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eset_auto(func, edata); -#else - H5Eset_auto(H5E_DEFAULT, func, edata); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eset_auto_stack(H5E_DEFAULT, func, edata); leave(d_status); } diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index f5cdfe0..cc64bd3 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -175,13 +175,8 @@ main (int argc, const char *argv[]) int res; /* Disable error reporting */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - H5Eget_auto (H5E_DEFAULT, &func, &edata); - H5Eset_auto (H5E_DEFAULT, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eget_auto_stack (H5E_DEFAULT, &func, &edata); + H5Eset_auto_stack (H5E_DEFAULT, NULL, NULL); parse_command_line (argc, argv); diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 0bebda7..36a8d80 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -172,13 +172,8 @@ main(int argc, const char *argv[]) struct stat sbuf; /* Disable error reporting */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - H5Eget_auto(H5E_DEFAULT, &func, &edata); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eget_auto_stack(H5E_DEFAULT, &func, &edata); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); parse_command_line(argc, argv); diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index e018eda..2bb457d 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -135,13 +135,8 @@ main (int argc, const char *argv[]) hid_t plist; /* Disable error reporting */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_WANT_H5_V1_6_COMPAT */ - H5Eget_auto (H5E_DEFAULT, &func, &edata); - H5Eset_auto (H5E_DEFAULT, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eget_auto_stack(H5E_DEFAULT, &func, &edata); + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); parse_command_line (argc, argv); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 7107162..24cd953 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -2195,11 +2195,7 @@ main (int argc, const char *argv[]) } /* Turn off HDF5's automatic error printing unless you're debugging h5ls */ -#ifdef H5_WANT_H5_V1_6_COMPAT - if (!show_errors_g) H5Eset_auto(NULL, NULL); -#else - if (!show_errors_g) H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + if (!show_errors_g) H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); /* Each remaining argument is an hdf5 file followed by an optional slash -- cgit v0.12