Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various clang warning fixes #3050

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/nctestserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int timedping(const char* url, long timeout);
static char**
parseServers(const char* remotetestservers)
{
char* rts;
char* rts = NULL;
char** servers = NULL;
char** list = NULL;
char* p;
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/dcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ NC_copy_att(int ncid_in, int varid_in, const char *name,
{
/* Copy arbitrary attributes. */
int class;
size_t size;
size_t size = 0;
nc_type xtype_out = NC_NAT;

if(xtype <= NC_MAX_ATOMIC_TYPE) {
Expand Down
2 changes: 2 additions & 0 deletions libdispatch/dplugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ nc_plugin_path_initialize(void)
int stat = NC_NOERR;
struct NCglobalstate* gs = NULL;
NCPluginList dirs = {0,NULL};
#ifdef USE_HDF5
int hdf5found = 0; /* 1 => we got a legit plugin path set from HDF5 */
#endif

if(!NC_initialized) nc_initialize();
if(NC_plugin_path_initialized != 0) goto done;
Expand Down
2 changes: 2 additions & 0 deletions libdispatch/ncexhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ exhashlocate(NCexhashmap* map, ncexhashkey_t hkey, NCexleaf** leafp, int* indexp
/* Is there room in the leaf to add an entry? */
#if DEBUG >= 3
fprintf(stderr,"locate: iter=%d offset=%x leaf=(%d)%p active=%d\n",iter,offset,leaf->uid,leaf,(int)leaf->active);
#else
(void)iter;
#endif
if(leaf->active < map->leaflen) break; /* yes, there is room */
/* Not Enough room, so we need to split this leaf */
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/ncjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,5 +1140,5 @@ netcdf_supresswarnings(void)
ignore = (void*)NCJtotext;
ignore = (void*)NCJinsertstring;
ignore = (void*)NCJinsertint;
ignore = ignore;
(void)ignore;
}
2 changes: 1 addition & 1 deletion libnczarr/zplugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ printhdf5(const NCZ_HDF5 h)
static void static_unused(void)
{
void* p = NULL;
p = p;
(void)p;
p = static_unused;
#if defined(DEBUGF) || defined(DEBUGL)
(void)printplugin(NULL);
Expand Down
1 change: 0 additions & 1 deletion nc_test/tst_diskless.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ printf("*** testing diskless file with scalar vars...");
size_t start[1] = {0};
size_t count[1] = {DIM1_LEN};

int i;
float float_data = 42.22F, float_data_in;


Expand Down
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
Loading