summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-08-13 12:54:01 (GMT)
committerGitHub <noreply@github.com>2021-08-13 12:54:01 (GMT)
commit5d212789548346705d8afdff7155a502f992aacd (patch)
tree01e25ea2c8083eec191a9e5e2ef2140ee9a15826 /src
parente2c47ffb01b42a3da930e2b175b40810d4bcfbca (diff)
downloadhdf5-5d212789548346705d8afdff7155a502f992aacd.zip
hdf5-5d212789548346705d8afdff7155a502f992aacd.tar.gz
hdf5-5d212789548346705d8afdff7155a502f992aacd.tar.bz2
Merge2 839 issue PRs to hdf5 1 12 (#906)
* Use internal version of H5Eprint2 to avoid possible stack overflow (#661) * Reduces overly-pedantic casting in the public headers (#644) * Committing clang-format changes * Fixes overly pedantic casting in public headers Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix H5FD_mpio_Debug="rw" can report MPI_count instead of bytes (#699) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return * Committing clang-format changes * minor edits * code format * Committing clang-format changes * code format * minor edit * switched from using MPI_count, to actual bytes written for H5FD_mpio_debug rw debugging * Committing clang-format changes * changed size_i in printf to reflect the I/O. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes pre-C99 build and header cruft (#700) * Committing clang-format changes * Removes pre-C99 build and header cruft * Assumes ANSI C headers exist * Assumes stdbool.h, stdint.h, and inttypes.h are present * Assumes the C++ compiler can handle stdint.h * Removes all work-arounds for missing functionality, especially stdbool.h * Formats source Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Clean up type size checks in configure.ac (#702) * Removes some DEC Alpha cruft from H5detect and H5private.h (#708) * Updates bin/trace script to correctly wrap H5TRACE macros near clang-format column limit (#719) * Removes clang-format comments from H5O.c call * Fixes bin/trace to correctly wrap lines near the clang-format limit * Removed unused variable from bin/trace * Adds __STDC_FORMAT_MACROS before including inttypes.h w/ C++ (#726) * Adds __STDC_FORMAT_MACROS before including inttypes.h w/ C++ Allows C++ library to be built on older versions of gcc. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Moves H5PacketTable default ctor inside source file (#731) * Remove private H5_GCC_DIAG_OFF/ON from standalone program (#734) * Organize and align compiler flags (#741) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Fixes C++ warnings when passing hsize_t values to printf in test code (#745) * Normalization of H5_nanosleep() with VFD SWMR branch (#746) * Normalization of H5_nanosleep() with VFD SWMR branch * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Correct missing variable declaration. * Fixes some H5SL include statements (#758) * Fixes non-C99 format strings in tarray test code (#766) * Cleans up some POSIX header bits in H5private.h (#783) * Further simplifies Autotools type size checks (#789) Also fixes an issue where clock_gettime and difftime are not detected due to earlier simplifications of this code. * Normalization of CMake H5pubconf.h with Autotools (#791) Mostly just moving things around and changing the comments to keep the delta small. The only symbol change is that for curl/curl.h which I changed to H5_HAVE_CURL_CURL_H to match the Autotools. This symbol is not used in the library and is just an artifact of the checks. Co-authored-by: jhendersonHDF <jhenderson@hdfgroup.org> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/H5Dpublic.h16
-rw-r--r--src/H5E.c36
-rw-r--r--src/H5ESpublic.h12
-rw-r--r--src/H5Epublic.h2
-rw-r--r--src/H5FDmpio.c24
-rw-r--r--src/H5Fpublic.h4
-rw-r--r--src/H5Gint.c1
-rw-r--r--src/H5Gpkg.h1
-rw-r--r--src/H5HFpkg.h1
-rw-r--r--src/H5Lpublic.h4
-rw-r--r--src/H5Ppublic.h2
-rw-r--r--src/H5Spublic.h2
-rw-r--r--src/H5Tpublic.h2
-rw-r--r--src/H5detect.c15
-rw-r--r--src/H5private.h64
-rw-r--r--src/H5public.h31
-rw-r--r--src/H5system.c42
-rw-r--r--src/H5win32defs.h1
18 files changed, 120 insertions, 140 deletions
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index b73e62d..422359f 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -28,9 +28,9 @@
/*****************/
/* Macros used to "unset" chunk cache configuration parameters */
-#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t)-1)
-#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t)-1)
-#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
+#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT SIZE_MAX
+#define H5D_CHUNK_CACHE_NBYTES_DEFAULT SIZE_MAX
+#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0)
/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
@@ -46,11 +46,11 @@
typedef enum H5D_layout_t {
H5D_LAYOUT_ERROR = -1,
- H5D_COMPACT = 0, /**< raw data is very small */
- H5D_CONTIGUOUS = 1, /**< the default */
- H5D_CHUNKED = 2, /**< slow and fancy */
- H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
- H5D_NLAYOUTS = 4 /**< this one must be last! */
+ H5D_COMPACT = 0, /**< raw data is very small */
+ H5D_CONTIGUOUS = 1, /**< the default */
+ H5D_CHUNKED = 2, /**< slow and fancy */
+ H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
+ H5D_NLAYOUTS = 4 /**< this one must be last! */
} H5D_layout_t;
//! <!-- [H5D_layout_t_snip] -->
diff --git a/src/H5E.c b/src/H5E.c
index bcadd63..5b6c723 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -85,6 +85,8 @@ static H5E_t * H5E__get_current_stack(void);
static herr_t H5E__set_current_stack(H5E_t *estack);
static herr_t H5E__close_stack(H5E_t *err_stack);
static ssize_t H5E__get_num(const H5E_t *err_stack);
+static herr_t H5E__print2(hid_t err_stack, FILE *stream);
+static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack);
/*********************/
/* Package Variables */
@@ -325,10 +327,10 @@ H5E__set_default_auto(H5E_t *stk)
#endif /* H5_USE_16_API_DEFAULT */
stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1;
- stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2;
+ stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2;
stk->auto_op.is_default = TRUE;
#else /* H5_NO_DEPRECATED_SYMBOLS */
- stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2;
+ stk->auto_op.func2 = (H5E_auto2_t)H5E__print2;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
stk->auto_data = NULL;
@@ -1446,13 +1448,37 @@ done:
herr_t
H5Eprint2(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(FAIL)
/*NO TRACE*/
+ /* Print error stack */
+ if ((ret_value = H5E__print2(err_stack, stream)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Eprint2() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5E__print2
+ *
+ * Purpose: Internal helper routine for H5Eprint2.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5E__print2(hid_t err_stack, FILE *stream)
+{
+ H5E_t *estack; /* Error stack to operate on */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
/* Need to check for errors */
if (err_stack == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
@@ -1472,8 +1498,8 @@ H5Eprint2(hid_t err_stack, FILE *stream)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Eprint2() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5E__print2() */
/*-------------------------------------------------------------------------
* Function: H5Ewalk2
diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h
index 28b41fa..fb156ac 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -24,6 +24,18 @@
/* Public Macros */
/*****************/
+/* Default value for "no event set" / synchronous execution */
+#define H5ES_NONE 0 /* (hid_t) */
+
+/* Special "wait" timeout values */
+#define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */
+#define H5ES_WAIT_NONE \
+ (0) /* Don't wait for operations to complete, \
+ * just check their status. \
+ * (this allows H5ESwait to behave \
+ * like a 'test' operation) \
+ */
+
/*******************/
/* Public Typedefs */
/*******************/
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 2f529b3..1c7055a 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -24,7 +24,7 @@
#include "H5Ipublic.h"
/* Value for the default error stack */
-#define H5E_DEFAULT (hid_t)0
+#define H5E_DEFAULT 0 /* (hid_t) */
/**
* Different kinds of error information
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index c0b14ce..16912cf 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1193,12 +1193,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if ((hsize_t)size_i != size)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
-#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_debug_r_flag)
- HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off,
- size_i);
-#endif
-
/* Only look for MPI views for raw data transfers */
if (type == H5FD_MEM_DRAW) {
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
@@ -1343,6 +1337,12 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (bytes_read < 0 || bytes_read > io_size)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", FUNC, file->mpi_rank, (long)mpi_off,
+ bytes_read);
+#endif
+
/*
* This gives us zeroes beyond end of physical MPI file.
*/
@@ -1430,12 +1430,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off")
size_i = (int)size;
-#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_debug_w_flag)
- HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off,
- size_i);
-#endif
-
/* Get the transfer mode from the API context */
if (H5CX_get_io_xfer_mode(&xfer_mode) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
@@ -1560,6 +1554,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (bytes_written != io_size || bytes_written < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", FUNC, file->mpi_rank,
+ (long)mpi_off, bytes_written);
+#endif
+
/* Each process will keep track of its perceived EOF value locally, and
* ultimately we will reduce this value to the maximum amongst all
* processes, but until then keep the actual eof at HADDR_UNDEF just in
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 89238b6..f25f8f9 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -84,7 +84,7 @@
(0x0020u) /**< Restrict search to objects opened through current file ID \
(as opposed to objects opened through any file ID accessing this file) */
-#define H5F_FAMILY_DEFAULT (hsize_t)0
+#define H5F_FAMILY_DEFAULT 0 /* (hsize_t) */
#ifdef H5_HAVE_PARALLEL
/**
@@ -108,7 +108,7 @@ typedef enum H5F_scope_t {
/**
* Unlimited file size for H5Pset_external()
*/
-#define H5F_UNLIMITED ((hsize_t)(-1L))
+#define H5F_UNLIMITED HSIZE_UNDEF
/**
* How does file close behave?
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 7488357..75b206e 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -38,6 +38,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
+#include "H5SLprivate.h" /* Skip lists */
/****************/
/* Local Macros */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index b0adf30..521f94f 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -35,7 +35,6 @@
#include "H5HFprivate.h" /* Fractal heaps */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Oprivate.h" /* Object headers */
-#include "H5SLprivate.h" /* Skip lists */
/**************************/
/* Package Private Macros */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 893a65d..8d189e8 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -34,7 +34,6 @@
#include "H5B2private.h" /* v2 B-trees */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FSprivate.h" /* Free space manager */
-#include "H5SLprivate.h" /* Skip lists */
/**************************/
/* Package Private Macros */
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index bf1de86..a4f1102 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -39,12 +39,12 @@
*
* The maximum length of a link's name is encoded in a 32-bit unsigned integer.
*/
-#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
+#define H5L_MAX_LINK_NAME_LEN UINT32_MAX
/**
* \brief Macro to indicate operation occurs on same location
*/
-#define H5L_SAME_LOC (hid_t)0
+#define H5L_SAME_LOC 0 /* (hid_t) */
/**
* \brief Current version of the H5L_class_t struct
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 5adb05e..3d6968e 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -100,7 +100,7 @@
#define H5P_CRT_ORDER_INDEXED 0x0002
/* Default value for all property list classes */
-#define H5P_DEFAULT (hid_t)0
+#define H5P_DEFAULT 0 /* (hid_t) */
#ifdef __cplusplus
extern "C" {
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 331e5ee..cf5abe8 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -22,7 +22,7 @@
#include "H5Ipublic.h"
/* Define atomic datatypes */
-#define H5S_ALL (hid_t)0
+#define H5S_ALL 0 /* (hid_t) */
#define H5S_UNLIMITED HSIZE_UNDEF
/* Define user-level maximum number of dimensions */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index b708506..776769e 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -245,7 +245,7 @@ typedef struct {
* Indicate that a string is variable length (null-terminated in C, instead of
* fixed length)
*/
-#define H5T_VARIABLE ((size_t)(-1))
+#define H5T_VARIABLE SIZE_MAX
/* Opaque information */
/**
diff --git a/src/H5detect.c b/src/H5detect.c
index e4fe453..fd5e980 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -1655,21 +1655,6 @@ main(int argc, char *argv[])
if (!rawoutstream)
rawoutstream = stdout;
-#if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS)
-#if defined(UAC_NOPRINT) && defined(UAC_SIGBUS)
- /*
- * Make sure unaligned access generates SIGBUS and doesn't print warning
- * messages so that we can detect alignment constraints on the DEC Alpha.
- */
- int nvpairs[2];
- nvpairs[0] = SSIN_UACPROC;
- nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS;
- if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0) < 0) {
- fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno));
- }
-#endif
-#endif
-
#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL)
/* verify the SIGBUS and SIGSEGV handlers work properly */
if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) {
diff --git a/src/H5private.h b/src/H5private.h
index 07705e4..808c2ce 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -26,25 +26,6 @@
#include "H5public.h" /* Include Public Definitions */
-/* include the pthread header */
-#ifdef H5_HAVE_THREADSAFE
-#ifdef H5_HAVE_WIN32_API
-#ifndef H5_HAVE_WIN_THREADS
-#ifdef H5_HAVE_PTHREAD_H
-#include <pthread.h>
-#endif /* H5_HAVE_PTHREAD_H */
-#endif /* H5_HAVE_WIN_THREADS */
-#else /* H5_HAVE_WIN32_API */
-#ifdef H5_HAVE_PTHREAD_H
-#include <pthread.h>
-#endif /* H5_HAVE_PTHREAD_H */
-#endif /* H5_HAVE_WIN32_API */
-#endif /* H5_HAVE_THREADSAFE */
-
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -53,37 +34,28 @@
#include <limits.h>
#include <math.h>
#include <signal.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
-/*
- * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1
- * compliant. Otherwise all bets are off.
- */
+/* POSIX headers */
#ifdef H5_HAVE_UNISTD_H
-#include <sys/types.h>
+#include <pwd.h>
#include <unistd.h>
-#endif
-#ifdef _POSIX_VERSION
+#include <sys/types.h>
#include <sys/wait.h>
-#include <pwd.h>
#endif
-/*
- * C9x integer types
- */
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
-#include <stdint.h>
-#endif
+/* Include the Pthreads header, if necessary */
+#if defined(H5_HAVE_THREADSAFE) && defined(H5_HAVE_PTHREAD_H)
+#include <pthread.h>
#endif
/*
- * The `struct stat' data type for stat() and fstat(). This is a Posix file
- * but often apears on non-Posix systems also. The `struct stat' is required
- * for hdf5 to compile, although only a few fields are actually used.
+ * The `struct stat' data type for stat() and fstat(). This is a POSIX file
+ * but often apears on non-POSIX systems also. The `struct stat' is required
+ * for HDF5 to compile, although only a few fields are actually used.
*/
#ifdef H5_HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -139,21 +111,6 @@
#endif
/*
- * System information. These are needed on the DEC Alpha to turn off fixing
- * of unaligned accesses by the operating system during detection of
- * alignment constraints in H5detect.c:main().
- */
-#ifdef H5_HAVE_SYS_SYSINFO_H
-#include <sys/sysinfo.h>
-#endif
-#ifdef H5_HAVE_SYS_PROC_H
-#include <sys/proc.h>
-#endif
-#ifdef H5_HAVE_IO_H
-#include <io.h>
-#endif
-
-/*
* Dynamic library handling. These are needed for dynamically loading I/O
* filters and VFDs.
*/
@@ -187,6 +144,7 @@
#include <windows.h>
#include <direct.h> /* For _getcwd() */
+#include <io.h> /* POSIX I/O */
#endif /*H5_HAVE_WIN32_API*/
diff --git a/src/H5public.h b/src/H5public.h
index 09a2278..30d297e 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -34,28 +34,25 @@
#ifdef H5_HAVE_FEATURES_H
#include <features.h> /* For setting POSIX, BSD, etc. compatibility */
#endif
+
#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef H5_STDC_HEADERS
+
#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */
#include <stdarg.h> /* For variadic functions in H5VLpublic.h */
-#endif
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
+
#include <stdint.h> /* For C9x types */
+
+#ifdef __cplusplus
+#define __STDC_FORMAT_MACROS
#endif
-#else
-#ifdef H5_HAVE_STDINT_H_CXX
-#include <stdint.h> /* For C9x types (when included from C++) */
-#endif
-#endif
-#ifdef H5_HAVE_INTTYPES_H
#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
-#endif
+
#ifdef H5_HAVE_STDDEF_H
#include <stddef.h>
#endif
+
#ifdef H5_HAVE_PARALLEL
/* Don't link against MPI C++ bindings */
#define MPICH_SKIP_MPICXX 1
@@ -217,19 +214,7 @@ typedef int herr_t;
* }
* \endcode
*/
-#ifdef H5_HAVE_STDBOOL_H
#include <stdbool.h>
-#else /* H5_HAVE_STDBOOL_H */
-#ifndef __cplusplus
-#if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0)
-#define bool _Bool
-#else
-#define bool unsigned int
-#endif
-#define true 1
-#define false 0
-#endif /* __cplusplus */
-#endif /* H5_HAVE_STDBOOL_H */
typedef bool hbool_t;
typedef int htri_t;
diff --git a/src/H5system.c b/src/H5system.c
index 144e0bc..4aae743 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -964,10 +964,7 @@ done:
* Note that commodity hardware is probably going to have a
* resolution of milliseconds, not nanoseconds.
*
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * October 01, 2016
+ * Return: void
*--------------------------------------------------------------------------
*/
void
@@ -976,21 +973,40 @@ H5_nanosleep(uint64_t nanosec)
FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifdef H5_HAVE_WIN32_API
+ DWORD dwMilliseconds = (DWORD)HDceil(nanosec / 1.0e6);
+ DWORD ignore;
- /* On Windows, Sleep() is in milliseconds. Passing 0 to Sleep()
- * causes the thread to relinquish the rest of its time slice.
+ /* Windows can't sleep at a ns resolution. Best we can do is ~1 ms. We
+ * don't care about the return value since the second parameter
+ * (bAlertable) is FALSE, so it will always be zero.
*/
- Sleep(nanosec / (1000 * 1000));
+ ignore = SleepEx(dwMilliseconds, FALSE);
#else
- {
- struct timespec sleeptime; /* Struct to hold time to sleep */
- /* Set up time to sleep */
- sleeptime.tv_sec = 0;
- sleeptime.tv_nsec = (long)nanosec;
+ const uint64_t nanosec_per_sec = 1000 * 1000 * 1000;
+ struct timespec sleeptime; /* Struct to hold time to sleep */
- HDnanosleep(&sleeptime, NULL);
+ /* Set up time to sleep
+ *
+ * Assuming ILP32 or LP64 or wider architecture, (long)operand
+ * satisfies 0 <= operand < nanosec_per_sec < LONG_MAX.
+ *
+ * It's harder to be sure that we don't overflow time_t.
+ */
+ sleeptime.tv_sec = (time_t)(nanosec / nanosec_per_sec);
+ sleeptime.tv_nsec = (long)(nanosec % nanosec_per_sec);
+
+ /* Sleep for up to `sleeptime` and, in the event of an interruption,
+ * save the unslept time back to `sleeptime`.
+ */
+ while (HDnanosleep(&sleeptime, &sleeptime) == -1) {
+ /* If we were just interrupted, sleep for the remaining time.
+ * Otherwise, the error was essentially impossible, so just stop
+ * sleeping.
+ */
+ if (errno != EINTR)
+ break;
}
#endif
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 88911b0..0617643 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -45,7 +45,6 @@ typedef __int64 h5_stat_size_t;
#define HDlseek(F, O, W) _lseeki64(F, O, W)
#define HDlstat(S, B) _lstati64(S, B)
#define HDmkdir(S, M) _mkdir(S)
-#define HDnanosleep(N, O) Wnanosleep(N, O)
#define HDoff_t __int64
/* Note that the variadic HDopen macro is using a VC++ extension