Skip to content

Commit

Permalink
1.12 TRILAB-266: Remove clang warnings. (#1193)
Browse files Browse the repository at this point in the history
* TRILAB-266: Remove clang warnings in src/H5Zscaleoffset.c. (PR #1105)

* Committing clang-format changes

* TRILAB-266: Remove clang warnings in H5private.h and uthash.h. (PR #1124)

* TRILAB-266: Remove clang warnings in H5FDcore.c. (PR #1127)

* Committing clang-format changes

* TRILAB-266: Remove clang warnings in test/testmeta.c. (PR #1135)

* TRILAB-266: Remove clang warnings in test/swmr.c. (PR #1136)

* TRILAB-266: Remove clang warnings in test/cork.c. (PR #1137)

* Committing clang-format changes

* TRILAB-266: Remove clang warnings in test/cork.c. (PR #1146)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
hyoklee and github-actions[bot] authored Nov 13, 2021
1 parent 7091057 commit 899636e
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 108 deletions.
6 changes: 3 additions & 3 deletions src/H5FDcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
"write to backing store failed: time = %s, filename = '%s', file descriptor = %d, "
"errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this "
"sub-write = %llu, bytes actually written = %llu, offset = %llu",
HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr,
HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), (void *)ptr,
(unsigned long long)size, (unsigned long long)bytes_in,
(unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
Expand Down Expand Up @@ -916,8 +916,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
"file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
"error message = '%s', file->mem = %p, total read size = %llu, bytes this "
"sub-read = %llu, bytes actually read = %llu, offset = %llu",
HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem,
(unsigned long long)size, (unsigned long long)bytes_in,
HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno),
(void *)file->mem, (unsigned long long)size, (unsigned long long)bytes_in,
(unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */

Expand Down
66 changes: 33 additions & 33 deletions src/H5Zscaleoffset.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@
#define H5_ATTR_NORETURN __attribute__((noreturn))
#define H5_ATTR_CONST __attribute__((const))
#define H5_ATTR_PURE __attribute__((pure))
#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
#if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
#define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
#define H5_ATTR_FALLTHROUGH /*void*/
#define H5_ATTR_FALLTHROUGH /* FALLTHROUGH */
#endif
#else
#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
Expand Down
30 changes: 20 additions & 10 deletions src/uthash.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,25 +714,35 @@ typedef unsigned char uint8_t;
hashv += (unsigned)(keylen); \
switch (_hj_k) { \
case 11: \
hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \
hashv += ((unsigned)_hj_key[10] << 24); \
H5_ATTR_FALLTHROUGH \
case 10: \
hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \
hashv += ((unsigned)_hj_key[9] << 16); \
H5_ATTR_FALLTHROUGH \
case 9: \
hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \
hashv += ((unsigned)_hj_key[8] << 8); \
H5_ATTR_FALLTHROUGH \
case 8: \
_hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \
_hj_j += ((unsigned)_hj_key[7] << 24); \
H5_ATTR_FALLTHROUGH \
case 7: \
_hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \
_hj_j += ((unsigned)_hj_key[6] << 16); \
H5_ATTR_FALLTHROUGH \
case 6: \
_hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \
_hj_j += ((unsigned)_hj_key[5] << 8); \
H5_ATTR_FALLTHROUGH \
case 5: \
_hj_j += _hj_key[4]; /* FALLTHROUGH */ \
_hj_j += _hj_key[4]; \
H5_ATTR_FALLTHROUGH \
case 4: \
_hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \
_hj_i += ((unsigned)_hj_key[3] << 24); \
H5_ATTR_FALLTHROUGH \
case 3: \
_hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \
_hj_i += ((unsigned)_hj_key[2] << 16); \
H5_ATTR_FALLTHROUGH \
case 2: \
_hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \
_hj_i += ((unsigned)_hj_key[1] << 8); \
H5_ATTR_FALLTHROUGH \
case 1: \
_hj_i += _hj_key[0]; \
} \
Expand Down
109 changes: 55 additions & 54 deletions test/cork.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ static unsigned
verify_old_dset_cork(void)
{
/* Variable Declarations */
hid_t fid = -1; /* File ID */
hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
hid_t dcpl = -1, dcpl2 = -1, dcpl3 = -1; /* Dataset creation property lists */
hid_t sid = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t did = H5I_INVALID_HID, did2 = H5I_INVALID_HID, did3 = H5I_INVALID_HID; /* Dataset IDs */
hid_t dcpl = H5I_INVALID_HID, dcpl2 = H5I_INVALID_HID,
dcpl3 = H5I_INVALID_HID; /* Dataset creation property lists */
hid_t sid = H5I_INVALID_HID, sid2 = H5I_INVALID_HID, sid3 = H5I_INVALID_HID; /* Dataspace IDs */
hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
Expand Down Expand Up @@ -295,19 +296,19 @@ static unsigned
verify_obj_dset_cork(hbool_t swmr)
{
/* Variable Declarations */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t aid = -1; /* Attribute ID */
hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
hid_t did = -1, did2 = -1; /* Dataset IDs */
hid_t oid = -1; /* Object ID */
hid_t dcpl2; /* Dataset creation property list */
int i = 0; /* Local index variable */
hsize_t dim[1] = {100}; /* Dataset dimension size */
hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */
H5O_info2_t oinfo, oinfo2; /* Object metadata information */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
hid_t aid = H5I_INVALID_HID; /* Attribute ID */
hid_t sid = H5I_INVALID_HID, sid2 = H5I_INVALID_HID; /* Dataspace IDs */
hid_t did = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* Dataset IDs */
hid_t oid = H5I_INVALID_HID; /* Object ID */
hid_t dcpl2 = H5I_INVALID_HID; /* Dataset creation property list */
int i = 0; /* Local index variable */
hsize_t dim[1] = {100}; /* Dataset dimension size */
hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */
H5O_info2_t oinfo, oinfo2; /* Object metadata information */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */

if (swmr) {
TESTING("cork status for dataset objects with attributes (SWMR)");
Expand Down Expand Up @@ -500,11 +501,11 @@ static unsigned
verify_dset_cork(hbool_t swmr, hbool_t new_format)
{
/* Variable Declarations */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
hid_t dcpl = -1; /* Dataset creation property list */
hid_t sid = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
hid_t did = H5I_INVALID_HID, did2 = H5I_INVALID_HID, did3 = H5I_INVALID_HID; /* Dataset IDs */
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hid_t sid = H5I_INVALID_HID, sid2 = H5I_INVALID_HID, sid3 = H5I_INVALID_HID; /* Dataspace IDs */
hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
Expand Down Expand Up @@ -758,15 +759,15 @@ static unsigned
verify_group_cork(hbool_t swmr)
{
/* Variable Declarations */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */
H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
hid_t aid; /* Attribute ID */
hid_t sid; /* Dataspace ID */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */
int i = 0; /* Local index variable */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
hid_t gid = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID; /* Group IDs */
H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
hid_t aid = H5I_INVALID_HID; /* Attribute ID */
hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */
int i = 0; /* Local index variable */

/* Testing Macro */
if (swmr) {
Expand Down Expand Up @@ -927,17 +928,17 @@ static unsigned
verify_named_cork(hbool_t swmr)
{
/* Variable Declarations */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */
hid_t gid = -1, gid2 = -1; /* Group IDs */
H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */
hid_t aid = -1; /* Attribute ID */
hid_t sid; /* Dataspace ID */
hid_t did; /* Dataset ID */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */
int i = 0; /* Local index variable */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
hid_t tid = H5I_INVALID_HID, tid2 = H5I_INVALID_HID, tid3 = H5I_INVALID_HID; /* Datatype IDs */
hid_t gid = H5I_INVALID_HID, gid2 = H5I_INVALID_HID; /* Group IDs */
H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */
hid_t aid = H5I_INVALID_HID; /* Attribute ID */
hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
hid_t did = H5I_INVALID_HID; /* Dataset ID */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */
int i = 0; /* Local index variable */

/* Testing Macro */
if (swmr) {
Expand Down Expand Up @@ -1880,18 +1881,18 @@ test_objs_cork(hbool_t swmr, hbool_t new_format)
static unsigned
test_dset_cork(hbool_t swmr, hbool_t new_format)
{
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
hid_t gid; /* Groupd ID */
hid_t did1, did2; /* Dataset IDs */
hid_t tid1, tid2; /* Datatype IDs */
hid_t sid; /* Dataspace ID */
hid_t dcpl; /* Dataset creation property list */
hsize_t dims[RANK]; /* Dataset dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dataset dimensions */
hsize_t cdims[RANK] = {2, 2}; /* Chunk dimensions */
int fillval = 0; /* Fill value */
int i, j, k = 0; /* Local index variables */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
hid_t gid = H5I_INVALID_HID; /* Groupd ID */
hid_t did1 = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* Dataset IDs */
hid_t tid1 = H5I_INVALID_HID, tid2 = H5I_INVALID_HID; /* Datatype IDs */
hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[RANK]; /* Dataset dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dataset dimensions */
hsize_t cdims[RANK] = {2, 2}; /* Chunk dimensions */
int fillval = 0; /* Fill value */
int i, j, k = 0; /* Local index variables */
int ** wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */
int * wbuf_data = NULL; /* Data buffer for writes (real data) */
int * rbuf_data = NULL; /* Data buffer for reads (real data) */
Expand Down
4 changes: 2 additions & 2 deletions test/swmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5220,7 +5220,7 @@ test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl)
static int
test_file_lock_swmr_concur(hid_t in_fapl)
{
hid_t fid; /* File ID */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl; /* File access property list */
char filename[NAME_BUF_SIZE]; /* file name */
pid_t childpid = 0; /* Child process ID */
Expand Down Expand Up @@ -6721,7 +6721,7 @@ test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
static int
test_refresh_concur(hid_t in_fapl, hbool_t new_format)
{
hid_t fid; /* File ID */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl; /* File access property list */
pid_t childpid = 0; /* Child process ID */
pid_t tmppid; /* Child process ID returned by waitpid */
Expand Down
2 changes: 1 addition & 1 deletion test/testmeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ main(void)

start[0] = 0;
status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL);
start[0] = (hssize_t)j;
start[0] = (hsize_t)j;
status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL);
status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval);
if (status < 0) {
Expand Down
6 changes: 3 additions & 3 deletions test/tvlstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ test_vlstrings_special(void)
/* Check data read in */
for (i = 0; i < SPACE1_DIM1; i++)
if (rdata[i] != NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)i, rdata[i]);
TestErrPrintf("VL doesn't match!, rdata[%d]=%s\n", (int)i, rdata[i]);

/* Write dataset to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
Expand Down Expand Up @@ -352,7 +352,7 @@ test_vlstrings_special(void)
/* Check data read in */
for (i = 0; i < SPACE1_DIM1; i++)
if (rdata[i] != NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)i, rdata[i]);
TestErrPrintf("VL doesn't match!, rdata[%d]=%s\n", (int)i, rdata[i]);

/* Try to write nil strings to disk. */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
Expand All @@ -365,7 +365,7 @@ test_vlstrings_special(void)
/* Check data read in */
for (i = 0; i < SPACE1_DIM1; i++)
if (rdata[i] != NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)i, rdata[i]);
TestErrPrintf("VL doesn't match!, rdata[%d]=%s\n", (int)i, rdata[i]);

/* Close Dataset */
ret = H5Dclose(dataset);
Expand Down

0 comments on commit 899636e

Please sign in to comment.