summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2023-06-19 05:13:38 (GMT)
committerGitHub <noreply@github.com>2023-06-19 05:13:38 (GMT)
commit65d8c9347010771473b53c91adcec2f281772213 (patch)
tree487567dae0dc005de896f616b90e67744239a5e2 /src
parent1f20354ee6cdfa9fd157ac9cdfff9acdf320a32d (diff)
downloadhdf5-65d8c9347010771473b53c91adcec2f281772213.zip
hdf5-65d8c9347010771473b53c91adcec2f281772213.tar.gz
hdf5-65d8c9347010771473b53c91adcec2f281772213.tar.bz2
Many fixes to various compiler warnings (#3124)
* Fixed various -Wmissing-variable-declarations by adding static keyword * In a few cases, renamed the variable suffix from _g to _s. * Fixed some -Wmissing-variable-declarations by using different declaration macros * Fixed various -Wconditional-uninitialized warnings by just initializing variable to zero * Fixed various -Wcomma warnings * Fixed clang -Wstrict-prototypes warnings * Fixed various -Wunused-variable warnings * Updated some casts to fix the only 3 -Wcast-qual warnings * Fixed the only -Wsometimes-uninitialized warning
Diffstat (limited to 'src')
-rw-r--r--src/H5.c4
-rw-r--r--src/H5Dbtree.c2
-rw-r--r--src/H5Dchunk.c8
-rw-r--r--src/H5EA.c2
-rw-r--r--src/H5FDint.c20
-rw-r--r--src/H5FL.c2
-rw-r--r--src/H5Fsfile.c16
-rw-r--r--src/H5HFiter.c2
-rw-r--r--src/H5HFsection.c2
-rw-r--r--src/H5Iint.c10
-rw-r--r--src/H5MFsection.c2
-rw-r--r--src/H5Ocache_image.c2
-rw-r--r--src/H5Pdxpl.c4
-rw-r--r--src/H5VLpassthru.c2
14 files changed, 39 insertions, 39 deletions
diff --git a/src/H5.c b/src/H5.c
index daaaf66..12c162a 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -70,8 +70,8 @@ static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *fla
/*****************************/
/* Library incompatible release versions, develop releases are incompatible by design */
-const unsigned VERS_RELEASE_EXCEPTIONS[] = {0};
-const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 1;
+static const unsigned VERS_RELEASE_EXCEPTIONS[] = {0};
+static const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 1;
/* statically initialize block for pthread_once call used in initializing */
/* the first global mutex */
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 7da6b90..a1eb7ca 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -157,7 +157,7 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{
/*****************************/
/* inherits B-tree like properties from H5B */
-H5B_class_t H5B_BTREE[1] = {{
+static H5B_class_t H5B_BTREE[1] = {{
H5B_CHUNK_ID, /*id */
sizeof(H5D_btree_key_t), /*sizeof_nkey */
H5D__btree_get_shared, /*get_shared */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 840b1ce..a26eb04 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -346,7 +346,7 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{
/*******************/
/* "nonexistent" storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {
+static const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5D__nonexistent_readvv, NULL, NULL, NULL, NULL}};
/* Declare a free list to manage the H5F_rdcc_ent_ptr_t sequence information */
@@ -356,7 +356,7 @@ H5FL_SEQ_DEFINE_STATIC(H5D_rdcc_ent_ptr_t);
H5FL_DEFINE_STATIC(H5D_rdcc_ent_t);
/* Declare a free list to manage the H5D_chunk_info_t struct */
-H5FL_DEFINE(H5D_chunk_map_t);
+H5FL_DEFINE_STATIC(H5D_chunk_map_t);
/* Declare a free list to manage the H5D_piece_info_t struct */
H5FL_DEFINE(H5D_piece_info_t);
@@ -2700,7 +2700,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
/* Different blocks depending on whether we're using selection I/O */
if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) {
- size_t num_chunks;
+ size_t num_chunks = 0;
size_t element_sizes[2] = {dset_info->type_info.src_type_size, 0};
void *bufs[2] = {dset_info->buf.vp, NULL};
@@ -3021,7 +3021,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
/* Different blocks depending on whether we're using selection I/O */
if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) {
- size_t num_chunks;
+ size_t num_chunks = 0;
size_t element_sizes[2] = {dset_info->type_info.dst_type_size, 0};
const void *bufs[2] = {dset_info->buf.cvp, NULL};
diff --git a/src/H5EA.c b/src/H5EA.c
index 15b0407..d29f9ce 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -97,7 +97,7 @@ const H5EA_class_t *const H5EA_client_class_g[] = {
H5FL_DEFINE_STATIC(H5EA_t);
/* Declare a PQ free list to manage the element */
-H5FL_BLK_DEFINE(ea_native_elmt);
+H5FL_BLK_DEFINE_STATIC(ea_native_elmt);
/*-------------------------------------------------------------------------
* Function: H5EA__new
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 41096ab..847941f 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -357,8 +357,8 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs
hbool_t extend_sizes = FALSE;
hbool_t extend_types = FALSE;
uint32_t i;
- size_t size;
- H5FD_mem_t type;
+ size_t size = 0;
+ H5FD_mem_t type = H5FD_MEM_DEFAULT;
hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */
herr_t ret_value = SUCCEED; /* Return value */
@@ -573,8 +573,8 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr
hbool_t extend_sizes = FALSE;
hbool_t extend_types = FALSE;
uint32_t i;
- size_t size;
- H5FD_mem_t type;
+ size_t size = 0;
+ H5FD_mem_t type = H5FD_MEM_DEFAULT;
hid_t dxpl_id; /* DXPL for operation */
haddr_t eoa = HADDR_UNDEF; /* EOA for file */
herr_t ret_value = SUCCEED; /* Return value */
@@ -761,9 +761,9 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin
hbool_t extend_sizes = FALSE;
hbool_t extend_bufs = FALSE;
uint32_t i;
- size_t element_size;
- void *buf;
- hbool_t use_vector = FALSE;
+ size_t element_size = 0;
+ void *buf = NULL;
+ hbool_t use_vector = FALSE;
haddr_t addrs_local[H5FD_LOCAL_VECTOR_LEN];
haddr_t *addrs = addrs_local;
size_t sizes_local[H5FD_LOCAL_VECTOR_LEN];
@@ -1408,9 +1408,9 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui
hbool_t extend_sizes = FALSE;
hbool_t extend_bufs = FALSE;
uint32_t i;
- size_t element_size;
- const void *buf;
- hbool_t use_vector = FALSE;
+ size_t element_size = 0;
+ const void *buf = NULL;
+ hbool_t use_vector = FALSE;
haddr_t addrs_local[H5FD_LOCAL_VECTOR_LEN];
haddr_t *addrs = addrs_local;
size_t sizes_local[H5FD_LOCAL_VECTOR_LEN];
diff --git a/src/H5FL.c b/src/H5FL.c
index 9cc8dd2..e68f33e 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -149,7 +149,7 @@ static int H5FL__fac_term_all(void);
H5FL_DEFINE(H5FL_blk_node_t);
/* Declare a free list to manage the H5FL_fac_gc_node_t struct */
-H5FL_DEFINE(H5FL_fac_gc_node_t);
+H5FL_DEFINE_STATIC(H5FL_fac_gc_node_t);
/* Declare a free list to manage the H5FL_fac_head_t struct */
H5FL_DEFINE(H5FL_fac_head_t);
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index 978d4dc..2cf75d0 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -35,7 +35,7 @@ typedef struct H5F_sfile_node_t {
H5FL_DEFINE_STATIC(H5F_sfile_node_t);
/* Declare a local variable to track the shared file information */
-H5F_sfile_node_t *H5F_sfile_head_g = NULL;
+static H5F_sfile_node_t *H5F_sfile_head_s = NULL;
/*-------------------------------------------------------------------------
* Function: H5F_sfile_assert_num
@@ -56,14 +56,14 @@ H5F_sfile_assert_num(unsigned n)
if (n == 0) {
/* Sanity checking */
- HDassert(H5F_sfile_head_g == NULL);
+ HDassert(H5F_sfile_head_s == NULL);
} /* end if */
else {
unsigned count; /* Number of open shared files */
H5F_sfile_node_t *curr; /* Current shared file node */
/* Iterate through low-level files for matching low-level file info */
- curr = H5F_sfile_head_g;
+ curr = H5F_sfile_head_s;
count = 0;
while (curr) {
/* Increment # of open shared file structs */
@@ -111,8 +111,8 @@ H5F__sfile_add(H5F_shared_t *shared)
new_shared->shared = shared;
/* Prepend to list of shared files open */
- new_shared->next = H5F_sfile_head_g;
- H5F_sfile_head_g = new_shared;
+ new_shared->next = H5F_sfile_head_s;
+ H5F_sfile_head_s = new_shared;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -143,7 +143,7 @@ H5F__sfile_search(H5FD_t *lf)
HDassert(lf);
/* Iterate through low-level files for matching low-level file info */
- curr = H5F_sfile_head_g;
+ curr = H5F_sfile_head_s;
while (curr) {
/* Check for match */
if (0 == H5FD_cmp(curr->shared->lf, lf))
@@ -183,7 +183,7 @@ H5F__sfile_remove(H5F_shared_t *shared)
/* Locate shared file node with correct shared file */
last = NULL;
- curr = H5F_sfile_head_g;
+ curr = H5F_sfile_head_s;
while (curr && curr->shared != shared) {
/* Advance to next node */
last = curr;
@@ -200,7 +200,7 @@ H5F__sfile_remove(H5F_shared_t *shared)
last->next = curr->next;
else
/* Removing head node in list */
- H5F_sfile_head_g = curr->next;
+ H5F_sfile_head_s = curr->next;
/* Release the shared file node struct */
/* (the shared file info itself is freed elsewhere) */
diff --git a/src/H5HFiter.c b/src/H5HFiter.c
index 6d40979..7794eaf 100644
--- a/src/H5HFiter.c
+++ b/src/H5HFiter.c
@@ -64,7 +64,7 @@
/*******************/
/* Declare a free list to manage the H5HF_block_loc_t struct */
-H5FL_DEFINE(H5HF_block_loc_t);
+H5FL_DEFINE_STATIC(H5HF_block_loc_t);
/*-------------------------------------------------------------------------
* Function: H5HF__man_iter_init
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 8ec3d35..fae6f1d 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -265,7 +265,7 @@ H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1] = {{
}};
/* Declare a free list to manage the H5HF_free_section_t struct */
-H5FL_DEFINE(H5HF_free_section_t);
+H5FL_DEFINE_STATIC(H5HF_free_section_t);
/*****************************/
/* Library Private Variables */
diff --git a/src/H5Iint.c b/src/H5Iint.c
index 6bf32d7..ca54af7 100644
--- a/src/H5Iint.c
+++ b/src/H5Iint.c
@@ -92,7 +92,7 @@ int H5I_next_type_g = (int)H5I_NTYPES;
H5FL_DEFINE_STATIC(H5I_id_info_t);
/* Whether deletes are actually marks (for mark-and-sweep) */
-hbool_t H5I_marking_g = FALSE;
+static hbool_t H5I_marking_s = FALSE;
/*****************************/
/* Library Private Variables */
@@ -323,7 +323,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
*/
/* Set marking flag */
- H5I_marking_g = TRUE;
+ H5I_marking_s = TRUE;
/* Mark nodes for deletion */
HASH_ITER(hh, udata.type_info->hash_table, item, tmp)
@@ -334,7 +334,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
}
/* Unset marking flag */
- H5I_marking_g = FALSE;
+ H5I_marking_s = FALSE;
/* Perform sweep */
HASH_ITER(hh, udata.type_info->hash_table, item, tmp)
@@ -916,7 +916,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), info);
if (info) {
HDassert(!info->marked);
- if (!H5I_marking_g)
+ if (!H5I_marking_s)
HASH_DELETE(hh, type_info->hash_table, info);
else
info->marked = TRUE;
@@ -932,7 +932,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
ret_value = (void *)info->object;
H5_GCC_CLANG_DIAG_ON("cast-qual")
- if (!H5I_marking_g)
+ if (!H5I_marking_s)
info = H5FL_FREE(H5I_id_info_t, info);
/* Decrement the number of IDs in the type */
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index cfab485..8107ad3 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -166,7 +166,7 @@ const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/*******************/
/* Declare a free list to manage the H5MF_free_section_t struct */
-H5FL_DEFINE(H5MF_free_section_t);
+H5FL_DEFINE_STATIC(H5MF_free_section_t);
/*
* "simple/small/large" section callbacks
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c
index 77aa618..30725ad 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -71,7 +71,7 @@ const H5O_msg_class_t H5O_MSG_MDCI[1] = {{
#define H5O_MDCI_VERSION_0 0
/* Declare the free list for H5O_mdci_t's */
-H5FL_DEFINE(H5O_mdci_t);
+H5FL_DEFINE_STATIC(H5O_mdci_t);
/*-------------------------------------------------------------------------
* Function: H5O__mdci_decode
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 2ad8b02..1983898 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -2399,8 +2399,8 @@ herr_t
H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
- H5P_genplist_t *plist = NULL; /* Property list pointer */
- H5S_t *space; /* Dataspace to hold selection */
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ H5S_t *space = NULL; /* Dataspace to hold selection */
hbool_t space_created = FALSE; /* Whether a new dataspace has been created */
hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */
herr_t ret_value = SUCCEED; /* return value */
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 4ceac7a..a2cedfb 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -1796,7 +1796,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid
H5VL_pass_through_t *new_o;
H5VL_file_specific_args_t my_args;
H5VL_file_specific_args_t *new_args;
- H5VL_pass_through_info_t *info;
+ H5VL_pass_through_info_t *info = NULL;
hid_t under_vol_id = -1;
herr_t ret_value;