diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-03-20 20:00:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 20:00:06 (GMT) |
commit | b766e5f96f26805e8c92e718a05f42d073912711 (patch) | |
tree | 0b7c992bc24581608d308428e25b0f93e86bdd61 /src/H5private.h | |
parent | 1ffaa38174b0f784b7ed6a471f40bf0e749ceac3 (diff) | |
download | hdf5-b766e5f96f26805e8c92e718a05f42d073912711.zip hdf5-b766e5f96f26805e8c92e718a05f42d073912711.tar.gz hdf5-b766e5f96f26805e8c92e718a05f42d073912711.tar.bz2 |
Normalize platform-independence code w/ develop (#2615)
* Normalize platform-independence code w/ develop
* Use C99 types and functions in lieu of C89 work-arounds
* Align key files with develop
- H5public.h
- H5private.h
- H5system.c
- H5win32defs.h
* Minor fixes elsewhere to support changes in above files
* Incidentally brings Fortran mod directory settings file change over
This does NOT change the configure/build files. Those will still do the
checks needed for the C89 work-around cruft until the perf and perform
code gets cleaned up.
* Add C++98 fixes
* Explicitly set -std=c++98 in Autotools
* Do not include cstdlib in H5public.h (requires C++11)
* Remove redundant stdbool.h include
* Fix alarm issues on Windows
* Bring parallel alarm() changes from develop
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 292 |
1 files changed, 94 insertions, 198 deletions
diff --git a/src/H5private.h b/src/H5private.h index 319f43c..ecb7726 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -36,6 +36,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> /* POSIX headers */ #ifdef H5_HAVE_SYS_TIME_H @@ -43,7 +44,6 @@ #endif #ifdef H5_HAVE_UNISTD_H #include <unistd.h> -#include <sys/types.h> #endif #ifdef H5_HAVE_PWD_H #include <pwd.h> @@ -67,25 +67,6 @@ #endif /* - * If a program may include both `time.h' and `sys/time.h' then - * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.ac). - * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not - * protected against multiple inclusion, so programs should not explicitly - * include both files. This macro is useful in programs that use, for example, - * `struct timeval' or `struct timezone' as well as `struct tm'. It is best - * used in conjunction with `HAVE_SYS_TIME_H', whose existence is checked - * by `AC_CHECK_HEADERS(sys/time.h)' in configure.ac. - */ -#if defined(H5_TIME_WITH_SYS_TIME) -#include <sys/time.h> -#include <time.h> -#elif defined(H5_HAVE_SYS_TIME_H) -#include <sys/time.h> -#else -#include <time.h> -#endif - -/* * Longjumps are used to detect alignment constraints */ #ifdef H5_HAVE_SETJMP_H @@ -126,8 +107,8 @@ #include <dirent.h> #endif -/* Define the default VFD for this platform. - * Since the removal of the Windows VFD, this is sec2 for all platforms. +/* Define the default VFD for this platform. Since the removal of the + * Windows VFD, this is sec2 for all platforms. */ #define H5_DEFAULT_VFD H5FD_SEC2 @@ -401,91 +382,16 @@ #endif /* - * Numeric data types. Some of these might be defined in Posix.1g, otherwise - * we define them with the closest available type which is at least as large - * as the number of bits indicated in the type name. The `int8' types *must* - * be exactly one byte wide because we use it for pointer calculations to - * void* memory. - */ -#if H5_SIZEOF_INT8_T == 0 -typedef signed char int8_t; -#undef H5_SIZEOF_INT8_T -#define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR -#elif H5_SIZEOF_INT8_T == 1 -#else -#error "the int8_t type must be 1 byte wide" -#endif - -#if H5_SIZEOF_UINT8_T == 0 -typedef unsigned char uint8_t; -#undef H5_SIZEOF_UINT8_T -#define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR -#elif H5_SIZEOF_UINT8_T == 1 -#else -#error "the uint8_t type must be 1 byte wide" -#endif - -#if H5_SIZEOF_INT16_T >= 2 -#elif H5_SIZEOF_SHORT >= 2 -typedef short int16_t; -#undef H5_SIZEOF_INT16_T -#define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 2 -typedef int int16_t; -#undef H5_SIZEOF_INT16_T -#define H5_SIZEOF_INT16_T H5_SIZEOF_INT -#else -#error "nothing appropriate for int16_t" -#endif - -#if H5_SIZEOF_UINT16_T >= 2 -#elif H5_SIZEOF_SHORT >= 2 -typedef unsigned short uint16_t; -#undef H5_SIZEOF_UINT16_T -#define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 2 -typedef unsigned uint16_t; -#undef H5_SIZEOF_UINT16_T -#define H5_SIZEOF_UINT16_T H5_SIZEOF_INT -#else -#error "nothing appropriate for uint16_t" -#endif - -#if H5_SIZEOF_INT32_T >= 4 -#elif H5_SIZEOF_SHORT >= 4 -typedef short int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 4 -typedef int int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 4 -typedef long int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_LONG -#else -#error "nothing appropriate for int32_t" -#endif - -/* - * Maximum and minimum values. These should be defined in <limits.h> for the - * most part. + * The max value for ssize_t. + * + * Only needed where ssize_t isn't a thing (e.g., Windows) */ -#ifndef LLONG_MAX -#define LLONG_MAX ((long long)(((unsigned long long)1 << (8 * sizeof(long long) - 1)) - 1)) -#define LLONG_MIN ((long long)(-LLONG_MAX) - 1) -#endif -#ifndef ULLONG_MAX -#define ULLONG_MAX ((unsigned long long)((long long)(-1))) -#endif -#ifndef SIZET_MAX -#define SIZET_MAX ((size_t)(ssize_t)(-1)) -#define SSIZET_MAX ((ssize_t)(((size_t)1 << (8 * sizeof(ssize_t) - 1)) - 1)) +#ifndef SSIZE_MAX +#define SSIZE_MAX ((ssize_t)(((size_t)1 << (8 * sizeof(ssize_t) - 1)) - 1)) #endif /* - * Maximum & minimum values for our typedefs. + * Maximum & minimum values for HDF5 typedefs. */ #define HSIZET_MAX ((hsize_t)ULLONG_MAX) #define HSSIZET_MAX ((hssize_t)LLONG_MAX) @@ -525,7 +431,7 @@ typedef long int32_t; #else #define h5_posix_io_t size_t #define h5_posix_io_ret_t ssize_t -#define H5_POSIX_MAX_IO_BYTES SSIZET_MAX +#define H5_POSIX_MAX_IO_BYTES SSIZE_MAX #endif /* POSIX I/O mode used as the third parameter to open/_open @@ -634,14 +540,29 @@ typedef struct { haddr_t addr; /* The unique address of the object's header in that file */ } H5_obj_t; -/* - * Redefine all the POSIX functions. We should never see a POSIX - * function (or any other non-HDF5 function) in the source! +#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T + +/* Put all Windows-specific definitions in H5win32defs.h so we + * can (mostly) assume a POSIX platform. Not all of the POSIX calls + * will have a Windows equivalent so some #ifdef protection is still + * necessary (e.g., fork()). */ +#include "H5win32defs.h" -/* Put all platform-specific definitions in the following file */ -/* so that the following definitions are platform free. */ -#include "H5win32defs.h" /* For Windows-specific definitions */ +/* Platform-independent definitions for struct stat and off_t */ +#ifndef H5_HAVE_WIN32_API +/* These definitions differ in Windows and are defined in + * H5win32defs for that platform. + */ +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#endif + +/* Redefine all the POSIX and C functions. We should never see an + * undecorated POSIX or C function (or any other non-HDF5 function) + * in the source. + */ #ifndef HDabort #define HDabort() abort() @@ -659,11 +580,7 @@ typedef struct { #define HDacos(X) acos(X) #endif #ifndef HDalarm -#ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) -#else -#define HDalarm(N) (0) -#endif #endif #ifndef HDasctime #define HDasctime(T) asctime(T) @@ -768,11 +685,7 @@ typedef struct { #define HDcuserid(S) cuserid(S) #endif #ifndef HDdifftime -#ifdef H5_HAVE_DIFFTIME #define HDdifftime(X, Y) difftime(X, Y) -#else -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif #endif #ifndef HDdiv #define HDdiv(X, Y) div(X, Y) @@ -783,9 +696,6 @@ typedef struct { #ifndef HDdup2 #define HDdup2(F, I) dup2(F, I) #endif -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ #ifndef HDexecv #define HDexecv(S, AV) execv(S, AV) #endif @@ -819,11 +729,9 @@ typedef struct { #ifndef HDfclose #define HDfclose(F) fclose(F) #endif -#ifdef H5_HAVE_FCNTL #ifndef HDfcntl #define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__) #endif -#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) #endif @@ -910,20 +818,11 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) #endif -/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ #ifndef HDfrexpf -#ifdef H5_HAVE_FREXPF #define HDfrexpf(X, N) frexpf(X, N) -#else -#define HDfrexpf(X, N) frexp(X, N) -#endif #endif #ifndef HDfrexpl -#ifdef H5_HAVE_FREXPL #define HDfrexpl(X, N) frexpl(X, N) -#else -#define HDfrexpl(X, N) frexp(X, N) -#endif #endif #ifndef HDfscanf #define HDfscanf fscanf @@ -937,24 +836,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfstat #define HDfstat(F, B) fstat(F, B) #endif -#ifndef HDlstat -#define HDlstat(S, B) lstat(S, B) -#endif -#ifndef HDstat -#define HDstat(S, B) stat(S, B) -#endif - -#ifndef H5_HAVE_WIN32_API -/* These definitions differ in Windows and are defined in - * H5win32defs for that platform. - */ -typedef struct stat h5_stat_t; -typedef off_t h5_stat_size_t; -#define HDoff_t off_t -#endif /* H5_HAVE_WIN32_API */ - -#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - #ifndef HDftell #define HDftell(F) ftell(F) #endif @@ -1150,6 +1031,9 @@ typedef off_t h5_stat_size_t; #ifndef HDlseek #define HDlseek(F, O, W) lseek(F, O, W) #endif +#ifndef HDlstat +#define HDlstat(S, B) lstat(S, B) +#endif #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) #endif @@ -1325,7 +1209,9 @@ typedef off_t h5_stat_size_t; #ifndef HDrmdir #define HDrmdir(S) rmdir(S) #endif -/* scanf() variable arguments */ +#ifndef HDscanf +#define HDscanf scanf /*varargs*/ +#endif #ifndef HDselect #define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T) #endif @@ -1420,7 +1306,10 @@ typedef off_t h5_stat_size_t; #define HDsqrt(X) sqrt(X) #endif #ifndef HDsscanf -#define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__) +#define HDsscanf sscanf /*varargs*/ +#endif +#ifndef HDstat +#define HDstat(S, B) stat(S, B) #endif #ifndef HDstrcat #define HDstrcat(X, Y) strcat(X, Y) @@ -1489,11 +1378,7 @@ typedef off_t h5_stat_size_t; #define HDstrtol(S, R, N) strtol(S, R, N) #endif #ifndef HDstrtoll -#ifdef H5_HAVE_STRTOLL #define HDstrtoll(S, R, N) strtoll(S, R, N) -#else -H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); -#endif #endif #ifndef HDstrtoul #define HDstrtoul(S, R, N) strtoul(S, R, N) @@ -1507,11 +1392,9 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifndef HDstrxfrm #define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z) #endif -#ifdef H5_HAVE_SYMLINK #ifndef HDsymlink #define HDsymlink(F1, F2) symlink(F1, F2) #endif -#endif #ifndef HDsysconf #define HDsysconf(N) sysconf(N) #endif @@ -1592,7 +1475,7 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifdef H5_HAVE_VASPRINTF #define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) #else -H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); +H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #endif #endif @@ -1850,51 +1733,52 @@ extern char H5libhdf5_settings[]; /* embedded library information */ #define H5TRACE0(R, T) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T) + CALLTIME = H5_trace(NULL, __func__, T) #define H5TRACE1(R, T, A0) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0) #define H5TRACE2(R, T, A0, A1) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1) #define H5TRACE3(R, T, A0, A1, A2) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2) #define H5TRACE4(R, T, A0, A1, A2, A3) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3) #define H5TRACE5(R, T, A0, A1, A2, A3, A4) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4) #define H5TRACE6(R, T, A0, A1, A2, A3, A4, A5) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5) #define H5TRACE7(R, T, A0, A1, A2, A3, A4, A5, A6) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6) #define H5TRACE8(R, T, A0, A1, A2, A3, A4, A5, A6, A7) \ - RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7) + RTYPE = R; \ + CALLTIME = \ + H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7) #define H5TRACE9(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8) #define H5TRACE10(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9) #define H5TRACE11(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9, #A10, A10) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9, #A10, A10) #define H5TRACE12(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11) #define H5TRACE_RETURN(V) \ if (RTYPE) { \ - H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \ + H5_trace(&CALLTIME, __func__, RTYPE, NULL, V); \ RTYPE = NULL; \ } #else @@ -2041,7 +1925,7 @@ extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ /* Include required function stack header */ #include "H5CSprivate.h" -#define H5_PUSH_FUNC H5CS_push(FUNC); +#define H5_PUSH_FUNC H5CS_push(__func__); #define H5_POP_FUNC H5CS_pop(); #else /* H5_HAVE_CODESTACK */ #define H5_PUSH_FUNC /* void */ @@ -2126,7 +2010,7 @@ H5_DLL herr_t H5CX_pop(void); #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; #define FUNC_ENTER_API_INIT(err) \ @@ -2135,7 +2019,7 @@ H5_DLL herr_t H5CX_pop(void); H5_INIT_GLOBAL = TRUE; \ if (H5_init_library() < 0) \ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \ - } /* end if */ \ + } \ \ /* Initialize the package, if appropriate */ \ H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) @@ -2207,7 +2091,7 @@ H5_DLL herr_t H5CX_pop(void); { \ { \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG \ { @@ -2224,7 +2108,7 @@ H5_DLL herr_t H5CX_pop(void); { \ { \ { \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ FUNC_ENTER_API_INIT(err); \ { @@ -2240,14 +2124,14 @@ H5_DLL herr_t H5CX_pop(void); /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(err) \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ FUNC_ENTER_NOAPI_INIT(err) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ FUNC_ENTER_NOAPI_INIT(-) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2261,7 +2145,7 @@ H5_DLL herr_t H5CX_pop(void); */ #define FUNC_ENTER_NOAPI_NOINIT \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2276,7 +2160,7 @@ H5_DLL herr_t H5CX_pop(void); */ #define FUNC_ENTER_NOAPI_NOINIT_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2288,7 +2172,7 @@ H5_DLL herr_t H5CX_pop(void); */ #define FUNC_ENTER_NOAPI_NOFS \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ \ /* Initialize the package, if appropriate */ \ H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ @@ -2305,7 +2189,7 @@ H5_DLL herr_t H5CX_pop(void); */ #define FUNC_ENTER_NOAPI_NOERR_NOFS \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use the following two macros as replacements for the FUNC_ENTER_NOAPI @@ -2315,7 +2199,7 @@ H5_DLL herr_t H5CX_pop(void); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ FUNC_ENTER_NOAPI_INIT(err) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2324,7 +2208,7 @@ H5_DLL herr_t H5CX_pop(void); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2332,14 +2216,14 @@ H5_DLL herr_t H5CX_pop(void); /* Use this macro for all "normal" package-level functions */ #define FUNC_ENTER_PACKAGE \ { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2349,7 +2233,7 @@ H5_DLL herr_t H5CX_pop(void); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2357,14 +2241,14 @@ H5_DLL herr_t H5CX_pop(void); /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC \ { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2372,7 +2256,7 @@ H5_DLL herr_t H5CX_pop(void); /* And that shouldn't push their name on the function stack */ #define FUNC_ENTER_STATIC_NOERR_NOFS \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use the following macro as replacement for the FUNC_ENTER_STATIC @@ -2381,7 +2265,7 @@ H5_DLL herr_t H5CX_pop(void); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2532,6 +2416,18 @@ H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG) #define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0) */ +/* Private typedefs */ + +/* Union for const/non-const pointer for use by functions that manipulate + * pointers but do not write to their targets or return pointers to const + * specified locations. Also used for I/O functions that work for read and + * write - these functions are expected to never write to these locations in the + * write case. This helps us avoid compiler warnings. */ +typedef union { + void *vp; + const void *cvp; +} H5_flexible_const_ptr_t; + /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); |