Skip to content

Commit

Permalink
Fixed various clang Wunused-but-set-variable warnings
Browse files Browse the repository at this point in the history
Mostly, this was dead code.

In some cases, the variable looked useful in debug, so I kept it but mark it unused by casting it to void.
  • Loading branch information
seanm committed Nov 16, 2024
1 parent f907cd3 commit 5a4040b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions ncdump/ncvalidator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2107,6 +2107,8 @@ val_NC_check_voff(NC *ncp)
prev_off = varp->begin + varp->len;
prev = i;
}

(void)nerrs;

return status;
}
Expand Down
3 changes: 0 additions & 3 deletions ncdump/vardata.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ vardata(
void *vals;

int id;
size_t nels;
size_t ncols;
int vrank = vp->ndims;

Expand All @@ -555,15 +554,13 @@ vardata(
edg = (size_t *) emalloc((size_t)(1 + vrank) * sizeof(size_t));
add = (size_t *) emalloc((size_t)(1 + vrank) * sizeof(size_t));

nels = 1;
if(vrank == 0) { /*scalar*/
cor[0] = 0;
edg[0] = 1;
} else {
for (id = 0; id < vrank; id++) {
cor[id] = 0;
edg[id] = 1;
nels *= vdims[id]; /* total number of values for variable */
}
}
printf("\n");
Expand Down
5 changes: 0 additions & 5 deletions ncgen/genbin.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,7 @@ genbin_writevar(Generator* generator, Symbol* vsym, Bytebuffer* memory,
int rank, size_t* start, size_t* count)
{
int stat = NC_NOERR;
int i;
char* data = bbContents(memory);
size_t nelems;

/* Compute total number of elements */
for(nelems=1,i=0;i<rank;i++) nelems *= count[i];

#ifdef GENDEBUG
{
Expand Down

0 comments on commit 5a4040b

Please sign in to comment.