diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-05 15:05:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-05 15:05:17 (GMT) |
commit | 548eec307006ebd01294fad2886421f07c3c92c8 (patch) | |
tree | f12a7a425e7c90e8895a205491fd8a85d21d5e90 /src/H5private.h | |
parent | 4ffc0b6acb36064e91a1afeb6eceee704e5af7f2 (diff) | |
download | hdf5-548eec307006ebd01294fad2886421f07c3c92c8.zip hdf5-548eec307006ebd01294fad2886421f07c3c92c8.tar.gz hdf5-548eec307006ebd01294fad2886421f07c3c92c8.tar.bz2 |
[svn-r16920] Description:
Merge these trunk revisions which occurred during the 1.8.3 release code
freeze back to the 1.8 branch:
From Quincey: 16845 16847 16849 16851 16858 16869 16897
From Ray: 16859 16880
From Allen: 16863
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/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.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 114 |
1 files changed, 84 insertions, 30 deletions
diff --git a/src/H5private.h b/src/H5private.h index 27a8f65..998b7c3 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -436,35 +436,6 @@ #endif /* - * A macro for detecting over/under-flow when casting between types - */ -#ifndef NDEBUG -#define H5_CHECK_OVERFLOW(var, vartype, casttype) \ -{ \ - casttype _tmp_overflow = (casttype)(var); \ - assert((var) == (vartype)_tmp_overflow); \ -} -#else /* NDEBUG */ -#define H5_CHECK_OVERFLOW(var, vartype, casttype) -#endif /* NDEBUG */ - -/* - * A macro for detecting over/under-flow when assigning between types - */ -#ifndef NDEBUG -#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ -{ \ - srctype _tmp_overflow = (srctype)(src); \ - dsttype _tmp_overflow2 = (dsttype)(_tmp_overflow); \ - assert((dsttype)_tmp_overflow == _tmp_overflow2); \ - (dst) = _tmp_overflow2; \ -} -#else /* NDEBUG */ -#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ - (dst) = (dsttype)(src); -#endif /* NDEBUG */ - -/* * Data types and functions for timing certain parts of the library. */ typedef struct { @@ -758,6 +729,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDstat */ typedef struct stat64 h5_stat_t; typedef off64_t h5_stat_size_t; + #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T #else /* H5_SIZEOF_OFF_T!=8 && ... */ #ifndef HDfstat #define HDfstat(F,B) fstat(F,B) @@ -767,6 +739,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDstat */ typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; + #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #endif /* H5_SIZEOF_OFF_T!=8 && ... */ #endif /* !defined(HDfstat) || !defined(HDstat) */ @@ -1231,6 +1204,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #ifndef HDstrtoul #define HDstrtoul(S,R,N) strtoul(S,R,N) #endif /* HDstrtoul */ +#ifndef HDstrtoull + #define HDstrtoull(S,R,N) strtoull(S,R,N) +#endif /* HDstrtoul */ #ifndef HDstrxfrm #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) #endif /* HDstrxfrm */ @@ -1370,6 +1346,78 @@ extern char *strdup(const char *s); #define HDpthread_self_ulong() ((unsigned long)pthread_self()) #endif /* HDpthread_self_ulong */ +/* + * A macro for detecting over/under-flow when casting between types + */ +#ifndef NDEBUG +#define H5_CHECK_OVERFLOW(var, vartype, casttype) \ +{ \ + casttype _tmp_overflow = (casttype)(var); \ + assert((var) == (vartype)_tmp_overflow); \ +} +#else /* NDEBUG */ +#define H5_CHECK_OVERFLOW(var, vartype, casttype) +#endif /* NDEBUG */ + +/* + * A macro for detecting over/under-flow when assigning between types + */ +#ifndef NDEBUG +#define ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_src == (srctype)_tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) \ + (dst) = (dsttype)(src); + +#define ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_src >= 0); \ + assert(_tmp_src == _tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) \ + (dst) = (dsttype)(src); + +#define ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_dst >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_src >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) \ + (dst) = (dsttype)(src); + +/* Include the generated overflow header file */ +#include "H5overflow.h" + +#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ + H5_GLUE4(ASSIGN_,srctype,_TO_,dsttype)(dst,dsttype,src,srctype)\ + +#else /* NDEBUG */ +#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ + (dst) = (dsttype)(src); +#endif /* NDEBUG */ + #if defined(H5_HAVE_WINDOW_PATH) /* directory delimiter for Windows: slash and backslash are acceptable on Windows */ @@ -1687,6 +1735,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #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); /* Threadsafety initialization code for API routines */ @@ -1856,7 +1905,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ - H5_POP_FUNC; \ + H5_POP_FUNC \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return (ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ @@ -1865,6 +1916,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #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); \ } /*end scope from end of FUNC_ENTER*/ \ @@ -1896,6 +1949,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Macro for "glueing" together items, for re-scanning macros */ #define H5_GLUE(x,y) x##y #define H5_GLUE3(x,y,z) x##y##z +#define H5_GLUE4(w,x,y,z) w##x##y##z /* Compile-time "assert" macro */ #define HDcompile_assert(e) do { enum { compile_assert__ = 1 / (e) }; } while(0) |