diff options
author | Sean McBride <sean@rogue-research.com> | 2023-06-16 04:49:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-16 04:49:02 (GMT) |
commit | 68eba3da69e659fab69bbef5901ce42e82cea1dc (patch) | |
tree | f36805f798df6c04092c14dc6803d2cb82f6eff2 /test/tfile.c | |
parent | 10093f7c4345061bdbebc12888debbf08fe85a5b (diff) | |
download | hdf5-68eba3da69e659fab69bbef5901ce42e82cea1dc.zip hdf5-68eba3da69e659fab69bbef5901ce42e82cea1dc.tar.gz hdf5-68eba3da69e659fab69bbef5901ce42e82cea1dc.tar.bz2 |
Many clang -Wextra-semi-stmt fixes (#2537)
* Adds semicolons to function-like macros
* Adds a do..while(0) loop to some macros
* Removes semicolons when inappropriate, especially H5E_TRY_BEGIN/END
Diffstat (limited to 'test/tfile.c')
-rw-r--r-- | test/tfile.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/test/tfile.c b/test/tfile.c index f24b55d..ac931cc 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -342,43 +342,43 @@ test_file_create(void) { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_userblock"); /* Set the new file-creation parameters */ @@ -669,7 +669,7 @@ test_file_reopen(void) /* Create a dataset in the file */ sid = H5Screate_simple(1, &dims, &dims); - CHECK_I(sid, "H5Screate_simple") + CHECK_I(sid, "H5Screate_simple"); did = H5Dcreate2(fid, REOPEN_DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK_I(did, "H5Dcreate2"); @@ -1401,7 +1401,7 @@ test_get_file_id(void) { fid2 = H5Iget_file_id(plist); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid2, FAIL, "H5Iget_file_id"); /* Close objects */ @@ -1607,7 +1607,7 @@ test_file_perm(void) { dset = H5Dcreate2(filero, F2_DSET, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(dset, FAIL, "H5Dcreate2"); if (dset != FAIL) { ret = H5Dclose(dset); @@ -1666,7 +1666,7 @@ test_file_perm2(void) { group = H5Gcreate2(filero, "MY_GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(group, FAIL, "H5Gcreate2"); /* Create a dataset with the read-only file handle (should fail) */ @@ -1674,7 +1674,7 @@ test_file_perm2(void) { dset = H5Dcreate2(filero, F2_DSET, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(dset, FAIL, "H5Dcreate2"); /* Create an attribute with the read-only file handle (should fail) */ @@ -1682,7 +1682,7 @@ test_file_perm2(void) { attr = H5Acreate2(filero, "MY_ATTR", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(attr, FAIL, "H5Acreate2"); type = H5Tcopy(H5T_NATIVE_SHORT); @@ -1693,7 +1693,7 @@ test_file_perm2(void) { ret = H5Tcommit2(filero, "MY_DTYPE", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Tcommit2"); ret = H5Tclose(type); @@ -2045,7 +2045,7 @@ test_file_delete(hid_t fapl_id) { is_hdf5 = H5Fis_accessible(filename, fapl_id); } - H5E_END_TRY; + H5E_END_TRY VERIFY(is_hdf5, FAIL, "H5Fis_accessible"); /* Just in case deletion fails - silent on errors */ @@ -2076,7 +2076,7 @@ test_file_delete(hid_t fapl_id) { is_hdf5 = H5Fis_accessible(filename, fapl_id); } - H5E_END_TRY; + H5E_END_TRY CHECK(is_hdf5, TRUE, "H5Fis_accessible"); /* Try to delete it (should fail) */ @@ -2084,7 +2084,7 @@ test_file_delete(hid_t fapl_id) { ret = H5Fdelete(filename, fapl_id); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Fdelete"); /* Delete the file */ @@ -2130,7 +2130,7 @@ test_file_open_dot(void) { did = H5Dcreate2(fid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(did, FAIL, "H5Dcreate2"); /* Create a dataset with no name using the group ID */ @@ -2138,7 +2138,7 @@ test_file_open_dot(void) { did = H5Dcreate2(gid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(did, FAIL, "H5Dcreate2"); /* Open a dataset with no name using the file ID */ @@ -2146,7 +2146,7 @@ test_file_open_dot(void) { did = H5Dopen2(fid, ".", H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(did, FAIL, "H5Dopen2"); /* Open a dataset with no name using the group ID */ @@ -2154,7 +2154,7 @@ test_file_open_dot(void) { did = H5Dopen2(gid, ".", H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(did, FAIL, "H5Dopen2"); /* Make a copy of a datatype to use for creating a named datatype */ @@ -2166,7 +2166,7 @@ test_file_open_dot(void) { ret = H5Tcommit2(fid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Tcommit2"); /* Create a named datatype with no name using the group ID */ @@ -2174,7 +2174,7 @@ test_file_open_dot(void) { ret = H5Tcommit2(gid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Tcommit2"); /* Open a named datatype with no name using the file ID */ @@ -2182,7 +2182,7 @@ test_file_open_dot(void) { tid2 = H5Topen2(fid, ".", H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(tid2, FAIL, "H5Topen2"); /* Open a named datatype with no name using the group ID */ @@ -2190,7 +2190,7 @@ test_file_open_dot(void) { tid2 = H5Topen2(gid, ".", H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(tid2, FAIL, "H5Topen2"); /* Create a group with no name using the file ID */ @@ -2198,7 +2198,7 @@ test_file_open_dot(void) { gid2 = H5Gcreate2(fid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(gid2, FAIL, "H5Gcreate2"); /* Create a group with no name using the group ID */ @@ -2206,7 +2206,7 @@ test_file_open_dot(void) { gid2 = H5Gcreate2(gid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY VERIFY(gid2, FAIL, "H5Gcreate2"); /* Open a group with no name using the file ID (should open the root group) */ @@ -2389,7 +2389,7 @@ test_file_getname(void) { name_len = H5Fget_name(space_id, name, (size_t)TESTA_NAME_BUF_SIZE); } - H5E_END_TRY; + H5E_END_TRY VERIFY(name_len, FAIL, "H5Fget_name"); /* Create a new dataset */ @@ -3522,7 +3522,7 @@ test_userblock_alignment(const char *env_h5_drvr) { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid, FAIL, "H5Fcreate"); /* Release property lists */ @@ -3555,7 +3555,7 @@ test_userblock_alignment(const char *env_h5_drvr) { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid, FAIL, "H5Fcreate"); /* Release property lists */ @@ -3735,7 +3735,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid, FAIL, "H5Fcreate"); /* Release property lists */ @@ -3813,7 +3813,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid, FAIL, "H5Fcreate"); /* Release property lists */ @@ -3853,7 +3853,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid, FAIL, "H5Fcreate"); /* Release property lists */ @@ -3931,7 +3931,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(fid, FAIL, "H5Fcreate"); /* Release property lists */ @@ -4124,7 +4124,7 @@ test_filespace_info(const char *env_h5_drvr) { ret = H5Pset_file_space_page_size(fcpl, 0); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_file_space_page_size"); /* Setting to 511: should fail */ @@ -4132,7 +4132,7 @@ test_filespace_info(const char *env_h5_drvr) { ret = H5Pset_file_space_page_size(fcpl, 511); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_file_space_page_size"); /* Setting to 1GB+1: should fail */ @@ -4140,7 +4140,7 @@ test_filespace_info(const char *env_h5_drvr) { ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE1G + 1); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_file_space_page_size"); /* Setting to 512: should succeed */ @@ -5543,7 +5543,7 @@ test_libver_bounds_open(void) { file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(file, FAIL, "Attempted to open latest file with earliest version"); /* Attempt to open latest file with (v18, v18), should fail */ @@ -5552,7 +5552,7 @@ test_libver_bounds_open(void) { file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); } - H5E_END_TRY; + H5E_END_TRY VERIFY(file, FAIL, "Attempted to open latest file with v18 bounds"); /* Opening VERBFNAME in these combination should succeed. @@ -5744,7 +5744,7 @@ test_libver_bounds_low_high(const char *env_h5_drvr) /* Set the low/high version bounds */ ret = H5Pset_libver_bounds(fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY /* Should fail: invalid combinations */ if (high == H5F_LIBVER_EARLIEST) { @@ -5959,7 +5959,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n { fid = H5Fcreate(FILE8, H5F_ACC_TRUNC | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Get the internal file pointer if the create succeeds */ if (fid >= 0) { @@ -6127,7 +6127,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non { fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Retrieve the low/high bounds */ ret = H5Pget_libver_bounds(fapl, &low, &high); @@ -6161,7 +6161,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non { ret = H5Pset_libver_bounds(new_fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY /* Invalid combinations */ if (ret < 0) @@ -6172,7 +6172,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non { fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (non_def_fsm && high < H5F_LIBVER_V110) { VERIFY(fid, H5I_INVALID_HID, "H5Fopen"); @@ -6344,7 +6344,7 @@ test_libver_bounds_obj(hid_t fapl) { ret = H5Pset_libver_bounds(new_fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY if (ret < 0) /* Invalid combinations */ continue; @@ -6354,7 +6354,7 @@ test_libver_bounds_obj(hid_t fapl) { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) { /* The file open succeeds */ @@ -6510,7 +6510,7 @@ test_libver_bounds_dataset(hid_t fapl) { did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY if (did >= 0) { @@ -6562,7 +6562,7 @@ test_libver_bounds_dataset(hid_t fapl) { ret = H5Pset_libver_bounds(new_fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY if (ret < 0) /* Invalid low/high combinations */ continue; @@ -6572,7 +6572,7 @@ test_libver_bounds_dataset(hid_t fapl) { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) { /* The file open succeeds */ @@ -6791,7 +6791,7 @@ test_libver_bounds_dataspace(hid_t fapl) { ret = H5Pset_libver_bounds(new_fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY if (ret < 0) /* Invalid low/high combinations */ continue; @@ -6801,7 +6801,7 @@ test_libver_bounds_dataspace(hid_t fapl) { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) { /* The file open succeeds */ @@ -7127,7 +7127,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) { ret = H5Pset_libver_bounds(new_fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY if (ret < 0) /* Invalid low/high combinations */ continue; @@ -7137,7 +7137,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) { /* The file open succeeds */ @@ -7455,7 +7455,7 @@ test_libver_bounds_attributes(hid_t fapl) { ret = H5Pset_libver_bounds(new_fapl, low, high); } - H5E_END_TRY; + H5E_END_TRY if (ret < 0) /* Invalid low/high combinations */ continue; @@ -7465,7 +7465,7 @@ test_libver_bounds_attributes(hid_t fapl) { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) { /* The file open succeeds */ @@ -7622,7 +7622,7 @@ test_libver_macros2(void) { grp = H5Gopen(file, "Group"); } - H5E_END_TRY; + H5E_END_TRY VERIFY(grp, FAIL, "H5Gopen"); #endif @@ -7861,7 +7861,7 @@ test_min_dset_ohdr(void) { ret = H5Fset_dset_no_attrs_hint(-1, TRUE); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Fset_dset_no_attrs_hint"); /* trying to get with invalid file ID */ @@ -7869,7 +7869,7 @@ test_min_dset_ohdr(void) { ret = H5Fget_dset_no_attrs_hint(-1, &minimize); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint"); /* trying to get with invalid pointer */ @@ -7877,7 +7877,7 @@ test_min_dset_ohdr(void) { ret = H5Fget_dset_no_attrs_hint(file_id, NULL); } - H5E_END_TRY; + H5E_END_TRY VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint"); /************/ @@ -8243,5 +8243,5 @@ cleanup_file(void) H5Fdelete(FILE7, H5P_DEFAULT); H5Fdelete(DST_FILE, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY } |