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 /hl | |
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 'hl')
-rw-r--r-- | hl/c++/test/ptableTest.cpp | 6 | ||||
-rw-r--r-- | hl/src/H5DS.c | 24 | ||||
-rw-r--r-- | hl/src/H5LD.c | 7 | ||||
-rw-r--r-- | hl/src/H5LT.c | 16 | ||||
-rw-r--r-- | hl/test/gen_test_ds.c | 10 | ||||
-rw-r--r-- | hl/test/test_ds.c | 50 | ||||
-rw-r--r-- | hl/test/test_dset_append.c | 16 | ||||
-rw-r--r-- | hl/test/test_file_image.c | 10 | ||||
-rw-r--r-- | hl/test/test_h5do_compat.c | 4 | ||||
-rw-r--r-- | hl/test/test_image.c | 6 | ||||
-rw-r--r-- | hl/test/test_ld.c | 20 | ||||
-rw-r--r-- | hl/test/test_table.c | 2 |
12 files changed, 83 insertions, 88 deletions
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 1807be6..2a77a9e 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -194,7 +194,7 @@ error: { H5Tclose(dtypeID); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return 1; @@ -576,7 +576,7 @@ error: H5Tclose(dtypeID1); H5Tclose(dtypeID2); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return 1; @@ -708,7 +708,7 @@ error: H5Tclose(compound_type); H5Fclose(fileID); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return 1; diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 34de473..87973fa 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -697,7 +697,7 @@ out: H5Tclose(ntid); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -1198,7 +1198,7 @@ out: buf = NULL; } } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -1538,7 +1538,7 @@ out: H5Tclose(tid); H5Tclose(ntid); } - H5E_END_TRY; + H5E_END_TRY if (buf) { HDfree(buf); @@ -1700,7 +1700,7 @@ H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx, H5DS_iterate_t visi if ((scale_id = H5Ropen_object(&nref, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; } - H5E_END_TRY; + H5E_END_TRY } else { /* get the reference */ @@ -1713,7 +1713,7 @@ H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx, H5DS_iterate_t visi if ((scale_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0) goto out; } - H5E_END_TRY; + H5E_END_TRY } /* set the return IDX OUT value at current scale index */ @@ -1765,7 +1765,7 @@ out: H5Aclose(aid); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -1965,7 +1965,7 @@ out: H5Aclose(aid); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -2113,7 +2113,7 @@ out: H5Aclose(aid); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -2231,7 +2231,7 @@ out: H5Tclose(tid); H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY if (buf) HDfree(buf); return FAIL; @@ -2343,7 +2343,7 @@ out: H5Aclose(aid); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY } return is_ds; } @@ -2460,7 +2460,7 @@ out: H5Aclose(aid); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY if (buf) HDfree(buf); @@ -2539,7 +2539,7 @@ error: H5Tclose(tid); H5Aclose(aid); } - H5E_END_TRY; + H5E_END_TRY HDfree(buf); diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c index 30257f6..65a15e3 100644 --- a/hl/src/H5LD.c +++ b/hl/src/H5LD.c @@ -194,8 +194,7 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[] /*OUT*/, hid_t par_tid) switch (*fields_ptr) { case '\0': /* end of list */ if (gotmember) { /* getting something and end of "fields" */ - *cur++ = '\0'; - ; + *cur++ = '\0'; memb->names[++j] = NULL; } /* end if */ else /* getting nothing but end of list */ @@ -215,7 +214,6 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[] /*OUT*/, hid_t par_tid) case '.': /* nested field separator */ *fields_ptr++ = *cur++ = '\0'; - ; if (gotmember) { memb->names[++j] = cur; gotmember = FALSE; @@ -226,7 +224,6 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[] /*OUT*/, hid_t par_tid) case ',': /* field separator */ *fields_ptr++ = *cur++ = '\0'; - ; if (gotmember) { memb->names[++j] = NULL; gotmember = FALSE; @@ -308,7 +305,7 @@ done: { H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return (ret_value); } /* H5LD_get_dset_dims() */ diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 4c61aa8..657e562 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -535,7 +535,7 @@ out: H5Dclose(did); H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return -1; } @@ -772,7 +772,7 @@ out: H5Tclose(tid); H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return -1; } @@ -886,7 +886,7 @@ out: { H5Pclose(fapl); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* end H5LTopen_file_image() */ @@ -1121,7 +1121,7 @@ out: H5Dclose(did); H5Tclose(tid); } - H5E_END_TRY; + H5E_END_TRY return -1; } @@ -1177,7 +1177,7 @@ out: H5Dclose(did); H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return -1; } @@ -1254,7 +1254,7 @@ out: H5Sclose(sid); H5Dclose(did); } - H5E_END_TRY; + H5E_END_TRY return -1; } @@ -1898,7 +1898,6 @@ H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_nam /* End access to the attribute */ if (H5Aclose(attr_id)) goto out; - ; /* Close the object */ if (H5Oclose(obj_id) < 0) @@ -3405,7 +3404,6 @@ H5LT_get_attribute_disk(hid_t loc_id, const char *attr_name, void *attr_out) if (H5Aclose(attr_id) < 0) return -1; - ; return 0; @@ -3493,7 +3491,7 @@ out: H5Tclose(tid); H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index e0a3499..7b45694 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -336,7 +336,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -400,7 +400,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -480,7 +480,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -561,7 +561,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -609,7 +609,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 70af31a..9792441 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1331,7 +1331,7 @@ out: H5Dclose(dsid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1387,7 +1387,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1467,7 +1467,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1531,7 +1531,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1591,7 +1591,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1651,7 +1651,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1715,7 +1715,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1798,7 +1798,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1862,7 +1862,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -1974,7 +1974,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -2054,7 +2054,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -2126,7 +2126,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -2198,7 +2198,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -2278,7 +2278,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -2327,7 +2327,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); @@ -3530,7 +3530,7 @@ out: H5Sclose(sid); H5Gclose(gid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -3664,7 +3664,7 @@ out: HDfree(buf); } } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -3749,7 +3749,7 @@ out: { H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } @@ -4189,7 +4189,7 @@ out: H5Gclose(gid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -4374,7 +4374,7 @@ out: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -4583,7 +4583,7 @@ out: H5Sclose(sid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -4762,7 +4762,7 @@ out: H5Dclose(dsid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -4920,7 +4920,7 @@ out: H5Dclose(dsid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); if (latbuf) @@ -5187,7 +5187,7 @@ out: H5Dclose(dsid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -5428,7 +5428,7 @@ out: H5Gclose(gid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index c4afe89..b287d25 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -122,7 +122,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_notset() */ @@ -296,7 +296,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_rows_columns() */ @@ -432,7 +432,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_rows() */ @@ -569,7 +569,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_columns() */ @@ -732,7 +732,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_BUG1() */ @@ -895,7 +895,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_BUG2() */ @@ -1054,7 +1054,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_less() */ @@ -1211,7 +1211,7 @@ error: H5Dclose(did); H5Pclose(ffapl); } - H5E_END_TRY; + H5E_END_TRY return 1; } /* test_dataset_append_vary() */ diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index defaab2..0a10e36 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -335,7 +335,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) { status1 = H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); } - H5E_END_TRY; + H5E_END_TRY VERIFY(status1 < 0, "H5Dwrite() should have failed"); @@ -344,7 +344,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) { status1 = H5Dset_extent(dset_id[i], dims4); } - H5E_END_TRY; + H5E_END_TRY VERIFY(status1 < 0, "H5Dset_extent() should have failed"); @@ -353,7 +353,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) { status1 = H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data4); } - H5E_END_TRY; + H5E_END_TRY VERIFY(status1 < 0, "H5Dwrite() should have failed"); @@ -408,13 +408,13 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) status2 = H5Fflush(file_id[i], H5F_SCOPE_GLOBAL); VERIFY(status1 < 0 || status2 < 0, "writing and flushing attr should have failed"); - } H5E_END_TRY; + } H5E_END_TRY /* close attr and attr_space -- expect errors on close */ H5E_BEGIN_TRY { H5Sclose(attr_space_id); H5Aclose(attr_id); - } H5E_END_TRY; + } H5E_END_TRY #endif if (H5Dclose(dset_id[i]) < 0) FAIL_PUTS_ERROR("H5Dclose() failed"); diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c index 4a3c607..2610c33 100644 --- a/hl/test/test_h5do_compat.c +++ b/hl/test/test_h5do_compat.c @@ -84,7 +84,7 @@ error: H5Sclose(sid); H5Pclose(dcpl_id); } - H5E_END_TRY; + H5E_END_TRY return H5I_INVALID_HID; @@ -223,7 +223,7 @@ error: H5Sclose(mem_sid); H5Sclose(file_sid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return 1; diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 462a3ce..8a67883 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -304,7 +304,7 @@ out: { H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; } @@ -494,7 +494,7 @@ out: { H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY H5_FAILED(); return FAIL; @@ -730,7 +730,7 @@ out: { H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY if (f) HDfclose(f); H5_FAILED(); diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index 11ea0e6..b056225 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -255,7 +255,7 @@ test_LD_dims_params(const char *file) { ret = H5LDget_dset_dims(invalid_id, one_cur_dims); } - H5E_END_TRY; + H5E_END_TRY VERIFY_EQUAL(ret, FAIL) /* @@ -267,7 +267,7 @@ test_LD_dims_params(const char *file) { ret = H5LDget_dset_dims(did, NULL); } - H5E_END_TRY; + H5E_END_TRY VERIFY_EQUAL(ret, FAIL) if (H5Dclose(did) < 0) FAIL_STACK_ERROR; @@ -336,7 +336,7 @@ error: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return (-1); } /* test_LD_dims_params() */ @@ -481,7 +481,7 @@ error: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return (-1); } /* test_LD_dims() */ @@ -545,7 +545,7 @@ test_LD_size(const char *file) { dsize = H5LDget_dset_type_size(invalid_id, NULL); } - H5E_END_TRY; + H5E_END_TRY VERIFY_EQUAL(dsize, 0) /* @@ -822,7 +822,7 @@ error: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return (-1); } /* test_LD_size() */ @@ -928,7 +928,7 @@ test_LD_elmts_invalid(const char *file) { ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); } - H5E_END_TRY; + H5E_END_TRY VERIFY_EQUAL(ret, FAIL) /* Open dataset: DSET_CMPD */ @@ -964,7 +964,7 @@ error: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return (-1); } /* test_LD_elmts_invalid() */ @@ -1122,7 +1122,7 @@ error: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return (-1); } /* test_LD_elmts_one() */ @@ -1336,7 +1336,7 @@ error: H5Dclose(did); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return (-1); } /* test_LD_elmts_two() */ diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 3c8246a..7bef41d 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -823,7 +823,7 @@ test_table(hid_t fid, int do_write) nrecords = 3; if (H5TBdelete_record(fid, "table", start, nrecords) < 0) goto out; - ; + /* Get table info */ if (H5TBget_table_info(fid, "table", &nfields_out, &nrecords_out) < 0) goto out; |