summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkmu <kmu@hdfgroup.org>2020-01-27 15:01:32 (GMT)
committerkmu <kmu@hdfgroup.org>2020-01-27 15:01:32 (GMT)
commit5163a7e1cf75edecc2d9e198a68ef00e8c124d00 (patch)
tree899b937df8ea59b756e7aab654f11ad014f75f01 /tools
parentf3a4e8164f99d733e6804acddfe1b3b0dfe63634 (diff)
downloadhdf5-5163a7e1cf75edecc2d9e198a68ef00e8c124d00.zip
hdf5-5163a7e1cf75edecc2d9e198a68ef00e8c124d00.tar.gz
hdf5-5163a7e1cf75edecc2d9e198a68ef00e8c124d00.tar.bz2
fix Wredundant-decls, Wswitch-default, Wdeclaration-after-statement, Wsign-compare, Wmisleading-indentation, Wshadow
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.c2
-rw-r--r--tools/src/h5diff/ph5diff_main.c2
-rw-r--r--tools/src/h5ls/h5ls.c8
-rw-r--r--tools/test/h5copy/h5copygentest.c8
-rw-r--r--tools/test/h5repack/h5repackgentest.c16
-rw-r--r--tools/test/perform/perf.c2
-rw-r--r--tools/test/perform/pio_engine.c133
-rw-r--r--tools/test/perform/pio_perf.c5
8 files changed, 105 insertions, 71 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 7830e25..86726b4 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1345,7 +1345,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
} /* end else */
} /* end while */
- for(i = 1; i < g_nTasks; i++)
+ for(i = 1; (int)i < g_nTasks; i++)
MPI_Send(NULL, 0, MPI_BYTE, (int)i, MPI_TAG_END, MPI_COMM_WORLD);
/* Print any final data waiting in our queue */
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 5ba5fb3..c473c8b 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -166,7 +166,7 @@ ph5diff_worker(int nID)
{
struct diff_mpi_args args;
struct diffs_found diffs;
- int i;
+ unsigned i;
/* Make certain we've received the filenames and opened the files already */
if(file1_id < 0 || file2_id < 0)
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 3dfbb49..f3f9ede 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -1302,7 +1302,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
hid_t new_obj_sid = H5I_INVALID_HID;
hsize_t elmt_counter = 0; /*counts the # elements printed. */
size_t ncols = 80; /* available output width */
- size_t i;
+ int i;
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t datactx; /* print context */
@@ -1312,7 +1312,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
datactx = *ctx; /* print context */
/* Assume entire data space to be printed */
if (datactx.ndims > 0)
- for (i = 0; i < (size_t)datactx.ndims; i++)
+ for (i = 0; (unsigned)i < datactx.ndims; i++)
datactx.p_min_idx[i] = 0;
datactx.need_prefix = TRUE;
@@ -1447,13 +1447,13 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
/* Print point information */
H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2");
h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
+ &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
}
else if(region_type == H5S_SEL_HYPERSLABS) {
/* Print block information */
H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2");
h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
+ &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
}
else
H5TOOLS_INFO("invalid region type");
diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c
index 716b0d2..2a8a575 100644
--- a/tools/test/h5copy/h5copygentest.c
+++ b/tools/test/h5copy/h5copygentest.c
@@ -744,9 +744,9 @@ static void Test_Obj_Copy(void)
/* Set the FAPL for the type of format */
/* Create source file */
if(new_format)
- fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
- else
- fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
+ else
+ fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if(fid < 0) {
HDfprintf(stderr, "Error: H5Fcreate failed.\n");
goto out;
@@ -756,7 +756,7 @@ static void Test_Obj_Copy(void)
gent_empty_group(fid);
gent_nested_datasets(fid);
gent_nested_group(fid);
- gent_att_compound_vlstr(fid);
+ gent_att_compound_vlstr(fid);
H5Fclose(fid);
fid = (-1);
diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c
index a61d8d7..7604964 100644
--- a/tools/test/h5repack/h5repackgentest.c
+++ b/tools/test/h5repack/h5repackgentest.c
@@ -231,9 +231,9 @@ generate_int32le_3d(hbool_t external) {
/* generate values, alternating positive and negative
*/
- for (i = 0, n = 0; i < dims[0]; i++) {
- for (j = 0; j < dims[1]; j++) {
- for (k = 0; k < dims[2]; k++, n++) {
+ for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++) {
+ for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
wdata[n] = (k + j * 512 + i * 4096) * ((n & 1) ? (-1) : (1));
}
}
@@ -263,9 +263,9 @@ generate_uint8be(hbool_t external) {
/* Generate values, ping-pong from ends of range
*/
- for (i = 0, n = 0; i < dims[0]; i++) {
- for (j = 0; j < dims[1]; j++) {
- for (k = 0; k < dims[2]; k++, n++) {
+ for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++) {
+ for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
wdata[n] = (uint8_t)((n & 1) ? -n : n);
}
}
@@ -294,8 +294,8 @@ generate_f32le(hbool_t external) {
int ret_value = 0;
/* Generate values */
- for (i = 0, k = 0, n = 0; i < dims[0]; i++) {
- for (j = 0; j < dims[1]; j++, k++, n++) {
+ for (i = 0, k = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++, k++, n++) {
wdata[k] = n * 801.1f * ((k % 5 == 1) ? (-1) : (1));
}
}
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
index 3f56d8b..364836f 100644
--- a/tools/test/perform/perf.c
+++ b/tools/test/perform/perf.c
@@ -110,8 +110,10 @@ const char *FILENAME[] = {
/* function prototypes */
static int parse_args(int argc, char **argv);
+#ifndef H5_HAVE_UNISTD_H
/* globals needed for getopt */
extern char *optarg;
+#endif
int main(int argc, char **argv)
{
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 8bc522f..3863550 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -362,15 +362,17 @@ done:
switch (iot) {
case POSIXIO:
if (fd.posixfd != -1)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
break;
case MPIO:
if (fd.mpifd != MPI_FILE_NULL)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
break;
case PHDF5:
if (fd.h5fd != -1)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
+ break;
+ default:
break;
}
@@ -413,6 +415,8 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
case PHDF5:
suffix = ".h5";
break;
+ default:
+ break;
}
/* First use the environment variable and then try the constant */
@@ -857,6 +861,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end if */
} /* end if */
break;
+
+ default:
+ break;
} /* end switch */
for (ndset = 1; ndset <= ndsets; ++ndset) {
@@ -920,6 +927,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
GOTOERROR(FAIL);
}
break;
+
+ default:
+ break;
}
/* The task is to transfer bytes_count bytes, starting at
@@ -1376,6 +1386,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end else */
break;
+
+ default:
+ break;
} /* switch (parms->io_type) */
} /* end while */
@@ -1815,19 +1828,22 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Create the dataset transfer property list */
h5dxpl = H5Pcreate(H5P_DATASET_XFER);
if (h5dxpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
}
/* Change to collective I/O, if asked */
if(parms->collective) {
- hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
} /* end if */
break;
+
+ default:
+ break;
} /* end switch */
for (ndset = 1; ndset <= ndsets; ++ndset) {
@@ -1838,19 +1854,21 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
switch (parms->io_type) {
case POSIXIO:
case MPIO:
- /* both posix and mpi io just need dataset offset in file*/
- dset_offset = (ndset - 1) * nbytes;
- break;
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
case PHDF5:
HDsprintf(dname, "Dataset_%ld", ndset);
- h5ds_id = H5DOPEN(fd->h5fd, dname);
- if (h5ds_id < 0) {
- HDfprintf(stderr, "HDF5 Dataset open failed\n");
- GOTOERROR(FAIL);
- }
+ h5ds_id = H5DOPEN(fd->h5fd, dname);
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
- break;
+ default:
+ break;
}
/* The task is to transfer bytes_count bytes, starting at
@@ -2303,6 +2321,9 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end else */
break;
+
+ default:
+ break;
} /* switch (parms->io_type) */
/* Verify raw data, if asked */
@@ -2532,6 +2553,9 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
}
break;
+
+ default:
+ break;
}
done:
@@ -2552,38 +2576,41 @@ do_fclose(iotype iot, file_descr *fd /*out*/)
int mrc = 0, rc = 0;
switch (iot) {
- case POSIXIO:
- rc = POSIXCLOSE(fd->posixfd);
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
- if (rc != 0){
- HDfprintf(stderr, "POSIX File Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (rc != 0){
+ HDfprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->posixfd = -1;
- break;
+ fd->posixfd = -1;
+ break;
- case MPIO:
- mrc = MPI_File_close(&fd->mpifd);
+ case MPIO:
+ mrc = MPI_File_close(&fd->mpifd);
- if (mrc != MPI_SUCCESS){
- HDfprintf(stderr, "MPI File close failed\n");
- GOTOERROR(FAIL);
- }
+ if (mrc != MPI_SUCCESS){
+ HDfprintf(stderr, "MPI File close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->mpifd = MPI_FILE_NULL;
- break;
+ fd->mpifd = MPI_FILE_NULL;
+ break;
- case PHDF5:
- hrc = H5Fclose(fd->h5fd);
+ case PHDF5:
+ hrc = H5Fclose(fd->h5fd);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 File Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->h5fd = -1;
- break;
+ fd->h5fd = -1;
+ break;
+
+ default:
+ break;
}
done:
@@ -2610,15 +2637,17 @@ do_cleanupfile(iotype iot, char *fname)
clean_file_g = (getenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
if (clean_file_g){
- switch (iot){
- case POSIXIO:
- HDremove(fname);
- break;
- case MPIO:
- case PHDF5:
- MPI_File_delete(fname, h5_io_info_g);
- break;
- }
+ switch (iot){
+ case POSIXIO:
+ HDremove(fname);
+ break;
+ case MPIO:
+ case PHDF5:
+ MPI_File_delete(fname, h5_io_info_g);
+ break;
+ default:
+ break;
+ }
}
}
diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c
index 4c0ec5e..b9c49b2 100644
--- a/tools/test/perform/pio_perf.c
+++ b/tools/test/perform/pio_perf.c
@@ -80,11 +80,12 @@
#define PIO_MPI 0x2
#define PIO_HDF5 0x4
+#ifndef H5_STDC_HEADERS
#define DBL_EPSILON 2.2204460492503131e-16
#define H5_DBL_ABS_EQUAL(X,Y) (fabs((X)-(Y)) < DBL_EPSILON)
+#endif
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
#ifndef TRUE
@@ -569,6 +570,8 @@ run_test(iotype iot, parameters parms, struct options *opts)
case PHDF5:
output_report("PHDF5 (w/MPI-IO driver)\n");
break;
+ default:
+ break;
}
MPI_Comm_size(pio_comm_g, &comm_size);