diff options
author | Scott Wegner <swegner@hdfgroup.org> | 2008-09-17 14:04:35 (GMT) |
---|---|---|
committer | Scott Wegner <swegner@hdfgroup.org> | 2008-09-17 14:04:35 (GMT) |
commit | 036aa878b0c167e4c39a290a75b5dc241ac4f218 (patch) | |
tree | 1d1cc1def6d68befff2515ae2f7a59d540fd3093 /src/H5EApkg.h | |
parent | 95149cc0957dd05585388c8d8532d84269bf0075 (diff) | |
download | hdf5-036aa878b0c167e4c39a290a75b5dc241ac4f218.zip hdf5-036aa878b0c167e4c39a290a75b5dc241ac4f218.tar.gz hdf5-036aa878b0c167e4c39a290a75b5dc241ac4f218.tar.bz2 |
[svn-r15639] Purpose: Check for __func__ keyword during configure
Description:
In some of the new H5EA* code, many new C99 features are being used. Most of them are portable to all compilers, but the __func__ keyword in particular isn't supported in Visual Studio on Windows. Instead, Windows defines the __FUNCTION__ keyword, which can be used as a direct substitute.
We now check for the __func__ keyword during configure and define the feature flag H5_HAVE_C99_FUNC. There was previously a check for __FUNCTION__, and the feature flags H5_HAVE_FUNCTION. In H5EApkg.h, we check for the presents of each of these in order to see which to use. If neither are avaiable, fail.
Tested:
h5committest (kagiso, smirom, linew)
Diffstat (limited to 'src/H5EApkg.h')
-rw-r--r-- | src/H5EApkg.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 74ed3fb..5f6f10f 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -111,9 +111,18 @@ H5_DECLARE_PKG_VAR(H5_MY_PKG_INIT, H5_MY_PKG) /* API re-entrance variable */ extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */ +/* Use FUNC to safely handle variations of C99 __func__ keyword handling */ +#ifdef H5_HAVE_C99_FUNC +#define FUNC __func__ +#elif defined(H5_HAVE_FUNCTION) +#define FUNC __FUNCTION__ +#else +#error "We need __func__ or __FUNCTION__ to test function names!" +#endif + /* Macros for entering different scopes of routines */ #define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ - FUNC_ENTER_NAME_CHECK(H5_IS_PKG(__func__)) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PKG(FUNC)) \ \ /* The library should be initialized already */ \ HDassert(H5_INIT_GLOBAL); \ @@ -123,13 +132,13 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ \ /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(__func__) \ + H5_PUSH_FUNC(FUNC) \ \ /* Enter scope for this type of function */ \ { #define H5_PRIVATE_ENTER(pkg, pkg_init) \ - FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(__func__)) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(FUNC)) \ \ /* The library should be initialized already */ \ HDassert(H5_INIT_GLOBAL); \ @@ -138,20 +147,15 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ \ /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(__func__) \ + H5_PUSH_FUNC(FUNC) \ \ /* Enter scope for this type of function */ \ {{ -/* Remove this shim and change H5TRACE* macros when this change is permanent -QAK */ -#ifdef H5_DEBUG_API -#define FUNC __func__ -#endif - #define H5_PUBLIC_ENTER(pkg, pkg_init) \ - FUNC_ENTER_API_VARS(__func__) \ + FUNC_ENTER_API_VARS(FUNC) \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_NAME_CHECK(H5_IS_PUB(__func__)) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PUB(FUNC)) \ \ /* Clear thread error stack when entering public functions */ \ H5E_clear_stack(NULL); \ @@ -175,10 +179,10 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through H5_api_entered_g = TRUE; \ \ /* Start logging MPI's MPE information */ \ - BEGIN_MPE_LOG(__func__) \ + BEGIN_MPE_LOG(FUNC) \ \ /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(__func__) \ + H5_PUSH_FUNC(FUNC) \ \ /* Enter scope for this type of function */ \ {{{ @@ -291,7 +295,7 @@ func_init_failed: \ * error number, a description of the error (as a printf-like format string), * and an optional set of arguments for the printf format arguments. */ -#define H5E_PRINTF(...) H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) +#define H5E_PRINTF(...) H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__) /* * H5_LEAVE macro, used to facilitate control flow between a |