From 5163a7e1cf75edecc2d9e198a68ef00e8c124d00 Mon Sep 17 00:00:00 2001 From: kmu Date: Mon, 27 Jan 2020 09:01:32 -0600 Subject: fix Wredundant-decls, Wswitch-default, Wdeclaration-after-statement, Wsign-compare, Wmisleading-indentation, Wshadow --- src/H5private.h | 2 +- test/use_common.c | 38 +++++----- testpar/t_2Gio.c | 69 +++++++++++------- testpar/t_bigio.c | 45 +++++++----- testpar/t_chunk_alloc.c | 20 ++--- testpar/t_coll_chunk.c | 12 +++ testpar/t_mdset.c | 8 +- testpar/t_prestart.c | 9 ++- testpar/t_shapesame.c | 7 +- testpar/t_span_tree.c | 4 +- tools/lib/h5diff.c | 2 +- tools/src/h5diff/ph5diff_main.c | 2 +- tools/src/h5ls/h5ls.c | 8 +- tools/test/h5copy/h5copygentest.c | 8 +- tools/test/h5repack/h5repackgentest.c | 16 ++-- tools/test/perform/perf.c | 2 + tools/test/perform/pio_engine.c | 133 +++++++++++++++++++++------------- tools/test/perform/pio_perf.c | 5 +- 18 files changed, 231 insertions(+), 159 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index c3375df..74fab79 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1616,7 +1616,7 @@ extern char *strdup(const char *s); srctype _tmp_src = (srctype)(src); \ dsttype _tmp_dst = (dsttype)(_tmp_src); \ HDassert(_tmp_src >= 0); \ - HDassert(_tmp_src == _tmp_dst); \ + HDassert(_tmp_src == (srctype)_tmp_dst); \ (dst) = _tmp_dst; \ } diff --git a/test/use_common.c b/test/use_common.c index 9effa06..4111b24 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -343,44 +343,45 @@ int write_uc_file(hbool_t tosend, hid_t fid) count[1]=dims[1]; count[2]=dims[2]; for (i=0; i= 0), "H5P_DATASET_CREATE"); - hsize_t chunk[3] = {4, shape[1], shape[2]}; + chunk[0] = 4; + chunk[1] = shape[1]; + shape[2] = shape[2]; status = H5Pset_chunk(dcpl_id, 3, chunk); VRFY((status >= 0), "H5Pset_chunk succeeded"); @@ -634,10 +646,9 @@ static int MpioTest2G( MPI_Comm comm ) status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); VRFY((status >= 0), ""); - size_t slice_per_process; H5_CHECKED_ASSIGN(slice_per_process, size_t, (shape[0] + (hsize_t)mpi_size - 1) / (hsize_t)mpi_size, hsize_t); - size_t data_size = slice_per_process * shape[1] * shape[2]; - size_t data_size_bytes = sizeof(int) * data_size; + data_size = slice_per_process * shape[1] * shape[2]; + data_size_bytes = sizeof(int) * data_size; data = HDmalloc(data_size_bytes); VRFY((data != NULL), "data HDmalloc succeeded"); @@ -645,9 +656,13 @@ static int MpioTest2G( MPI_Comm comm ) data[i] = mpi_rank; } - hsize_t h5_counts[3] = { slice_per_process, shape[1], shape[2] }; - hsize_t h5_offsets[3] = { (size_t)mpi_rank * slice_per_process, 0, 0}; - hid_t filedataspace = H5Screate_simple(3, shape, NULL); + h5_counts[0] = slice_per_process; + h5_counts[1] = shape[1]; + h5_counts[2] = shape[2]; + h5_offsets[0] = (size_t)mpi_rank * slice_per_process; + h5_offsets[1] = 0; + h5_offsets[2] = 0; + filedataspace = H5Screate_simple(3, shape, NULL); VRFY((filedataspace >= 0), "H5Screate_simple succeeded"); // fix reminder along first dimension multiple of chunk[0] @@ -659,7 +674,7 @@ static int MpioTest2G( MPI_Comm comm ) h5_offsets, NULL, h5_counts, NULL); VRFY((status >= 0), "H5Sselect_hyperslab succeeded"); - hid_t memorydataspace = H5Screate_simple(3, h5_counts, NULL); + memorydataspace = H5Screate_simple(3, h5_counts, NULL); VRFY((memorydataspace >= 0), "H5Screate_simple succeeded"); status = H5Dwrite(dset_id, H5T_NATIVE_INT, @@ -2149,7 +2164,7 @@ extend_writeInd2(void) { const char *filename; hid_t fid; /* HDF5 file ID */ - hid_t fapl; /* File access templates */ + hid_t fapl_id; /* File access templates */ hid_t fs; /* File dataspace ID */ hid_t ms; /* Memory dataspace ID */ hid_t dataset; /* Dataset ID */ @@ -2177,15 +2192,15 @@ extend_writeInd2(void) * START AN HDF5 FILE * -------------------*/ /* setup file access template */ - fapl = create_faccess_plist(test_comm, MPI_INFO_NULL, facc_type); - VRFY((fapl >= 0), "create_faccess_plist succeeded"); + fapl_id = create_faccess_plist(test_comm, MPI_INFO_NULL, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); /* Release file-access template */ - ret = H5Pclose(fapl); + ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); @@ -3403,7 +3418,7 @@ test_actual_io_mode(int selection_mode) { hid_t sid = -1; hid_t dataset = -1; hid_t data_type = H5T_NATIVE_INT; - hid_t fapl = -1; + hid_t fapl_id = -1; hid_t mem_space = -1; hid_t file_space = -1; hid_t dcpl = -1; @@ -3454,11 +3469,11 @@ test_actual_io_mode(int selection_mode) { HDassert(filename != NULL); /* Setup the file access template */ - fapl = create_faccess_plist(mpi_comm, mpi_info, facc_type); - VRFY((fapl >= 0), "create_faccess_plist() succeeded"); + fapl_id = create_faccess_plist(mpi_comm, mpi_info, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); /* Create the basic Space */ @@ -3790,7 +3805,7 @@ test_actual_io_mode(int selection_mode) { /* Release some resources */ ret = H5Sclose(sid); - ret = H5Pclose(fapl); + ret = H5Pclose(fapl_id); ret = H5Pclose(dcpl); ret = H5Pclose(dxpl_write); ret = H5Pclose(dxpl_read); @@ -3919,7 +3934,7 @@ test_no_collective_cause_mode(int selection_mode) hid_t sid = -1; hid_t dataset = -1; hid_t data_type = H5T_NATIVE_INT; - hid_t fapl = -1; + hid_t fapl_id = -1; hid_t dcpl = -1; hid_t dxpl_write = -1; hid_t dxpl_read = -1; @@ -4000,11 +4015,11 @@ test_no_collective_cause_mode(int selection_mode) HDassert(filename != NULL); /* Setup the file access template */ - fapl = create_faccess_plist(mpi_comm, mpi_info, l_facc_type); - VRFY((fapl >= 0), "create_faccess_plist() succeeded"); + fapl_id = create_faccess_plist(mpi_comm, mpi_info, l_facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); @@ -4171,8 +4186,8 @@ test_no_collective_cause_mode(int selection_mode) /* Release some resources */ if (sid) H5Sclose(sid); - if (fapl) - H5Pclose(fapl); + if (fapl_id) + H5Pclose(fapl_id); if (dcpl) H5Pclose(dcpl); if (dxpl_write) diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 70c77c3..e71f936 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -50,7 +50,6 @@ hsize_t space_dim2 = SPACE_DIM2; static void coll_chunktest(const char* filename, int chunk_factor, int select_factor, int api_option, int file_selection, int mem_selection, int mode); -hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); /* * Setup the coordinates for point selection. @@ -228,8 +227,8 @@ verify_data(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], /* Set up the selection */ static void -ccslab_set(int mpi_rank, - int mpi_size, +ccslab_set(int my_mpi_rank, + int my_mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[], @@ -247,7 +246,7 @@ ccslab_set(int mpi_rank, stride[1] = 1; count[0] = space_dim1; count[1] = space_dim2; - start[0] = (hsize_t)mpi_rank*count[0]; + start[0] = (hsize_t)my_mpi_rank*count[0]; start[1] = 0; break; @@ -260,7 +259,7 @@ ccslab_set(int mpi_rank, stride[1] = 3; count[0] = space_dim1/(stride[0]*block[0]); count[1] = (space_dim2)/(stride[1]*block[1]); - start[0] = space_dim1*(hsize_t)mpi_rank; + start[0] = space_dim1*(hsize_t)my_mpi_rank; start[1] = 0; break; @@ -272,9 +271,9 @@ ccslab_set(int mpi_rank, block[1] = 1; stride[0] = 1; stride[1] = 1; - count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:space_dim1); + count[0] = ((my_mpi_rank >= MAX(1,(my_mpi_size-2)))?0:space_dim1); count[1] = space_dim2; - start[0] = (hsize_t)mpi_rank*count[0]; + start[0] = (hsize_t)my_mpi_rank*count[0]; start[1] = 0; break; @@ -286,13 +285,13 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 2; - stride[0] = (hsize_t)(space_dim1*(hsize_t)mpi_size/4+1); + stride[0] = (hsize_t)(space_dim1*(hsize_t)my_mpi_size/4+1); block[1] = space_dim2; count[1] = 1; start[1] = 0; stride[1] = 1; - if((mpi_rank *3)<(mpi_size*2)) start[0] = (hsize_t)mpi_rank; - else start[0] = 1 + space_dim1*(hsize_t)mpi_size/2 + (hsize_t)(mpi_rank-2*mpi_size/3); + if((my_mpi_rank *3)<(my_mpi_size*2)) start[0] = (hsize_t)my_mpi_rank; + else start[0] = 1 + space_dim1*(hsize_t)my_mpi_size/2 + (hsize_t)(my_mpi_rank-2*my_mpi_size/3); break; case BYROW_SELECTINCHUNK: @@ -300,12 +299,12 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 1; - start[0] = (hsize_t)mpi_rank*space_dim1; + start[0] = (hsize_t)my_mpi_rank*space_dim1; stride[0]= 1; - block[1] = space_dim2; - count[1] = 1; - stride[1]= 1; - start[1] = 0; + block[1] = space_dim2; + count[1] = 1; + stride[1]= 1; + start[1] = 0; break; @@ -1182,10 +1181,10 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) { hid_t ret_pl = -1; herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ + int my_mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_rank(MPI_COMM_WORLD, &my_mpi_rank); ret_pl = H5Pcreate (H5P_FILE_ACCESS); VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); @@ -1539,6 +1538,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -1562,6 +1564,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* set up the collective transfer property list */ @@ -1798,6 +1803,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -1821,6 +1829,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* fill dataset with test data */ diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index e6df2d8..e716f41 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -385,18 +385,18 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in /* set expected value according the write pattern */ switch (write_pattern) { - case all: - value = i%mpi_size + 1; - break; - case none: - value = 0; - break; - case sec_last: - if (i==nchunks-2) - value = 100; - else + case all: + value = i%mpi_size + 1; + break; + case none: value = 0; break; + case sec_last: + if (i==nchunks-2) + value = 100; + else + value = 0; + break; default: HDassert(0); } diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index e950015..20c119f 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -710,6 +710,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -733,6 +736,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* set up the collective transfer property list */ @@ -965,6 +971,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -988,6 +997,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* fill dataset with test data */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 6cdb0af7..db0d059 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -235,6 +235,9 @@ void compact_dataset(void) char dname[]="dataset"; herr_t ret; const char *filename; +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; +#endif size = get_size(); @@ -314,7 +317,6 @@ void compact_dataset(void) VRFY((dataset >= 0), "H5Dopen2 succeeded"); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY - hbool_t prop_value; prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); @@ -620,6 +622,9 @@ void dataset_fillvalue(void) int acc, i, ii, j, k, l; /* Local index variables */ herr_t ret; /* Generic return value */ const char *filename; +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; +#endif MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -664,7 +669,6 @@ void dataset_fillvalue(void) VRFY((dxpl >= 0), "H5Pcreate succeeded"); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY - hbool_t prop_value; prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c index fc9d475..cf974e8 100644 --- a/testpar/t_prestart.c +++ b/testpar/t_prestart.c @@ -34,8 +34,8 @@ main (int argc, char **argv) hid_t file_id, dset_id, grp_id; hid_t fapl, sid, mem_dataspace; herr_t ret; - char filename[1024]; - int mpi_size, mpi_rank, ndims, i, j; + char filename[1024]; + int mpi_size, mpi_rank, ndims; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; hsize_t dims[RANK]; @@ -43,6 +43,7 @@ main (int argc, char **argv) hsize_t count[RANK]; hsize_t stride[RANK]; hsize_t block[RANK]; + hsize_t i, j; DATATYPE *data_array = NULL, *dataptr; /* data buffer */ MPI_Init(&argc, &argv); @@ -73,8 +74,8 @@ main (int argc, char **argv) ndims = H5Sget_simple_extent_dims(sid, dims, NULL); VRFY((ndims == 2), "H5Sget_simple_extent_dims succeeded"); - VRFY(dims[0] == ROW_FACTOR*mpi_size, "Wrong dataset dimensions"); - VRFY(dims[1] == COL_FACTOR*mpi_size, "Wrong dataset dimensions"); + VRFY(dims[0] == (hsize_t)(ROW_FACTOR*mpi_size), "Wrong dataset dimensions"); + VRFY(dims[1] == (hsize_t)(COL_FACTOR*mpi_size), "Wrong dataset dimensions"); /* allocate memory for data buffer */ data_array = (DATATYPE *)HDmalloc(dims[0]*dims[1]*sizeof(DATATYPE)); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index c12cf5a..34fcc72 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -397,14 +397,9 @@ hs_dr_pio_test__setup(const int test_num, * * JRM -- 9/16/10 */ - if ( express_test == 0 ) { - tv_ptr->chunk_dims[0] = 1; + tv_ptr->chunk_dims[0] = 1; - } else { - - tv_ptr->chunk_dims[0] = 1; - } tv_ptr->chunk_dims[1] = tv_ptr->chunk_dims[2] = tv_ptr->chunk_dims[3] = tv_ptr->chunk_dims[4] = (hsize_t)(tv_ptr->chunk_edge_size); diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index e1a86a1..fe8a618 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -223,7 +223,7 @@ void coll_write_test(int chunk_factor) hsize_t chunk_dims[2]; herr_t ret; - unsigned i; + int i; int fillvalue = 0; /* Fill value for the dataset */ int *matrix_out = NULL; @@ -682,7 +682,7 @@ coll_read_test(void) hsize_t block[2]; /* Block sizes */ herr_t ret; - unsigned i; + int i; int *matrix_out; int *matrix_out1; /* Buffer to read from the dataset */ 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); -- cgit v0.12