summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/trace38
-rw-r--r--config/cmake/H5pubconf.h.in18
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake29
-rw-r--r--config/cmake_ext_mod/HDFTests.c8
-rw-r--r--config/cmake_ext_mod/HDFUseCXX.cmake11
-rw-r--r--configure.ac53
-rw-r--r--release_docs/RELEASE.txt43
-rw-r--r--src/H5FDlog.c7
-rw-r--r--src/H5FDmpio.c12
-rw-r--r--src/H5Gdeprec.c10
-rw-r--r--src/H5Pfapl.c11
-rw-r--r--src/H5detect.c15
-rw-r--r--src/H5private.h28
-rw-r--r--src/H5public.h25
-rw-r--r--test/cache.c13
-rw-r--r--test/cache_common.c12
-rw-r--r--test/cache_logging.c6
-rw-r--r--test/tmisc.c25
-rw-r--r--test/vfd.c13
-rw-r--r--tools/test/perform/chunk.c2
-rw-r--r--tools/test/perform/direct_write_perf.c5
-rw-r--r--tools/test/perform/overhead.c6
-rw-r--r--tools/test/perform/perf.c2
-rw-r--r--tools/test/perform/pio_engine.c2
-rw-r--r--tools/test/perform/pio_standalone.h5
-rw-r--r--tools/test/perform/sio_engine.c2
-rw-r--r--tools/test/perform/sio_standalone.h5
27 files changed, 169 insertions, 237 deletions
diff --git a/bin/trace b/bin/trace
index 7f74e03..090b558 100755
--- a/bin/trace
+++ b/bin/trace
@@ -298,10 +298,33 @@ sub rewrite_func ($$$$$) {
# Compose the trace macro
$trace = "H5TRACE" . scalar(@arg_str) . "(\"$rettype\", \"";
$trace .= join("", @arg_str) . "\"";
- my $len = 4 + length $trace; # Add 4, for indenting the line
- for (@arg_name) {
- # Wrap lines that will be longer than the limit, after ');' is added
- if ($len + length >= ($max_trace_macro_line_len - 2)) {
+ $argtrace .= join("", @arg_str) . "\"";
+
+ # Add 4 for indenting the line
+ my $len = 4 + length($trace);
+
+ for my $i (0 .. $#arg_name) {
+ # Handle wrapping
+
+ # Be VERY careful here! clang-format and this script MUST agree
+ # on which lines get wrapped or there will be churn as each tries
+ # to undo the other's output.
+ #
+ # TWO cases must be handled:
+ # 1) The argument is that last one and ');' will be appended
+ # 2) The argument is NOT the last one and ',' will be appended
+ #
+ # NB: clang-format does NOT consider terminal newlines when
+ # counting columns for the ColumnLimit
+ #
+ # The extra '2' added after $len includes the ', ' that would be
+ # added BEFORE the argument.
+ #
+ my $adjust = ($i + 1 == scalar(@arg_str)) ? 2 : 1;
+ my $len_if_added = $len + 2 + length($arg_name[$i]) + $adjust;
+
+ # Wrap lines that will be longer than the limit
+ if ($len_if_added > $max_trace_macro_line_len) {
# Wrap line, with indention
$trace .= ",\n ";
$len = 13; # Set to 13, for indention
@@ -317,8 +340,11 @@ sub rewrite_func ($$$$$) {
}
# Append argument
- $trace .= "$_";
- $len += length; # Add length of appended argument name
+ $trace .= "$arg_name[$i]";
+ $argtrace .= ", $arg_name[$i]";
+
+ # Add length of appended argument name
+ $len += length($arg_name[$i]);
}
# Append final ');' for macro
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 00d8097..842cfe8 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -198,15 +198,9 @@
optimization operation */
#cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@
-/* Define to 1 if you have the <inttypes.h> header file. */
-#cmakedefine H5_HAVE_INTTYPES_H @H5_HAVE_INTTYPES_H@
-
/* Define to 1 if you have the `ioctl' function. */
#cmakedefine H5_HAVE_IOCTL @H5_HAVE_IOCTL@
-/* Define to 1 if you have the <io.h> header file. */
-#cmakedefine H5_HAVE_IO_H @H5_HAVE_IO_H@
-
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#cmakedefine H5_HAVE_LIBCRYPTO @H5_HAVE_LIBCRYPTO@
@@ -358,18 +352,9 @@
/* Define if `struct stat' has the `st_blocks' field */
#cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@
-/* Define to 1 if you have the <stdbool.h> header file. */
-#cmakedefine H5_HAVE_STDBOOL_H @H5_HAVE_STDBOOL_H@
-
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine H5_HAVE_STDINT_H @H5_HAVE_STDINT_H@
-
-/* Define to 1 if you have the <stdint.h> header file for Cplusplus. */
-#cmakedefine H5_HAVE_STDINT_H_CXX @H5_HAVE_STDINT_H_CXX@
-
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@
@@ -713,9 +698,6 @@
/* The size of `__int64', as computed by sizeof. */
#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@
-/* Define to 1 if you have the ANSI C header files. */
-#cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@
-
/* Define if strict file format checks are enabled */
#cmakedefine H5_STRICT_FORMAT_CHECKS @H5_STRICT_FORMAT_CHECKS@
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 004aded..d44ede7 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -120,23 +120,13 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H)
CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H)
CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H)
CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H)
-CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H)
CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H)
# Windows
-CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H)
if (NOT CYGWIN)
CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H)
endif ()
-if (CMAKE_SYSTEM_NAME MATCHES "OSF")
- CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H)
- CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H)
-else ()
- set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE)
- set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE)
-endif ()
-
CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H)
CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H)
CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H)
@@ -146,12 +136,9 @@ CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H)
CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H)
CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H)
CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H)
-CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H)
CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H)
-# _Bool type support
-CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H)
## Check for non-standard extenstion quadmath.h
@@ -238,11 +225,6 @@ macro (HDF_FUNCTION_TEST OTHER_TEST)
endmacro ()
#-----------------------------------------------------------------------------
-# Check for these functions before the time headers are checked
-#-----------------------------------------------------------------------------
-HDF_FUNCTION_TEST (STDC_HEADERS)
-
-#-----------------------------------------------------------------------------
# Check for large file support
#-----------------------------------------------------------------------------
@@ -416,13 +398,9 @@ HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T)
# Extra C99 types
#-----------------------------------------------------------------------------
-# _Bool type support
-if (HAVE_STDBOOL_H)
- set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
- HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL)
-else ()
- HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL)
-endif ()
+# Size of bool
+set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
+HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL)
if (MINGW OR NOT WINDOWS)
#-----------------------------------------------------------------------------
@@ -560,7 +538,6 @@ if (MINGW OR NOT WINDOWS)
foreach (other_test
HAVE_ATTRIBUTE
HAVE_C99_FUNC
-# STDC_HEADERS
HAVE_FUNCTION
HAVE_C99_DESIGNATED_INITIALIZER
SYSTEM_SCOPE_THREADS
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 2d7e1b4..0c3b7b7 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -88,14 +88,6 @@ int main(void)
}
#endif
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-int main() { return 0; }
-#endif /* STDC_HEADERS */
-
#ifdef HAVE_ATTRIBUTE
diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake
index 580c409..423f74a 100644
--- a/config/cmake_ext_mod/HDFUseCXX.cmake
+++ b/config/cmake_ext_mod/HDFUseCXX.cmake
@@ -32,17 +32,6 @@ endif ()
include (CheckIncludeFileCXX)
include (TestForSTDNamespace)
-# IF the c compiler found stdint, check the C++ as well. On some systems this
-# file will be found by C but not C++, only do this test IF the C++ compiler
-# has been initialized (e.g. the project also includes some c++)
-if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
- CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX)
- if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX)
- set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H")
- set (USE_INCLUDES ${USE_INCLUDES} "stdint.h")
- endif ()
-endif ()
-
# For other CXX specific tests, use this MACRO.
macro (HDF_CXX_FUNCTION_TEST OTHER_TEST)
if (NOT DEFINED ${OTHER_TEST})
diff --git a/configure.ac b/configure.ac
index d0ce46a..d233323 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1224,8 +1224,6 @@ AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h])
AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h])
AC_CHECK_HEADERS([stddef.h setjmp.h features.h])
AC_CHECK_HEADERS([dirent.h])
-AC_CHECK_HEADERS([stdint.h], [C9x=yes])
-AC_CHECK_HEADERS([stdbool.h])
AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h])
## Darwin
@@ -1241,15 +1239,15 @@ esac
## Windows
case "`uname`" in
CYGWIN*)
- AC_CHECK_HEADERS([io.h sys/timeb.h])
+ AC_CHECK_HEADERS([sys/timeb.h])
UNAME_CYGWIN="yes"
;;
MINGW*)
- AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h])
+ AC_CHECK_HEADERS([winsock2.h sys/timeb.h])
AC_HAVE_LIBRARY([ws2_32])
;;
*)
- AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h])
+ AC_CHECK_HEADERS([winsock2.h sys/timeb.h])
;;
esac
@@ -1340,16 +1338,15 @@ CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS"
## Checkpoint the cache
AC_CACHE_SAVE
-## Posix.1g types (C9x)
+## Write the confdefs.h header for checking sizes
cat >>confdefs.h <<\EOF
-#include <sys/types.h>
-EOF
-
-if test "X$C9x" = "Xyes"; then
- cat >>confdefs.h <<\EOF
+#include <stdbool.h>
#include <stdint.h>
+#ifdef HAVE_UNISTD_H
+#include <sys/types.h>
+#endif
+#include <time.h>
EOF
-fi
AC_CHECK_SIZEOF( [int8_t])
AC_CHECK_SIZEOF( [uint8_t])
@@ -1379,34 +1376,12 @@ AC_CHECK_SIZEOF([uint_least64_t])
AC_CHECK_SIZEOF( [int_fast64_t])
AC_CHECK_SIZEOF( [uint_fast64_t])
+AC_CHECK_SIZEOF([bool])
+AC_CHECK_SIZEOF([off_t])
+AC_CHECK_SIZEOF([ptrdiff_t])
AC_CHECK_SIZEOF([size_t])
AC_CHECK_SIZEOF([ssize_t])
-AC_CHECK_SIZEOF([ptrdiff_t])
-
-cat >>confdefs.h <<\EOF
-#include <sys/types.h> /*for off_t definition*/
-EOF
-AC_CHECK_SIZEOF([off_t])
-
-if test "X$C9x" = "Xyes"; then
- cat >>confdefs.h <<\EOF
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h> /* for bool definition */
-#else
-#define bool _Bool
-#endif
-EOF
-AC_CHECK_SIZEOF([bool])
-fi
-
-AC_CHECK_SIZEOF(time_t, [], [
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-])
+AC_CHECK_SIZEOF([time_t])
## Checkpoint the cache
AC_CACHE_SAVE
@@ -1911,10 +1886,8 @@ if test "X$THREADSAFE" = "Xyes"; then
AC_CACHE_VAL([hdf5_cv_system_scope_threads],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
- #if STDC_HEADERS
#include <stdlib.h>
#include <pthread.h>
- #endif
],[
pthread_attr_t attribute;
int ret;
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 4c8fe0a..6006b1e 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -262,6 +262,49 @@ New Features
Library:
--------
+ - H5Gcreate1() now rejects size_hint parameters larger than UINT32_MAX
+
+ The size_hint value is ultimately stored in a uint32_t struct field,
+ so specifying a value larger than this on a 64-bit machine can cause
+ undefined behavior including crashing the system.
+
+ The documentation for this API call was also incorrect, stating that
+ passing a negative value would cause the library to use a default
+ value. Instead, passing a "negative" value actually passes a very large
+ value, which is probably not what the user intends and can cause
+ crashes on 64-bit systems.
+
+ The Doxygen documentation has been updated and passing values larger
+ than UINT32_MAX for size_hint will now produce a normal HDF5 error.
+
+ (DER - 2021/04/29, HDFFV-11241)
+
+
+ - H5Pset_fapl_log() no longer crashes when passed an invalid fapl ID
+
+ When passed an invalid fapl ID, H5Pset_fapl_log() would usually
+ segfault when attempting to free an uninitialized pointer in the error
+ handling code. This behavior is more common in release builds or
+ when the memory sanitization checks were not selected as a build
+ option.
+
+ The pointer is now correctly initialized and the API call now
+ produces a normal HDF5 error when fed an invalid fapl ID.
+
+ (DER - 2021/04/28, HDFFV-11240)
+
+ - Fixes a segfault when H5Pset_mdc_log_options() is called multiple times
+
+ The call incorrectly attempts to free an internal copy of the previous
+ log location string, which causes a segfault. This only happens
+ when the call is invoked multiple times on the same property list.
+ On the first call to a given fapl, the log location is set to NULL so
+ the segfault does not occur.
+
+ The string is now handled properly and the segfault no longer occurs.
+
+ (DER - 2021/04/27, HDFFV-11239)
+
- HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows
HSYS_GOTO_ERROR is an internal macro that is used to produce error
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index aa2d6db..38ea346 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -326,12 +326,15 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sULz", fapl_id, logfile, flags, buf_size);
+ /* Do this first, so that we don't try to free a wild pointer if
+ * H5P_object_verify() fails.
+ */
+ HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
+
/* Check arguments */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
-
/* Duplicate the log file string
* A little wasteful, since this string will just be copied later, but
* passing it in as a pointer sets off a chain of impossible-to-resolve
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 501ec6f..2dd7fd3 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1470,6 +1470,12 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
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.
*/
@@ -1659,6 +1665,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if (bytes_written != io_size)
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/H5Gdeprec.c b/src/H5Gdeprec.c
index 2916198..75e47d4 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -143,10 +143,10 @@ H5G_map_obj_type(H5O_type_t obj_type)
* specified NAME. The group is opened for write access
* and it's object ID is returned.
*
- * The optional SIZE_HINT specifies how much file space to
- * reserve to store the names that will appear in this
- * group. If a non-positive value is supplied for the SIZE_HINT
- * then a default size is chosen.
+ * The SIZE_HINT parameter specifies how much file space to reserve
+ * to store the names that will appear in this group. This number
+ * must be less than or equal to UINT32_MAX. If zero is supplied
+ * for the SIZE_HINT then a default size is chosen.
*
* Note: Deprecated in favor of H5Gcreate2
*
@@ -177,6 +177,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ if (size_hint > UINT32_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX")
/* Check if we need to create a non-standard GCPL */
if (size_hint > 0) {
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index fe5a81e..d7408e3 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -4254,7 +4254,7 @@ herr_t
H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access)
{
H5P_genplist_t *plist; /* Property list pointer */
- char * tmp_location; /* Working location pointer */
+ char * new_location; /* Working location pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -4270,19 +4270,14 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list")
- /* Get the current location string and free it */
- if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current log location")
- H5MM_xfree(tmp_location);
-
/* Make a copy of the passed-in location */
- if (NULL == (tmp_location = H5MM_xstrdup(location)))
+ if (NULL == (new_location = H5MM_xstrdup(location)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location")
/* Set values */
if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag")
- if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
+ if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location")
if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag")
diff --git a/src/H5detect.c b/src/H5detect.c
index 52950bb..35da85e 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 162fae4..b31ec78 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -41,10 +41,6 @@
#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>
@@ -56,7 +52,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/*
* If _POSIX_VERSION is defined in unistd.h then this system is Posix.1
@@ -71,14 +66,7 @@
#include <pwd.h>
#endif
-/*
- * C9x integer types
- */
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
#include <stdint.h>
-#endif
-#endif
/*
* The `struct stat' data type for stat() and fstat(). This is a Posix file
@@ -139,21 +127,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.
*/
@@ -184,6 +157,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 470f8b8..8d22e9d 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -34,13 +34,14 @@
#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 */
-#endif
+
#ifndef __cplusplus
#ifdef H5_HAVE_STDINT_H
#include <stdint.h> /* For C9x types */
@@ -50,9 +51,13 @@
#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 */
+
+#ifdef __cplusplus
+#define __STDC_FORMAT_MACROS
#endif
+
+#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
+
#ifdef H5_HAVE_STDDEF_H
#include <stddef.h>
#endif
@@ -217,19 +222,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/test/cache.c b/test/cache.c
index 85cc417..c6950ac 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -8068,19 +8068,6 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu
if ((check[i].entry_num != i) || (check[i].entry_type < 0) ||
(check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) ||
(check[i].entry_index > max_indices[check[i].entry_type]) ||
-#ifndef H5_HAVE_STDBOOL_H
- /* Check for nonsense values if hbool_t is an integral
- * type instead of a real Boolean.
- */
- ((check[i].in_cache != TRUE) && (check[i].in_cache != FALSE)) ||
- ((check[i].at_main_addr != TRUE) && (check[i].at_main_addr != FALSE)) ||
- ((check[i].is_dirty != TRUE) && (check[i].is_dirty != FALSE)) ||
- ((check[i].is_protected != TRUE) && (check[i].is_protected != FALSE)) ||
- ((check[i].is_pinned != TRUE) && (check[i].is_pinned != FALSE)) ||
- ((check[i].expected_deserialized != TRUE) && (check[i].expected_deserialized != FALSE)) ||
- ((check[i].expected_serialized != TRUE) && (check[i].expected_serialized != FALSE)) ||
- ((check[i].expected_destroyed != TRUE) && (check[i].expected_destroyed != FALSE)) ||
-#endif /* H5_HAVE_STDBOOL_H */
(check[i].expected_size <= (size_t)0)) {
pass = FALSE;
diff --git a/test/cache_common.c b/test/cache_common.c
index 3762196..089f9a0 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1508,12 +1508,6 @@ add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hb
HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
HDassert((0 <= idx) && (idx <= max_indices[type]));
HDassert(new_size <= VARIABLE_ENTRY_SIZE);
-#ifndef H5_HAVE_STDBOOL_H
- /* Check for TRUE or FALSE if we're using an integer type instead
- * of a real Boolean type.
- */
- HDassert((flag == TRUE) || (flag == FALSE));
-#endif /* H5_HAVE_STDBOOL_H */
if (pass) {
@@ -1713,12 +1707,6 @@ execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_o
HDassert((0 <= op_ptr->type) && (op_ptr->type < NUMBER_OF_ENTRY_TYPES));
HDassert((0 <= op_ptr->idx) && (op_ptr->idx <= max_indices[op_ptr->type]));
HDassert(flags_ptr != NULL);
-#ifndef H5_HAVE_STDBOOL_H
- /* Check for TRUE or FALSE if we're using an integer type instead
- * of a real Boolean type.
- */
- HDassert((op_ptr->flag == FALSE) || (op_ptr->flag == TRUE));
-#endif /* H5_HAVE_STDBOOL_H */
if (pass) {
diff --git a/test/cache_logging.c b/test/cache_logging.c
index 448e12b..af43845 100644
--- a/test/cache_logging.c
+++ b/test/cache_logging.c
@@ -58,6 +58,12 @@ test_logging_api(void)
if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
TEST_ERROR;
+ /* Ensure that setting the property twice doesn't cause problems
+ * (addresses a previous bug).
+ */
+ if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
+ TEST_ERROR;
+
/* Check to make sure that the property list getter returns the correct
* location string buffer size;
*/
diff --git a/test/tmisc.c b/test/tmisc.c
index a559191..fbb3ca8 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -3998,9 +3998,31 @@ test_misc23(void)
H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gcreate1");
- tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
+ /* Make sure that size_hint values that can't fit into a 32-bit
+ * unsigned integer are rejected. Only necessary on systems where
+ * size_t is a 64-bit type.
+ */
+ if (SIZE_MAX > UINT32_MAX) {
+ H5E_BEGIN_TRY
+ {
+ tmp_id = H5Gcreate1(file_id, "/size_hint_too_large", SIZE_MAX);
+ }
+ H5E_END_TRY;
+ VERIFY(tmp_id, FAIL, "H5Gcreate1");
+ }
+
+ /* Make sure the largest size_hint value works */
+ H5E_BEGIN_TRY
+ {
+ tmp_id = H5Gcreate1(file_id, "/largest_size_hint", UINT32_MAX);
+ }
+ H5E_END_TRY;
CHECK(tmp_id, FAIL, "H5Gcreate1");
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+ tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
+ CHECK(tmp_id, FAIL, "H5Gcreate1");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
@@ -4013,7 +4035,6 @@ test_misc23(void)
tmp_id = H5Dcreate1(file_id, "/A/dset", type_id, space_id, create_id);
CHECK(tmp_id, FAIL, "H5Dcreate1");
-
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/test/vfd.c b/test/vfd.c
index 843c772..af734d8 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -1835,12 +1835,23 @@ test_log(void)
hsize_t file_size = 0;
unsigned int flags = H5FD_LOG_ALL;
size_t buf_size = 4 * KB;
+ herr_t ret = SUCCEED;
TESTING("LOG file driver");
- /* Set property list and file name for log driver. */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
+
+ /* Make sure calling with an invalid fapl doesn't crash */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Pset_fapl_log(H5I_INVALID_HID, LOG_FILENAME, 0, 0);
+ }
+ H5E_END_TRY;
+ if (SUCCEED == ret)
+ TEST_ERROR;
+
+ /* Set property list and file name for log driver. */
if (H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
index 1b6793a..1b08e95 100644
--- a/tools/test/perform/chunk.c
+++ b/tools/test/perform/chunk.c
@@ -24,12 +24,10 @@
#undef NDEBUG
#include "hdf5.h"
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/* Solaris Studio defines attribute, but for the attributes we need */
#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C)
diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c
index b3ae54d..6537215 100644
--- a/tools/test/perform/direct_write_perf.c
+++ b/tools/test/perform/direct_write_perf.c
@@ -23,14 +23,11 @@
#if !defined(WIN32) && !defined(__MINGW32__)
-#include <math.h>
-
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
+#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
index dba8220..60ec8d8 100644
--- a/tools/test/perform/overhead.c
+++ b/tools/test/perform/overhead.c
@@ -23,17 +23,11 @@
#include "hdf5.h"
#include "H5private.h"
-#ifdef H5_STDC_HEADERS
#include <ctype.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
-#endif
-
-#ifdef H5_HAVE_IO_H
-#include <io.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
index bf4b2a9..a06fb77 100644
--- a/tools/test/perform/perf.c
+++ b/tools/test/perform/perf.c
@@ -26,13 +26,11 @@
#ifdef H5_HAVE_PARALLEL
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 65194b0..cac36d7 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -16,12 +16,10 @@
#include "hdf5.h"
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h
index 35a5217..82fabdc 100644
--- a/tools/test/perform/pio_standalone.h
+++ b/tools/test/perform/pio_standalone.h
@@ -21,10 +21,6 @@
#include "H5public.h" /* Include Public Definitions */
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -37,7 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/*
* Redefine all the POSIX functions. We should never see a POSIX
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index e5a0ec8..f67a7a6 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -16,12 +16,10 @@
#include "hdf5.h"
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h
index d8b6412..54e82fa 100644
--- a/tools/test/perform/sio_standalone.h
+++ b/tools/test/perform/sio_standalone.h
@@ -21,10 +21,6 @@
#include "H5public.h" /* Include Public Definitions */
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -37,7 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/* maximum of two, three, or four values */
#undef MAX