Skip to content

Commit

Permalink
Fixed -Wself-assign warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
seanm committed Feb 27, 2021
1 parent 1dd64ac commit f0ff3e8
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 30 deletions.
2 changes: 1 addition & 1 deletion examples/h5_attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata)
float * float_array; /* Pointer to the array attribute. */

/* avoid warnings */
opdata = opdata;
(void)opdata;

/*
* Open the attribute using its name.
Expand Down
10 changes: 5 additions & 5 deletions examples/h5_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ static herr_t
file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata)
{
/* avoid compiler warnings */
loc_id = loc_id;
opdata = opdata;
linfo = linfo;
(void)loc_id;
(void)opdata;
(void)linfo;

/*
* Display group name. The name is passed to the function by
Expand All @@ -198,8 +198,8 @@ group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdat
int rank_chunk;

/* avoid warnings */
opdata = opdata;
linfo = linfo;
(void)opdata;
(void)linfo;

/*
* Open the datasets using their names.
Expand Down
5 changes: 5 additions & 0 deletions hl/src/H5IM.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ find_palette(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const
if (name == NULL)
return -1;

/* Shut compiler up */
(void)loc_id;
(void)ainfo;
(void)op_data;

/* Define a positive value for return value if the attribute was found. This will
* cause the iterator to immediately return that positive value,
* indicating short-circuit success
Expand Down
8 changes: 8 additions & 0 deletions hl/src/H5LT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,10 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const
if (name == NULL)
return ret;

/* Shut the compiler up */
(void)loc_id;
(void)linfo;

/* Define a positive value for return value if the dataset was found. This will
* cause the iterator to immediately return that positive value,
* indicating short-circuit success
Expand Down Expand Up @@ -1847,6 +1851,10 @@ find_attr(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const H5
if (name == NULL)
return H5_ITER_CONT;

/* Shut compiler up */
(void)loc_id;
(void)ainfo;

/* Define a positive value for return value if the attribute was found. This will
* cause the iterator to immediately return that positive value,
* indicating short-circuit success
Expand Down
24 changes: 12 additions & 12 deletions hl/test/test_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -3554,9 +3554,9 @@ verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
int ret = 0;

/* unused */
dset = dset;
dim = dim;
visitor_data = visitor_data;
(void)dset;
(void)dim;
(void)visitor_data;

/* define a positive value for return value. This will cause the iterator to
immediately return that positive value, indicating short-circuit success
Expand Down Expand Up @@ -3602,8 +3602,8 @@ read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
char * data = (char *)visitor_data;

/* unused */
dset = dset;
dim = dim;
(void)dset;
(void)dim;

/* get space */
if ((sid = H5Dget_space(scale_id)) < 0)
Expand Down Expand Up @@ -3691,7 +3691,7 @@ match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data)
hsize_t storage_size;

/* Stop compiler from whining about "unused parameters" */
visitor_data = visitor_data;
(void)visitor_data;

/*-------------------------------------------------------------------------
* get DID (dataset) space info
Expand Down Expand Up @@ -3766,9 +3766,9 @@ static herr_t
op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* Stop compiler from whining about "unused parameters" */
dset = dset;
dim = dim;
scale_id = scale_id;
(void)dset;
(void)dim;
(void)scale_id;

if (visitor_data != NULL) {
(*(int *)visitor_data)++;
Expand Down Expand Up @@ -3799,9 +3799,9 @@ static herr_t
op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* Stop compiler from whining about "unused parameters" */
dset = dset;
dim = dim;
scale_id = scale_id;
(void)dset;
(void)dim;
(void)scale_id;

if (visitor_data != NULL) {
(*(int *)visitor_data)++;
Expand Down
8 changes: 4 additions & 4 deletions test/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -27297,7 +27297,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)

/* Fill out the rest of the cache with entries */
/* Verify expected status of entries after each insertion */
for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) {
for ( ; entry_idx < 50; entry_idx++) {

if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
Expand Down Expand Up @@ -27431,7 +27431,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* After each insertion, verify the expected status of the
* entries in the cache.
*/
for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) {
for ( ; entry_idx < 100; entry_idx++) {

if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
Expand Down Expand Up @@ -33243,7 +33243,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)

/* Fill out the rest of the cache with entries */
/* Verify expected status of entries after each insertion */
for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) {
for ( ; entry_idx < 50; entry_idx++) {

if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
Expand Down Expand Up @@ -33304,7 +33304,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
if (pass) {

/* Insert 50 more entries (indices 50-99) into the cache. */
for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) {
for ( ; entry_idx < 100; entry_idx++) {

if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
Expand Down
2 changes: 1 addition & 1 deletion test/filter_plugin2_dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_valu
return 0;

/* Assignment to eliminate unused parameter warning */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) {
/* READ - Divide the original value by MULTIPLIER */
Expand Down
2 changes: 1 addition & 1 deletion test/filter_plugin4_groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ append_to_group_name(unsigned int flags, size_t cd_nelmts, const unsigned int *c
return 0;

/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) {
/* READ - Remove the suffix from the group name */
Expand Down
2 changes: 1 addition & 1 deletion test/ros3.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ test_vfd_open(void)
if (T.which_fapl == FAPL_FILE_ACCESS)
_fapl_id = fapl_file_access;
else if (T.which_fapl == FAPL_ROS3_ANON)
_fapl_id = fapl_id;
_fapl_id = fapl_id;

H5E_BEGIN_TRY { fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr); }
H5E_END_TRY;
Expand Down
2 changes: 1 addition & 1 deletion tools/test/h5copy/dynlib_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd
return (0);

/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
Expand Down
2 changes: 1 addition & 1 deletion tools/test/h5diff/dynlib_diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd
return (0);

/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
Expand Down
2 changes: 1 addition & 1 deletion tools/test/h5dump/dynlib_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd
return (0);

/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
Expand Down
2 changes: 1 addition & 1 deletion tools/test/h5dump/h5dumpgentest.c
Original file line number Diff line number Diff line change
Expand Up @@ -10921,7 +10921,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd
return (0);

/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
Expand Down
2 changes: 1 addition & 1 deletion tools/test/h5ls/dynlib_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd
return (0);

/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
(void)cd_values;

if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
Expand Down

0 comments on commit f0ff3e8

Please sign in to comment.