diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-05 14:54:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-05 14:54:06 (GMT) |
commit | 12f9610b7b576b238f986965b5c499fcaba0c4c4 (patch) | |
tree | 347724af603e0c757751bb4fc6410c15af6458c6 /src/H5private.h | |
parent | e0ba416d34934918492e6b716bae1f57e6f8ebc9 (diff) | |
download | hdf5-12f9610b7b576b238f986965b5c499fcaba0c4c4.zip hdf5-12f9610b7b576b238f986965b5c499fcaba0c4c4.tar.gz hdf5-12f9610b7b576b238f986965b5c499fcaba0c4c4.tar.bz2 |
[svn-r17839] Description:
Bring r17838 from trunk to 1.8 branch:
Further refactoring of v2 B-tree code, moving toward being able to pass
a context information to a client's encode/decode callbacks.
Also, clean up of other minor compiler warnings and code formatting
issues.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.1 (amazon) in debug mode
Mac OS X/32 10.6.1 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 139 |
1 files changed, 80 insertions, 59 deletions
diff --git a/src/H5private.h b/src/H5private.h index df6ea8d..227f7c2 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1686,7 +1686,7 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ #include "H5CSprivate.h" #define H5_PUSH_FUNC(func_name) H5CS_push(#func_name) -#define H5_POP_FUNC H5CS_pop() +#define H5_POP_FUNC H5CS_pop(); #else /* H5_HAVE_CODESTACK */ #define H5_PUSH_FUNC(func_name) /* void */ #define H5_POP_FUNC /* void */ @@ -1742,10 +1742,14 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) #endif /* NDEBUG */ -#define FUNC_ENTER_COMMON(func_name,asrt) \ - static const char FUNC[]=#func_name; \ +#define FUNC_ENTER_COMMON(func_name, asrt) \ + static const char FUNC[] = #func_name; \ hbool_t err_occurred = FALSE; \ - FUNC_ENTER_COMMON_NOFUNC(func_name,asrt); + FUNC_ENTER_COMMON_NOFUNC(func_name, asrt); + +#define FUNC_ENTER_COMMON_NOERR(func_name, asrt) \ + static const char FUNC[] = #func_name; \ + FUNC_ENTER_COMMON_NOFUNC(func_name, asrt); /* Threadsafety initialization code for API routines */ #define FUNC_ENTER_API_THREADSAFE \ @@ -1756,22 +1760,37 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); H5_API_UNSET_CANCEL \ H5_API_LOCK -/* Threadsafety termination code for API routines */ -#define FUNC_LEAVE_API_THREADSAFE \ - H5_API_UNLOCK \ - H5_API_SET_CANCEL - /* Local variables for API routines */ #define FUNC_ENTER_API_VARS(func_name) \ MPE_LOG_VARS(func_name) \ H5TRACE_DECL +#define FUNC_ENTER_API_COMMON(func_name) \ + FUNC_ENTER_API_VARS(func_name) \ + FUNC_ENTER_COMMON(func_name, H5_IS_API(#func_name)); \ + FUNC_ENTER_API_THREADSAFE; + +#define FUNC_ENTER_API_INIT(func_name,err) \ + /* Initialize the library */ \ + if(!(H5_INIT_GLOBAL)) { \ + H5_INIT_GLOBAL = TRUE; \ + if(H5_init_library() < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ + "library initialization failed") \ + } \ + \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ + \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(#func_name) \ + \ + BEGIN_MPE_LOG(func_name) + /* Use this macro for all "normal" API functions */ #define FUNC_ENTER_API(func_name,err) {{ \ - FUNC_ENTER_API_VARS(func_name) \ - FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_API_COMMON(func_name,err); \ + FUNC_ENTER_API_COMMON(func_name) \ + FUNC_ENTER_API_INIT(func_name,err); \ /* Clear thread error stack entering public functions */ \ H5E_clear_stack(NULL); \ { @@ -1781,10 +1800,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * like H5Eprint and H5Ewalk. */ #define FUNC_ENTER_API_NOCLEAR(func_name,err) {{ \ - FUNC_ENTER_API_VARS(func_name) \ - FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_API_COMMON(func_name,err); \ + FUNC_ENTER_API_COMMON(func_name) \ + FUNC_ENTER_API_INIT(func_name,err); \ { /* @@ -1794,9 +1811,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * */ #define FUNC_ENTER_API_NOINIT(func_name) {{ \ - FUNC_ENTER_API_VARS(func_name) \ - FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_API_COMMON(func_name) \ H5_PUSH_FUNC(func_name); \ BEGIN_MPE_LOG(func_name); \ { @@ -1808,16 +1823,30 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOFS(func_name) {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS(func_name) {{ \ FUNC_ENTER_API_VARS(func_name) \ - FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_COMMON_NOERR(func_name, H5_IS_API(#func_name)); \ + FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG(func_name); \ { +/* Note: this macro only works when there's _no_ interface initialization routine for the module */ +#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ + \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(#func_name) + /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(func_name,err) { \ - FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \ + FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ + { + +/* Use this macro for all non-API functions, which propagate errors, but don't issue them */ +#define FUNC_ENTER_NOAPI_NOERR(func_name,err) { \ + FUNC_ENTER_COMMON_NOERR(func_name, !H5_IS_API(#func_name)); \ FUNC_ENTER_NOAPI_INIT(func_name,err) \ { @@ -1835,8 +1864,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * - functions which are called during library shutdown, since we don't * want to re-initialize the library. */ -#define FUNC_ENTER_NOAPI_NOINIT(func_name) { \ - FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \ +#define FUNC_ENTER_NOAPI_NOINIT(func_name) { \ + FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ H5_PUSH_FUNC(func_name); \ { @@ -1847,6 +1876,20 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * initialized. * - functions which are called during library shutdown, since we don't * want to re-initialize the library. + * - functions that propagate, but don't issue errors + */ +#define FUNC_ENTER_NOAPI_NOINIT_NOERR(func_name) { \ + FUNC_ENTER_COMMON_NOERR(func_name, !H5_IS_API(#func_name)); \ + H5_PUSH_FUNC(#func_name) \ + { + +/* + * Use this macro for non-API functions which fall into these categories: + * - static functions, since they must be called from a function in the + * interface, the library and interface must already be + * initialized. + * - functions which are called during library shutdown, since we don't + * want to re-initialize the library. * * This macro is used for functions which fit the above categories _and_ * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) @@ -1870,31 +1913,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ { -#define FUNC_ENTER_API_COMMON(func_name,err) \ - /* Initialize the library */ \ - if (!(H5_INIT_GLOBAL)) { \ - H5_INIT_GLOBAL = TRUE; \ - if (H5_init_library()<0) \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "library initialization failed") \ - } \ - \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ - \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(func_name); \ - \ - BEGIN_MPE_LOG(func_name) - -/* Note: this macro only works when there's _no_ interface initialization routine for the module */ -#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ - \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(func_name); - /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be * the last statement executed by a function. @@ -1911,6 +1929,11 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * *------------------------------------------------------------------------- */ +/* Threadsafety termination code for API routines */ +#define FUNC_LEAVE_API_THREADSAFE \ + H5_API_UNLOCK \ + H5_API_SET_CANCEL + #define FUNC_LEAVE_API(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ @@ -1918,28 +1941,26 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); if(err_occurred) \ (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ - return (ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_API_NOFS(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ - if(err_occurred) \ - (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ - return (ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ - H5_POP_FUNC; \ - return (ret_value); \ + H5_POP_FUNC \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI_VOID \ - H5_POP_FUNC; \ + H5_POP_FUNC \ return; \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -1950,7 +1971,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * (so far, just the H5CS routines themselves) */ #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \ - return (ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ |