Skip to content

Commit

Permalink
Fixed all -Wconditional-uninitialized warnings by initializing variables
Browse files Browse the repository at this point in the history
  • Loading branch information
seanm committed Feb 19, 2021
1 parent 262cae4 commit f7aeb19
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 69 deletions.
16 changes: 8 additions & 8 deletions src/H5B2int.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t left_addr = 0, right_addr = 0; /* Addresses of left & right child nodes */
void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t * left_native, *right_native; /* Pointers to childs' native records */
Expand Down Expand Up @@ -424,7 +424,7 @@ herr_t
H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t left_addr = 0, right_addr = 0; /* Addresses of left & right child nodes */
void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t * left_native, *right_native; /* Pointers to childs' native records */
Expand Down Expand Up @@ -699,8 +699,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
*right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
haddr_t left_addr = 0, right_addr = 0; /* Addresses of left & right child nodes */
haddr_t middle_addr = 0; /* Address of middle child node */
void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
void * middle_child = NULL; /* Pointers to middle child node */
uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
Expand Down Expand Up @@ -1123,7 +1123,7 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t left_addr = 0, right_addr = 0; /* Addresses of left & right child nodes */
void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
Expand Down Expand Up @@ -1298,8 +1298,8 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
haddr_t left_addr = 0, right_addr = 0; /* Addresses of left & right child nodes */
haddr_t middle_addr = 0; /* Address of middle child node */
void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
void * middle_child = NULL; /* Pointer to middle child node */
uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */
Expand Down Expand Up @@ -1933,7 +1933,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t

/* If the node is in the cache, check for retargeting its parent */
if (node_status & H5AC_ES__IN_CACHE) {
void ** parent_ptr; /* Pointer to child node's parent */
void ** parent_ptr = NULL; /* Pointer to child node's parent */
hbool_t update_deps = FALSE; /* Whether to update flush dependencies */

/* Get child node pointer */
Expand Down
2 changes: 1 addition & 1 deletion src/H5B2leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsi
unsigned idx, void *swap_loc)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t child_addr; /* Address of child node */
haddr_t child_addr = 0; /* Address of child node */
void * child = NULL; /* Pointer to child node */
uint8_t * child_native; /* Pointer to child's native records */
herr_t ret_value = SUCCEED; /* Return value */
Expand Down
2 changes: 1 addition & 1 deletion src/H5C.c
Original file line number Diff line number Diff line change
Expand Up @@ -2229,7 +2229,7 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign
#ifdef H5_HAVE_PARALLEL
hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
#endif /* H5_HAVE_PARALLEL */
hbool_t write_permitted;
hbool_t write_permitted = FALSE;
hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */
size_t empty_space;
void * thing;
Expand Down
2 changes: 1 addition & 1 deletion src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3153,7 +3153,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
{
H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
unsigned idx; /* Index of chunk in cache, if present */
unsigned idx = 0; /* Index of chunk in cache, if present */
hbool_t found = FALSE; /* In cache? */
herr_t ret_value = SUCCEED; /* Return value */

Expand Down
2 changes: 1 addition & 1 deletion src/H5Dvirtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, cons
hssize_t select_nelmts; /* Number of elements in selection */
hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */
hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */
int rank;
int rank = 0;
hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */
size_t i, j, k; /* Local index variables */
herr_t ret_value = SUCCEED; /* Return value */
Expand Down
2 changes: 1 addition & 1 deletion src/H5EA.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
/* Local variables */
H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
H5EA__unprotect_func_t thing_unprot_func = NULL; /* Function pointer for unprotecting the array metadata */

/*
* Check arguments.
Expand Down
14 changes: 7 additions & 7 deletions src/H5FDlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#ifdef H5_HAVE_WIN32_API
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
#endif
H5_timer_t open_timer; /* Timer for open() call */
H5_timer_t stat_timer; /* Timer for stat() call */
H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */
H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */
h5_stat_t sb;
H5FD_t * ret_value = NULL; /* Return value */

Expand Down Expand Up @@ -678,7 +678,7 @@ static herr_t
H5FD__log_close(H5FD_t *_file)
{
H5FD_log_t *file = (H5FD_log_t *)_file;
H5_timer_t close_timer; /* Timer for close() call */
H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_STATIC
Expand Down Expand Up @@ -1177,7 +1177,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
H5FD_log_t * file = (H5FD_log_t *)_file;
size_t orig_size = size; /* Save the original size for later */
haddr_t orig_addr = addr;
H5_timer_t read_timer; /* Timer for read operation */
H5_timer_t read_timer = {{0}, {0}, {0}, FALSE}; /* Timer for read operation */
H5_timevals_t read_times; /* Elapsed time for read operation */
#ifndef H5_HAVE_PREADWRITE
H5_timer_t seek_timer; /* Timer for seek operation */
Expand Down Expand Up @@ -1391,7 +1391,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
H5FD_log_t * file = (H5FD_log_t *)_file;
size_t orig_size = size; /* Save the original size for later */
haddr_t orig_addr = addr;
H5_timer_t write_timer; /* Timer for write operation */
H5_timer_t write_timer = {{0}, {0}, {0}, FALSE}; /* Timer for write operation */
H5_timevals_t write_times; /* Elapsed time for write operation */
#ifndef H5_HAVE_PREADWRITE
H5_timer_t seek_timer; /* Timer for seek operation */
Expand Down Expand Up @@ -1612,8 +1612,8 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_

/* Extend the file to make sure it's large enough */
if (!H5F_addr_eq(file->eoa, file->eof)) {
H5_timer_t trunc_timer; /* Timer for truncate operation */
H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */
H5_timevals_t trunc_times; /* Elapsed time for truncate operation */

/* Start timer for truncate operation */
if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) {
Expand Down
2 changes: 1 addition & 1 deletion src/H5FDmulti.c
Original file line number Diff line number Diff line change
Expand Up @@ -1822,7 +1822,7 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw)
{
H5FD_multi_t * file = (H5FD_multi_t *)_file;
int nerrors = 0;
H5FD_mem_t out_mt;
H5FD_mem_t out_mt = H5FD_MEM_DEFAULT;
static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */

/* Clear the error stack */
Expand Down
10 changes: 5 additions & 5 deletions src/H5FSsection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,11 +1154,11 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
/* Loop until no more merging */
if (fspace->sinfo->merge_list) {
do {
H5SL_node_t * less_sect_node; /* Skip list node for section less than new section */
H5SL_node_t * greater_sect_node; /* Skip list node for section greater than new section */
H5FS_section_info_t * tmp_sect; /* Temporary free space section */
H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */
hbool_t greater_sect_node_valid = FALSE; /* Indicate if 'greater than' section node is valid */
H5SL_node_t * less_sect_node; /* Skip list node for section less than new section */
H5SL_node_t * greater_sect_node = NULL; /* Skip list node for section greater than new section */
H5FS_section_info_t * tmp_sect; /* Temporary free space section */
H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */
hbool_t greater_sect_node_valid = FALSE; /* Indicate if 'greater than' section node is valid */

/* Reset 'modification occurred' flag */
modified = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/H5HFdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
{
H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */
H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */
hbool_t did_protect; /* Whether we protected the indirect block or not */
hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
Expand Down
6 changes: 3 additions & 3 deletions src/H5HFman.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
* H5AC__NO_FLAGS_SET or
* H5AC__READ_ONLY_FLAG
*/
haddr_t dblock_addr; /* Direct block address */
haddr_t dblock_addr = 0; /* Direct block address */
size_t dblock_size; /* Direct block size */
unsigned dblock_cache_flags; /* Flags for unprotecting direct block */
unsigned dblock_cache_flags = 0; /* Flags for unprotecting direct block */
hsize_t obj_off; /* Object's offset in heap */
size_t obj_len; /* Object's length in heap */
size_t blk_off; /* Offset of object in block */
Expand Down Expand Up @@ -547,7 +547,7 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id)
{
H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */
H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */
hbool_t did_protect; /* Whether we protected the indirect block or not */
hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */
hsize_t obj_off; /* Object's offset in heap */
size_t obj_len; /* Object's length in heap */
size_t dblock_size; /* Direct block size */
Expand Down
2 changes: 1 addition & 1 deletion src/H5HFsection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_

/* Add an indirect section for each indirect block in the row */
for (v = 0; v < row_entries; v++) {
hbool_t did_protect; /* Whether we protected the indirect block or not */
hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */

/* Try to get the child section's indirect block, if it's available */
if (sect->sect_info.state == H5FS_SECT_LIVE) {
Expand Down
4 changes: 2 additions & 2 deletions src/H5HL.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add

H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
H5HL_t * heap; /* Heap data structure */
H5HL_t * heap = NULL; /* Heap data structure */

/* check arguments */
HDassert(f);
Expand Down Expand Up @@ -977,7 +977,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add

H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
H5HL_t * heap; /* Heap data structure */
H5HL_t * heap = NULL; /* Heap data structure */

/* check arguments */
HDassert(f);
Expand Down
26 changes: 13 additions & 13 deletions src/H5MF.c
Original file line number Diff line number Diff line change
Expand Up @@ -3081,19 +3081,19 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled)
herr_t
H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled)
{
H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */
H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */
H5F_mem_page_t lg_fshdr_fs_type; /* large fs hdr fsm */
H5F_mem_page_t lg_fssinfo_fs_type; /* large fs sinfo fsm */
H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */
H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */
H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */
H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */
haddr_t eoa_fsm_fsalloc; /* eoa after file space allocation */
/* for self referential FSMs */
hbool_t continue_alloc_fsm = FALSE; /* Continue allocating addr and sect_addr for FSMs */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */
H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */
H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */
H5F_mem_page_t lg_fshdr_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs hdr fsm */
H5F_mem_page_t lg_fssinfo_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs sinfo fsm */
H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */
H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */
H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */
H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */
haddr_t eoa_fsm_fsalloc; /* eoa after file space allocation */
/* for self referential FSMs */
hbool_t continue_alloc_fsm = FALSE; /* Continue allocating addr and sect_addr for FSMs */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)

Expand Down
4 changes: 2 additions & 2 deletions src/H5Oalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,8 +2005,8 @@ H5O__merge_null(H5F_t *f, H5O_t *oh)
for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) {
if (u != v && H5O_NULL_ID == curr_msg2->type->id &&
curr_msg->chunkno == curr_msg2->chunkno) {
ssize_t adj_raw; /* Amount to adjust raw message pointer */
size_t adj_raw_size; /* Amount to adjust raw message size */
ssize_t adj_raw = 0; /* Amount to adjust raw message pointer */
size_t adj_raw_size = 0; /* Amount to adjust raw message size */

/* Check for second message after first message */
if ((curr_msg->raw + curr_msg->raw_size) ==
Expand Down
4 changes: 2 additions & 2 deletions src/H5PB.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
haddr_t offset;
haddr_t search_addr; /* Address of current page */
hsize_t num_touched_pages; /* Number of pages accessed */
size_t access_size;
size_t access_size = 0;
hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */
hsize_t i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
Expand Down Expand Up @@ -983,7 +983,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
haddr_t offset;
haddr_t search_addr; /* Address of current page */
hsize_t num_touched_pages; /* Number of pages accessed */
size_t access_size;
size_t access_size = 0;
hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */
hsize_t i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
Expand Down
Loading

0 comments on commit f7aeb19

Please sign in to comment.