summaryrefslogtreecommitdiffstats
path: root/test/h5test.h
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-01 20:54:41 (GMT)
committerGitHub <noreply@github.com>2022-05-01 20:54:41 (GMT)
commit2ba7a01bfff451b043e2ec00811c0aad78921545 (patch)
tree31dc785e35a95578ea9fbb491fbc931e62234302 /test/h5test.h
parent5eba258d90aa89c3d1d58f1b5ef93c1cf9821c29 (diff)
downloadhdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.zip
hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.gz
hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.bz2
Fix some const cast and stack/static object size warnings (#1700)
* Fix various warnings * Move HDfree_const to H5private.h for wider use * Print output from all ranks in parallel tests on allocation failure * Move const pointer freeing macro to h5test.h for now
Diffstat (limited to 'test/h5test.h')
-rw-r--r--test/h5test.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/h5test.h b/test/h5test.h
index 7b82b68..5c3e9a3 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -193,6 +193,15 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
extern "C" {
#endif
+/*
+ * Ugly hack to cast away const for freeing const-qualified pointers.
+ * Should only be used sparingly, where the alternative (like keeping
+ * an equivalent non-const pointer around) is far messier.
+ */
+#ifndef h5_free_const
+#define h5_free_const(mem) HDfree((void *)(uintptr_t)mem)
+#endif
+
/* Generally useful testing routines */
H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl);
H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);