diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index 592a69693e9..5f84afc791b 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -29,7 +29,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT; #define H5PT_HASH_TABLE_SIZE 64 /* Packet Table private functions */ -static herr_t H5PT_free_id(void *id, void **_ctx); +static herr_t H5PT_free_id(void *id); static herr_t H5PT_close(htbl_t *table); static herr_t H5PT_create_index(htbl_t *table_id); static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index); @@ -87,8 +87,7 @@ H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_si /* Register the packet table ID type if this is the first table created */ if (H5PT_ptable_id_type < 0) - if ((H5PT_ptable_id_type = - H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + if ((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, H5PT_free_id)) < 0) goto error; /* Get memory for the table identifier */ @@ -208,8 +207,7 @@ H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk /* Register the packet table ID type if this is the first table created */ if (H5PT_ptable_id_type < 0) - if ((H5PT_ptable_id_type = - H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + if ((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, H5PT_free_id)) < 0) goto error; /* Get memory for the table identifier */ @@ -323,8 +321,7 @@ H5PTopen(hid_t loc_id, const char *dset_name) /* Register the packet table ID type if this is the first table created */ if (H5PT_ptable_id_type < 0) - if ((H5PT_ptable_id_type = - H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + if ((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, H5PT_free_id)) < 0) goto error; table = (htbl_t *)HDmalloc(sizeof(htbl_t)); @@ -402,7 +399,7 @@ H5PTopen(hid_t loc_id, const char *dset_name) *------------------------------------------------------------------------- */ static herr_t -H5PT_free_id(void *id, void H5_ATTR_UNUSED **_ctx) +H5PT_free_id(void *id) { HDfree(id); return SUCCEED; diff --git a/src/H5B2int.c b/src/H5B2int.c index 610da6c5f05..ab43a5a43f9 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -52,9 +52,9 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, - const H5B2_node_ptr_t *node_ptrs, unsigned start_idx, - unsigned end_idx, void *old_parent, void *new_parent); +static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptrs, + unsigned start_idx, unsigned end_idx, void *old_parent, + void *new_parent); /*********************/ /* Package Variables */ @@ -1617,7 +1617,7 @@ H5B2__insert(H5B2_hdr_t *hdr, void *udata) *------------------------------------------------------------------------- */ herr_t -H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent, +H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, H5B2_operator_t op, void *op_data) { const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */ @@ -1642,8 +1642,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_ /* Lock the current B-tree node */ if (NULL == - (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE, - H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */ + (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Set up information about current node */ @@ -1739,8 +1738,8 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_ *------------------------------------------------------------------------- */ herr_t -H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent, - H5B2_remove_t op, void *op_data) +H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, H5B2_remove_t op, + void *op_data) { const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */ void * node = NULL; /* Pointers to current node */ @@ -1759,8 +1758,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_n /* Lock the current B-tree node */ if (NULL == - (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE, - H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */ + (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Set up information about current node */ @@ -1824,7 +1822,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_n *------------------------------------------------------------------------- */ herr_t -H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent, +H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, hsize_t *btree_size) { H5B2_internal_t *internal = NULL; /* Pointer to internal node */ @@ -1839,8 +1837,8 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_nod HDassert(depth > 0); /* Lock the current B-tree node */ - if (NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE, - H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */ + if (NULL == + (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */ @@ -1910,7 +1908,7 @@ H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) *------------------------------------------------------------------------- */ herr_t -H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr, void *old_parent, +H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptr, void *old_parent, void *new_parent) { const H5AC_class_t *child_class; /* Pointer to child node's class info */ @@ -1941,9 +1939,8 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t H5B2_internal_t *child_int; /* Protect child */ - if (NULL == (child_int = H5B2__protect_internal( - hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, (uint16_t)(depth - 1), FALSE, - H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */ + if (NULL == (child_int = H5B2__protect_internal(hdr, new_parent, node_ptr, (uint16_t)(depth - 1), + FALSE, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") child_class = H5AC_BT2_INT; child = child_int; @@ -2010,7 +2007,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *------------------------------------------------------------------------- */ static herr_t -H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptrs, +H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptrs, unsigned start_idx, unsigned end_idx, void *old_parent, void *new_parent) { unsigned u; /* Local index variable */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 8d620cc890d..66d04fa8c53 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -321,7 +321,7 @@ extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID]; /* Generic routines */ H5_DLL herr_t H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); -H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr, +H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptr, void *old_parent, void *new_parent); H5_DLL herr_t H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); @@ -390,9 +390,9 @@ H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *op_data); /* Routines for iterating over nodes/records */ -H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, - void *parent, H5B2_operator_t op, void *op_data); -H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent, +H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, + H5B2_operator_t op, void *op_data); +H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, hsize_t *op_data); /* Routines for locating records */ @@ -423,8 +423,8 @@ H5_DLL herr_t H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_no void *op_data); /* Routines for deleting nodes */ -H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, - void *parent, H5B2_remove_t op, void *op_data); +H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, + H5B2_remove_t op, void *op_data); /* Debugging routines for dumping file structures */ H5_DLL herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 77197efeea8..e6a53f49fed 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -5180,14 +5180,11 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ static int H5D__chunk_cmp_coll_fill_info(const void *_entry1, const void *_entry2) { - const struct chunk_coll_fill_info *entry1; - const struct chunk_coll_fill_info *entry2; + const struct chunk_coll_fill_info *entry1 = (const struct chunk_coll_fill_info *)_entry1; + const struct chunk_coll_fill_info *entry2 = (const struct chunk_coll_fill_info *)_entry2; FUNC_ENTER_STATIC_NOERR - entry1 = (const struct chunk_coll_fill_info *)_entry1; - entry2 = (const struct chunk_coll_fill_info *)_entry2; - FUNC_LEAVE_NOAPI(H5F_addr_cmp(entry1->addr, entry2->addr)) } /* end H5D__chunk_cmp_coll_fill_info() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index c2f5dc40098..705fa4d1e58 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -1731,7 +1731,7 @@ H5FD_hdfs_init(void) } herr_t -H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) +H5Pget_fapl_hdfs(hid_t H5_ATTR_UNUSED fapl_id, H5FD_hdfs_fapl_t H5_ATTR_UNUSED *fa_out) { herr_t ret_value = FAIL; @@ -1745,7 +1745,7 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) } herr_t -H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) +H5Pset_fapl_hdfs(hid_t H5_ATTR_UNUSED fapl_id, H5FD_hdfs_fapl_t H5_ATTR_UNUSED *fa) { herr_t ret_value = FAIL; diff --git a/src/H5Gname.c b/src/H5Gname.c index dab86b363b4..b5d0dafe097 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -308,7 +308,7 @@ H5G_build_fullpath(const char *prefix, const char *name) /* Build full path */ HDstrncpy(full_path, prefix, orig_path_len + 1); if (need_sep) - HDstrncat(full_path, "/", (size_t)1); + HDstrcat(full_path, "/"); HDstrncat(full_path, name, name_len); /* Create reference counted string for path */ diff --git a/src/H5RS.c b/src/H5RS.c index 77fa414b613..5d74dd435ed 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -143,8 +143,16 @@ H5RS_wrap(const char *s) if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t))) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") - /* Set the internal fields */ - ret_value->s = (char *)s; + /* Set the internal fields + * + * We ignore warnings about storing a const char pointer in the struct + * since we never modify or free the string when the wrapped struct + * field is set to TRUE. + */ + H5_GCC_DIAG_OFF("cast-qual") + ret_value->s = (char *)s; + H5_GCC_DIAG_ON("cast-qual") + ret_value->wrapped = 1; ret_value->n = 1; diff --git a/src/H5trace.c b/src/H5trace.c index 1565a864be9..6eff40cad56 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -117,8 +117,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) void * vp = NULL; FILE * out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer = {{0}, {0}, {0}, FALSE}; - H5_timevals_t function_times; + H5_timer_t function_timer; + H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times; static int current_depth = 0; @@ -130,6 +130,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) return 0.0F; /*tracing is off*/ HDva_start(ap, type); + /* Initialize the timer for this function */ + if (H5_debug_g.ttimes) + H5_timer_init(&function_timer); + if (H5_debug_g.ttop) { if (returning) { if (current_depth > 1) { @@ -153,11 +157,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5_timer_init(&running_timer); H5_timer_start(&running_timer); } /* end if */ - if (H5_debug_g.ttimes) { - /* start the timer for this function */ - H5_timer_init(&function_timer); + + /* Start the timer for this function */ + if (H5_debug_g.ttimes) H5_timer_start(&function_timer); - } /* end if */ /* Print the first part of the line. This is the indication of the * nesting depth followed by the function name and either start of diff --git a/test/chunk_info.c b/test/chunk_info.c index 9cf898e4254..5d4fd566f1f 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -167,7 +167,9 @@ test_get_chunk_info_highest18(hid_t fapl) unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ int fillvalue = -1; /* Fill value */ - int aggression = 9; /* Compression aggression setting */ +#ifdef H5_HAVE_FILTER_DEFLATE + int aggression = 9; /* Compression aggression setting */ +#endif H5F_libver_t low, high; /* File format bounds */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ diff --git a/test/trefstr.c b/test/trefstr.c index ea30f24a256..0dcf6211ba2 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -186,7 +186,7 @@ test_refstr_cmp(void) H5RS_str_t *rs1; /* Ref-counted string created */ H5RS_str_t *rs2; /* Ref-counted string created */ int cmp; /* Comparison value */ - size_t len; /* Length of string */ + ssize_t len; /* Length of string */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index 32d0265ea9a..e6fc9aae159 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -42,6 +42,8 @@ #include "H5Spkg.h" /* Dataspaces */ #include "testphdf5.h" +#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 + static void coll_write_test(int chunk_factor); static void coll_read_test(int chunk_factor); @@ -1430,8 +1432,7 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr, *------------------------------------------------------------------------- */ -#define LDSCT_DS_RANK 5 -#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 +#define LDSCT_DS_RANK 5 static void lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_collective_io, diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index c465b7ae3ca..c10381d578e 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -1391,6 +1391,9 @@ character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, hbool_t both_zero = FALSE; double per; + /* both_zero is set in the PER_UNSIGN macro but not used in this function */ + (void)both_zero; + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar);