diff options
author | Sean McBride <sean@rogue-research.com> | 2023-06-19 05:13:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 05:13:38 (GMT) |
commit | 65d8c9347010771473b53c91adcec2f281772213 (patch) | |
tree | 487567dae0dc005de896f616b90e67744239a5e2 /tools/test | |
parent | 1f20354ee6cdfa9fd157ac9cdfff9acdf320a32d (diff) | |
download | hdf5-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 'tools/test')
-rw-r--r-- | tools/test/h5copy/dynlib_copy.c | 2 | ||||
-rw-r--r-- | tools/test/h5format_convert/h5fc_gentest.c | 18 | ||||
-rw-r--r-- | tools/test/h5jam/getub.c | 2 | ||||
-rw-r--r-- | tools/test/h5repack/dynlib_rpk.c | 2 | ||||
-rw-r--r-- | tools/test/h5repack/h5repacktst.c | 40 | ||||
-rw-r--r-- | tools/test/misc/h5clear_gentest.c | 2 | ||||
-rw-r--r-- | tools/test/misc/repart_test.c | 4 | ||||
-rw-r--r-- | tools/test/perform/chunk.c | 2 | ||||
-rw-r--r-- | tools/test/perform/chunk_cache.c | 2 | ||||
-rw-r--r-- | tools/test/perform/direct_write_perf.c | 2 | ||||
-rw-r--r-- | tools/test/perform/perf_meta.c | 30 |
11 files changed, 59 insertions, 47 deletions
diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index e71ca47..2abef79 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -24,7 +24,7 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ +static const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_DYNLIBUD, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index e0402b5..3718964 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -27,15 +27,15 @@ #define EDGE_V3_FILE "h5fc_edge_v3.h5" #define ERR_LEVEL_FILE "h5fc_err_level.h5" -const char *FILENAME[] = {"h5fc_ext1_i.h5", /* 0 */ - "h5fc_ext1_s.h5", /* 1 */ - "h5fc_ext1_f.h5", /* 2 */ - "h5fc_ext2_is.h5", /* 3 */ - "h5fc_ext2_if.h5", /* 4 */ - "h5fc_ext2_sf.h5", /* 5 */ - "h5fc_ext3_isf.h5", /* 6 */ - "h5fc_ext_none.h5", /* 7 */ - NULL}; +static const char *FILENAME[] = {"h5fc_ext1_i.h5", /* 0 */ + "h5fc_ext1_s.h5", /* 1 */ + "h5fc_ext1_f.h5", /* 2 */ + "h5fc_ext2_is.h5", /* 3 */ + "h5fc_ext2_if.h5", /* 4 */ + "h5fc_ext2_sf.h5", /* 5 */ + "h5fc_ext3_isf.h5", /* 6 */ + "h5fc_ext_none.h5", /* 7 */ + NULL}; #define GROUP "GROUP" diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index c01df38..8928ee8 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -18,7 +18,7 @@ void parse_command_line(int argc, const char *const *argv); /* Name of tool */ #define PROGRAM_NAME "getub" -char *nbytes = NULL; +static char *nbytes = NULL; static const char *s_opts = "c:"; /* add more later ? */ static struct h5_long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c index 225cea8..1feed12 100644 --- a/tools/test/h5repack/dynlib_rpk.c +++ b/tools/test/h5repack/dynlib_rpk.c @@ -26,7 +26,7 @@ static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const uns size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB1[1] = {{ +static const H5Z_class2_t H5Z_DYNLIB1[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_DYNLIB1, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index fc0fe54..cbb5f8f 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -82,7 +82,7 @@ /* Files for testing file space paging */ #define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */ #define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */ -const char *H5REPACK_FSPACE_FNAMES[] = { +static const char *H5REPACK_FSPACE_FNAMES[] = { "h5repack_latest.h5", /* 0 */ "h5repack_default.h5", /* 1 */ "h5repack_page_persist.h5", /* 2 */ @@ -101,7 +101,7 @@ const char *H5REPACK_FSPACE_FNAMES[] = { /* obj and region references in attr of compound and vlen type */ #define FNAME_ATTR_REF "h5repack_attr_refs.h5" -const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL}; +static const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL}; #define H5REPACK_EXTFILE "h5repack_ext.bin" @@ -4099,9 +4099,11 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da */ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (write_dset(loc_id, 1, dims, "enum", tid, buf45) < 0) goto out; @@ -4323,9 +4325,11 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (write_dset(loc_id, 2, dims2, "enum2D", tid, 0) < 0) goto out; @@ -4531,9 +4535,11 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (write_dset(loc_id, 3, dims3, "enum3D", tid, 0) < 0) goto out; @@ -4990,9 +4996,11 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da */ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (make_attr(loc_id, 1, dims, "enum", tid, buf45) < 0) goto out; @@ -5293,9 +5301,11 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (make_attr(loc_id, 2, dims2, "enum2D", tid, buf452) < 0) goto out; @@ -5737,9 +5747,11 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (make_attr(loc_id, 3, dims3, "enum3D", tid, buf453) < 0) goto out; diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 3ea6788..31796c1 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -13,7 +13,7 @@ #include "h5test.h" /* The HDF5 test files */ -const char *FILENAME[] = { +static const char *FILENAME[] = { "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ "h5clear_log_v3.h5", /* 1 -- log file with superblock version 3 */ "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index ac05aab..9359015 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.c @@ -22,8 +22,8 @@ #define FAMILY_H5REPART_SIZE1 20000 #define FAMILY_H5REPART_SIZE2 (5 * KB) -const char *FILENAME[] = {"fst_family%05d.h5", "scd_family%05d.h5", "family_to_single.h5", - "family_to_sec2.h5", NULL}; +static const char *FILENAME[] = {"fst_family%05d.h5", "scd_family%05d.h5", "family_to_single.h5", + "family_to_sec2.h5", NULL}; herr_t test_family_h5repart_opens(void); herr_t test_single_h5repart_opens(void); diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 3f4b3d7..f630cf3 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -75,7 +75,7 @@ static size_t counter(unsigned H5_ATTR_UNUSED flags, size_t cd_nelmts, const uns size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_COUNTER[1] = {{ +static const H5Z_class2_t H5Z_COUNTER[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ FILTER_COUNTER, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 7daeb68..13d7a12 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -53,7 +53,7 @@ static size_t counter(unsigned flags, size_t cd_nelmts, const unsigned *cd_value size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_COUNTER[1] = {{ +static const H5Z_class2_t H5Z_COUNTER[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ FILTER_COUNTER, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c index 016c9b7..1308fec 100644 --- a/tools/test/perform/direct_write_perf.c +++ b/tools/test/perform/direct_write_perf.c @@ -45,7 +45,7 @@ #include <unistd.h> #endif -const char *FILENAME[] = {"direct_write", "unix.raw", NULL}; +static const char *FILENAME[] = {"direct_write", "unix.raw", NULL}; /* * Print the current location on the standard output stream. diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c index 6e62f6a..5fe3631 100644 --- a/tools/test/perform/perf_meta.c +++ b/tools/test/perform/perf_meta.c @@ -28,25 +28,25 @@ #define FACC_MPIO 0x1 /* MPIO */ /* Which test to run */ -int RUN_TEST = 0x0; /* all tests as default */ -int TEST_1 = 0x1; /* Test 1 */ -int TEST_2 = 0x2; /* Test 2 */ -int TEST_3 = 0x4; /* Test 3 */ +static int RUN_TEST = 0x0; /* all tests as default */ +static int TEST_1 = 0x1; /* Test 1 */ +static int TEST_2 = 0x2; /* Test 2 */ +static int TEST_3 = 0x4; /* Test 3 */ -const char *FILENAME[] = {"meta_perf_1", "meta_perf_2", "meta_perf_3", NULL}; +static const char *FILENAME[] = {"meta_perf_1", "meta_perf_2", "meta_perf_3", NULL}; /* Default values for performance. Can be changed through command line options */ -int NUM_DSETS = 16; -int NUM_ATTRS = 8; -int BATCH_ATTRS = 2; -hbool_t flush_dset = FALSE; -hbool_t flush_attr = FALSE; -int nerrors = 0; /* errors count */ -hid_t fapl; +static int NUM_DSETS = 16; +static int NUM_ATTRS = 8; +static int BATCH_ATTRS = 2; +static hbool_t flush_dset = FALSE; +static hbool_t flush_attr = FALSE; +static int nerrors = 0; /* errors count */ +static hid_t fapl; /* Data space IDs */ -hid_t space; -hid_t small_space; +static hid_t space; +static hid_t small_space; /* Performance data */ typedef struct p_time { @@ -59,7 +59,7 @@ typedef struct p_time { } p_time; /*Test file access type for parallel. MPIO as default */ -int facc_type = FACC_DEFAULT; +static int facc_type = FACC_DEFAULT; double retrieve_time(void); void perf(p_time *perf_t, double start_t, double end_t); |