summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-03-20 15:03:46 (GMT)
committerGitHub <noreply@github.com>2023-03-20 15:03:46 (GMT)
commitbdde027f6dc298cfd95053c562544a62dcfbd787 (patch)
tree84ca881c7184c5a419d06e483ad0f76bebcf1bec
parentae5702bf6c6bf8b7979561dc5112284dbb5b7cf8 (diff)
downloadhdf5-bdde027f6dc298cfd95053c562544a62dcfbd787.zip
hdf5-bdde027f6dc298cfd95053c562544a62dcfbd787.tar.gz
hdf5-bdde027f6dc298cfd95053c562544a62dcfbd787.tar.bz2
Bring warning fixes from develop (#2608)
-rw-r--r--src/H5FDdirect.c22
-rw-r--r--src/H5Gname.c5
-rw-r--r--src/H5Gnode.c2
-rw-r--r--src/H5Gobj.c10
-rw-r--r--src/H5Gtraverse.c5
-rw-r--r--src/H5HF.c19
-rw-r--r--src/H5HFcache.c21
-rw-r--r--src/H5HFman.c10
-rw-r--r--src/H5Idbg.c4
-rw-r--r--src/H5L.c10
-rw-r--r--src/H5Ocache.c18
-rw-r--r--src/H5make_libsettings.c65
-rw-r--r--test/objcopy.c2
-rw-r--r--test/use_append_chunk_mirror.c63
-rw-r--r--tools/test/h5dump/h5dumpgentest.c13
15 files changed, 170 insertions, 99 deletions
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 81bf4af..b74ad07 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -382,15 +382,14 @@ done:
static void *
H5FD_direct_fapl_get(H5FD_t *_file)
{
- H5FD_direct_t *file = (H5FD_direct_t *)_file;
- void *ret_value; /* Return value */
+ H5FD_direct_t *file = (H5FD_direct_t *)_file;
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Set return value */
ret_value = H5FD_direct_fapl_copy(&(file->fa));
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_direct_fapl_get() */
@@ -443,10 +442,10 @@ H5FD_direct_fapl_copy(const void *_old_fa)
static H5FD_t *
H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- int o_flags;
- int fd = (-1);
- H5FD_direct_t *file = NULL;
- H5FD_direct_fapl_t *fa;
+ int o_flags;
+ int fd = (-1);
+ H5FD_direct_t *file = NULL;
+ const H5FD_direct_fapl_t *fa;
#ifdef H5_HAVE_WIN32_API
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
@@ -495,7 +494,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
/* Get the driver specific information */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL == (fa = (H5FD_direct_fapl_t *)H5P_peek_driver_info(plist)))
+ if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
file->fd = fd;
@@ -545,7 +544,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
}
else {
file->fa.must_align = FALSE;
- HDftruncate(file->fd, (HDoff_t)0);
+ if (-1 == HDftruncate(file->fd, (HDoff_t)0))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to truncate file")
}
}
else {
@@ -792,7 +792,7 @@ H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_direct_t *file = (const H5FD_direct_t *)_file;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(file->eof)
}
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 18e46ce..2c53507 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -512,9 +512,10 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
dst->user_path_r = H5RS_dup(src->user_path_r);
}
else {
- /* Discarding 'const' qualifier OK - QAK */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
H5G_name_reset((H5G_name_t *)src);
- } /* end if */
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_name_copy() */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 9445b6e..20e496d 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -1224,7 +1224,9 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
grp_loc.path = &grp_path;
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
grp_loc.oloc = (H5O_loc_t *)src_oloc;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Get pointer to link value in local heap */
if ((link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset)) == NULL)
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 5ba14ad..7570a4f 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -242,21 +242,20 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf
/* Check for format of group to create */
if (use_at_least_v18) {
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
/* Insert link info message */
- /* (Casting away const OK - QAK) */
if (H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
/* Insert group info message */
- /* (Casting away const OK - QAK) */
if (H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
/* Insert pipeline message */
if (pline && pline->nused)
- /* (Casting away const OK - QAK) */
if (H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)pline) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
else {
H5O_stab_t stab; /* Symbol table message */
@@ -398,9 +397,10 @@ H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata)
HDassert(udata);
/* Insert link into group */
- /* (Casting away const OK - QAK) */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, H5O_TYPE_UNKNOWN, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -712,7 +712,7 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info)
H5G_loc_reset(&grp_loc);
/* Deep copy (duplicate) of the group location object */
- if (H5O_loc_copy_deep(&grp_oloc, (H5O_loc_t *)oloc) < 0)
+ if (H5O_loc_copy_deep(&grp_oloc, oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location")
/* Open the group */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index d2d3a06..85b1dbc 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -706,18 +706,17 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open")
/* Reset any non-default object header messages */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (ginfo != &def_ginfo)
- /* (Casting away const OK - QAK) */
if (H5O_msg_reset(H5O_GINFO_ID, (void *)ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message")
if (linfo != &def_linfo)
- /* (Casting away const OK - QAK) */
if (H5O_msg_reset(H5O_LINFO_ID, (void *)linfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message")
if (pline != &def_pline)
- /* (Casting away const OK - QAK) */
if (H5O_msg_reset(H5O_PLINE_ID, (void *)pline) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
else
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found")
diff --git a/src/H5HF.c b/src/H5HF.c
index 8c14303..8b11242 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -116,8 +116,14 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- /* Perform "write", using memcpy() */
- H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
+ /* Perform "write", using memcpy()
+ *
+ * We cast away const here because no obj pointer that was originally
+ * const should ever arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ H5MM_memcpy((void *)obj, op_data, obj_len);
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_op_write() */
@@ -349,10 +355,15 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/)
/* Check for 'huge' object */
if (size > hdr->max_man_size) {
- /* Store 'huge' object in heap */
- /* (Casting away const OK - QAK) */
+ /* Store 'huge' object in heap
+ *
+ * Although not ideal, we can quiet the const warning here because no
+ * obj pointer that was originally const should ever arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__huge_insert(hdr, size, (void *)obj, id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'huge' object in fractal heap")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
/* Check for 'tiny' object */
else if (size <= hdr->tiny_max_len) {
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 5839b56..7e4d5de 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -741,7 +741,11 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN
HDassert(len == hdr->heap_size);
/* Set the shared heap header's file context for this operation */
+ H5_GCC_DIAG_OFF("discarded-qualifiers")
+ H5_CLANG_DIAG_OFF("incompatible-pointer-types-discards-qualifiers")
hdr->f = f;
+ H5_GCC_DIAG_ON("discarded-qualifiers")
+ H5_CLANG_DIAG_ON("incompatible-pointer-types-discards-qualifiers")
/* Magic number */
H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -1327,7 +1331,11 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG
hdr = iblock->hdr;
/* Set the shared heap header's file context for this operation */
+ H5_GCC_DIAG_OFF("discarded-qualifiers")
+ H5_CLANG_DIAG_OFF("incompatible-pointer-types-discards-qualifiers")
hdr->f = f;
+ H5_GCC_DIAG_ON("discarded-qualifiers")
+ H5_CLANG_DIAG_ON("incompatible-pointer-types-discards-qualifiers")
/* Magic number */
H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -1654,9 +1662,15 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
/* Update info about direct block */
udata->decompressed = TRUE;
len = nbytes;
- } /* end if */
- else
- read_buf = (void *)image; /* Casting away const OK - QAK */
+ }
+ else {
+ /* If the data are unfiltered, we just point to the image, which we
+ * never modify. Casting away const is okay here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ read_buf = (void *)image;
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ }
/* Decode checksum */
chk_size = (size_t)(H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) - H5HF_SIZEOF_CHKSUM);
@@ -1668,7 +1682,6 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
chk_p -= H5HF_SIZEOF_CHKSUM;
/* Reset checksum field, for computing the checksum */
- /* (Casting away const OK - QAK) */
HDmemset(chk_p, 0, (size_t)H5HF_SIZEOF_CHKSUM);
/* Compute checksum on entire direct block */
diff --git a/src/H5HFman.c b/src/H5HFman.c
index af155cc..721d810 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -486,10 +486,16 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj)
HDassert(id);
HDassert(obj);
- /* Call the internal 'op' routine routine */
- /* (Casting away const OK - QAK) */
+ /* Call the internal 'op' routine routine
+ *
+ * In this case, the callback operation needs to modify the obj buffer that
+ * was passed in as const. We quiet the warning here because an obj pointer
+ * that was originally const should *never* arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__man_op_real(hdr, id, H5HF_op_write, (void *)obj, H5HF_OP_MODIFY) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Idbg.c b/src/H5Idbg.c
index 0f246dc..9ca717f 100644
--- a/src/H5Idbg.c
+++ b/src/H5Idbg.c
@@ -93,11 +93,15 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
break;
}
case H5I_DATASET: {
+ H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
path = H5D_nameof(info->object);
+ H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
break;
}
case H5I_DATATYPE: {
+ H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
path = H5T_nameof(info->object);
+ H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
break;
}
case H5I_UNINIT:
diff --git a/src/H5L.c b/src/H5L.c
index 0a859f8..d670365 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1620,8 +1620,9 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT
udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
/* Set the link's name correctly */
- /* Casting away const OK -QAK */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
udata->lnk->name = (char *)name;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Insert link into group */
if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE,
@@ -2399,9 +2400,10 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
/* Give the object its new name */
- /* Casting away const okay -JML */
HDassert(udata->lnk->name == NULL);
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
udata->lnk->name = (char *)name;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Insert the link into the group */
if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0)
@@ -3143,7 +3145,9 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t
/* Set up group location for link */
H5G_name_reset(&lnk_grp_path);
lnk_grp_loc.path = &lnk_grp_path;
- lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Check if the target object exists */
if ((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name)) < 0)
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index fd6552b..b32b82f 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1429,11 +1429,13 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t
oh->nmesgs++;
/* Initialize information about message */
- mesg->dirty = FALSE;
- mesg->flags = flags;
- mesg->crt_idx = crt_idx;
- mesg->native = NULL;
- mesg->raw = (uint8_t *)chunk_image; /* Casting away const OK - QAK */
+ mesg->dirty = FALSE;
+ mesg->flags = flags;
+ mesg->crt_idx = crt_idx;
+ mesg->native = NULL;
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ mesg->raw = (uint8_t *)chunk_image;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
mesg->raw_size = mesg_size;
mesg->chunkno = chunkno;
@@ -1636,10 +1638,12 @@ H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno)
/* Encode any dirty messages in this chunk */
for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++)
- if (curr_msg->dirty && curr_msg->chunkno == chunkno)
- /* Casting away const OK -QAK */
+ if (curr_msg->dirty && curr_msg->chunkno == chunkno) {
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5O_msg_flush((H5F_t *)f, oh, curr_msg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
+ }
/* Sanity checks */
if (oh->version > H5O_VERSION_1)
diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c
index 34acd80..a428062 100644
--- a/src/H5make_libsettings.c
+++ b/src/H5make_libsettings.c
@@ -64,19 +64,27 @@ insert_libhdf5_settings(FILE *flibinfo)
HDexit(EXIT_FAILURE);
}
- /* print variable definition and the string */
- /* Do not use const else AIX strings does not show it. */
- fprintf(flibinfo, "char H5libhdf5_settings[]=\n");
+ /* Turn off warnings for large arrays. If the library info string is
+ * a problem, people can build without the embedded library info.
+ */
+ HDfprintf(flibinfo, "#include \"H5private.h\"\n");
+ HDfprintf(flibinfo, "H5_GCC_DIAG_OFF(\"larger-than=\")\n\n");
+ HDfprintf(flibinfo, "H5_CLANG_DIAG_OFF(\"overlength-strings\")\n\n");
+
+ /* Print variable definition and the string. Do not use const or some
+ * platforms (AIX?) will have issues.
+ */
+ HDfprintf(flibinfo, "char H5libhdf5_settings[]=\n");
bol++;
while (EOF != (inchar = HDgetc(fsettings))) {
if (bol) {
/* Start a new line */
- fprintf(flibinfo, "\t\"");
+ HDfprintf(flibinfo, "\t\"");
bol = 0;
}
if (inchar == '\n') {
/* end of a line */
- fprintf(flibinfo, "\\n\"\n");
+ HDfprintf(flibinfo, "\\n\"\n");
bol++;
}
else
@@ -87,21 +95,26 @@ insert_libhdf5_settings(FILE *flibinfo)
/* wrap up */
if (!bol)
/* EOF found without a new line */
- fprintf(flibinfo, "\\n\"\n");
- fprintf(flibinfo, ";\n\n");
+ HDfprintf(flibinfo, "\\n\"\n");
+ HDfprintf(flibinfo, ";\n\n");
}
else {
- fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME);
+ HDfprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME);
HDexit(EXIT_FAILURE);
}
if (0 != HDfclose(fsettings)) {
HDperror(LIBSETTINGSFNAME);
HDexit(EXIT_FAILURE);
}
+
+ /* Re-enable warnings for large arrays */
+ HDfprintf(rawoutstream, "H5_GCC_DIAG_ON(\"larger-than=\")\n");
+ HDfprintf(rawoutstream, "H5_CLANG_DIAG_OFF(\"overlength-strings\")\n");
#else
- /* Print variable definition and an empty string */
- /* Do not use const else AIX strings does not show it. */
- fprintf(flibinfo, "char H5libhdf5_settings[]=\"\";\n");
+ /* Print variable definition and an empty string. Do not use const or some
+ * platforms (AIX?) will have issues.
+ */
+ HDfprintf(flibinfo, "char H5libhdf5_settings[]=\"\";\n");
#endif
} /* insert_libhdf5_settings() */
@@ -189,42 +202,42 @@ information about the library build configuration\n";
/*
* The file header: warning, copyright notice, build information.
*/
- fprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n");
+ HDfprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n");
HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */
- fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday,
- 1900 + tm->tm_year);
+ HDfprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday,
+ 1900 + tm->tm_year);
if (pwd || real_name[0] || host_name[0]) {
- fprintf(rawoutstream, " *\t\t\t");
+ HDfprintf(rawoutstream, " *\t\t\t");
if (real_name[0])
- fprintf(rawoutstream, "%s <", real_name);
+ HDfprintf(rawoutstream, "%s <", real_name);
#ifdef H5_HAVE_GETPWUID
if (pwd)
HDfputs(pwd->pw_name, rawoutstream);
#endif
if (host_name[0])
- fprintf(rawoutstream, "@%s", host_name);
+ HDfprintf(rawoutstream, "@%s", host_name);
if (real_name[0])
- fprintf(rawoutstream, ">");
+ HDfprintf(rawoutstream, ">");
HDfputc('\n', rawoutstream);
}
- fprintf(rawoutstream, " *\n * Purpose:\t\t");
+ HDfprintf(rawoutstream, " *\n * Purpose:\t\t");
for (s = purpose; *s; s++) {
HDfputc(*s, rawoutstream);
if ('\n' == *s && s[1])
- fprintf(rawoutstream, " *\t\t\t");
+ HDfprintf(rawoutstream, " *\t\t\t");
}
- fprintf(rawoutstream, " *\n * Modifications:\n *\n");
- fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
- fprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n");
+ HDfprintf(rawoutstream, " *\n * Modifications:\n *\n");
+ HDfprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
+ HDfprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n");
- fprintf(rawoutstream, " *\n *");
+ HDfprintf(rawoutstream, " *\n *");
for (i = 0; i < 73; i++)
HDfputc('-', rawoutstream);
- fprintf(rawoutstream, "\n */\n\n");
+ HDfprintf(rawoutstream, "\n */\n\n");
}
/*-------------------------------------------------------------------------
@@ -278,7 +291,7 @@ main(int argc, char *argv[])
if (rawoutstream && rawoutstream != stdout) {
if (HDfclose(rawoutstream))
- fprintf(stderr, "closing rawoutstream");
+ HDfprintf(stderr, "closing rawoutstream");
else
rawoutstream = NULL;
}
diff --git a/test/objcopy.c b/test/objcopy.c
index 79f0d92..3550edb 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -1221,8 +1221,10 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
const hdset_reg_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
/* Loop over elements in buffers */
+ H5_GCC_DIAG_OFF("cast-qual")
ref_buf1 = (const hdset_reg_ref_t *)buf1;
ref_buf2 = (const hdset_reg_ref_t *)buf2;
+ H5_GCC_DIAG_ON("cast-qual")
for (u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
hid_t obj1_id, obj2_id; /* IDs for objects referenced */
hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
diff --git a/test/use_append_chunk_mirror.c b/test/use_append_chunk_mirror.c
index b19c510..788cf83 100644
--- a/test/use_append_chunk_mirror.c
+++ b/test/use_append_chunk_mirror.c
@@ -139,7 +139,7 @@ setup_parameters(int argc, char *const argv[], options_t *opts)
opts->nplanes = (hsize_t)opts->chunksize;
show_parameters(opts);
- return (0);
+ return 0;
} /* setup_parameters() */
/* Overall Algorithm:
@@ -152,17 +152,17 @@ setup_parameters(int argc, char *const argv[], options_t *opts)
int
main(int argc, char *argv[])
{
- pid_t childpid = 0;
- pid_t mypid, tmppid;
- int child_status;
- int child_wait_option = 0;
- int ret_value = 0;
- int child_ret_value;
- hbool_t send_wait = FALSE;
- hid_t fid = -1; /* File ID */
- H5FD_mirror_fapl_t mirr_fa;
- H5FD_splitter_vfd_config_t split_fa;
- hid_t mirr_fapl_id = H5I_INVALID_HID;
+ pid_t childpid = 0;
+ pid_t mypid, tmppid;
+ int child_status;
+ int child_wait_option = 0;
+ int ret_value = 0;
+ int child_ret_value;
+ hbool_t send_wait = FALSE;
+ hid_t fid = H5I_INVALID_HID;
+ H5FD_mirror_fapl_t mirr_fa;
+ H5FD_splitter_vfd_config_t *split_fa = NULL;
+ hid_t mirr_fapl_id = H5I_INVALID_HID;
if (setup_parameters(argc, argv, &UC_opts) < 0) {
Hgoto_error(1);
@@ -173,13 +173,18 @@ main(int argc, char *argv[])
mirr_fa.handshake_port = SERVER_PORT;
HDstrncpy(mirr_fa.remote_ip, SERVER_IP, H5FD_MIRROR_MAX_IP_LEN);
- split_fa.wo_fapl_id = H5I_INVALID_HID;
- split_fa.rw_fapl_id = H5I_INVALID_HID;
- split_fa.magic = H5FD_SPLITTER_MAGIC;
- split_fa.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- split_fa.log_file_path[0] = '\0'; /* none */
- split_fa.ignore_wo_errs = FALSE;
- HDstrncpy(split_fa.wo_path, MIRROR_FILE_NAME, H5FD_SPLITTER_PATH_MAX);
+ if (NULL == (split_fa = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) {
+ HDfprintf(stderr, "can't allocate memory for splitter config\n");
+ Hgoto_error(1);
+ }
+
+ split_fa->wo_fapl_id = H5I_INVALID_HID;
+ split_fa->rw_fapl_id = H5I_INVALID_HID;
+ split_fa->magic = H5FD_SPLITTER_MAGIC;
+ split_fa->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ split_fa->log_file_path[0] = '\0'; /* none */
+ split_fa->ignore_wo_errs = FALSE;
+ HDstrncpy(split_fa->wo_path, MIRROR_FILE_NAME, H5FD_SPLITTER_PATH_MAX);
/* Determine the need to send/wait message file*/
if (UC_opts.launch == UC_READWRITE) {
@@ -211,14 +216,14 @@ main(int argc, char *argv[])
}
/* Prepare parent "splitter" driver in UC_opts */
- split_fa.wo_fapl_id = mirr_fapl_id;
- split_fa.rw_fapl_id = H5P_DEFAULT;
- UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ split_fa->wo_fapl_id = mirr_fapl_id;
+ split_fa->rw_fapl_id = H5P_DEFAULT;
+ UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if (UC_opts.fapl_id == H5I_INVALID_HID) {
HDfprintf(stderr, "can't create creation FAPL\n");
Hgoto_error(1);
}
- if (H5Pset_fapl_splitter(UC_opts.fapl_id, &split_fa) < 0) {
+ if (H5Pset_fapl_splitter(UC_opts.fapl_id, split_fa) < 0) {
HDfprintf(stderr, "can't set creation FAPL\n");
H5Eprint2(H5E_DEFAULT, stdout);
Hgoto_error(1);
@@ -300,14 +305,14 @@ main(int argc, char *argv[])
}
/* Prepare parent "splitter" driver in UC_opts */
- split_fa.wo_fapl_id = mirr_fapl_id;
- split_fa.rw_fapl_id = H5P_DEFAULT;
- UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ split_fa->wo_fapl_id = mirr_fapl_id;
+ split_fa->rw_fapl_id = H5P_DEFAULT;
+ UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if (UC_opts.fapl_id == H5I_INVALID_HID) {
HDfprintf(stderr, "can't create creation FAPL\n");
Hgoto_error(1);
}
- if (H5Pset_fapl_splitter(UC_opts.fapl_id, &split_fa) < 0) {
+ if (H5Pset_fapl_splitter(UC_opts.fapl_id, split_fa) < 0) {
HDfprintf(stderr, "can't set creation FAPL\n");
H5Eprint2(H5E_DEFAULT, stdout);
Hgoto_error(1);
@@ -368,6 +373,8 @@ main(int argc, char *argv[])
}
done:
+ HDfree(split_fa);
+
if (ret_value != 0) {
HDprintf("Error(s) encountered\n");
}
@@ -375,7 +382,7 @@ done:
HDprintf("All passed\n");
}
- return (ret_value);
+ return ret_value;
}
#else /* H5_HAVE_MIRROR_VFD */
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 406ff6a..28caedb 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -10496,13 +10496,17 @@ gent_bitnopaquefields(void)
static void
gent_intsfourdims(void)
{
- hid_t fid, dataset, space;
- hsize_t dims[F81_RANK];
- uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
+ hid_t fid, dataset, space;
+ hsize_t dims[F81_RANK];
+ struct {
+ uint32_t arr[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
+ } * dset1;
unsigned int i, j, k, l;
fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ dset1 = malloc(sizeof(*dset1));
+
/* Dataset of 32 bits unsigned int */
dims[0] = F81_ZDIM;
dims[1] = F81_YDIM;
@@ -10515,7 +10519,7 @@ gent_intsfourdims(void)
for (j = 0; j < F81_YDIM; j++)
for (k = 0; k < F81_XDIM; k++)
for (l = 0; l < F81_WDIM; l++)
- dset1[i][j][k][l] =
+ dset1->arr[i][j][k][l] =
i * F81_YDIM * F81_XDIM * F81_WDIM + j * F81_XDIM * F81_WDIM + k * F81_WDIM + l;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
@@ -10523,6 +10527,7 @@ gent_intsfourdims(void)
H5Dclose(dataset);
H5Fclose(fid);
+ free(dset1);
}
/*-------------------------------------------------------------------------