Merge branch 'fix-warnings' of https://github.com/mathstuf/netcdf-c into pr-aggregation.wif

This commit is contained in:
Ward Fisher 2019-02-06 14:07:29 -07:00
commit 67086ccd66
9 changed files with 49 additions and 6 deletions

View File

@ -89,4 +89,8 @@ typedef unsigned short ushort;
typedef unsigned int uint;
#endif
#ifndef NC_UNUSED
#define NC_UNUSED(var) (void)var
#endif
#endif /* NCCONFIGURE_H */

View File

@ -102,6 +102,11 @@ int nc_create_par(const char *path, int cmode, MPI_Comm comm,
MPI_Info info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(cmode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
NC_MPI_INFO data;
@ -201,6 +206,11 @@ nc_open_par(const char *path, int omode, MPI_Comm comm,
MPI_Info info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(omode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
NC_MPI_INFO mpi_data;
@ -249,6 +259,11 @@ nc_open_par_fortran(const char *path, int omode, int comm,
int info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(omode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
MPI_Comm comm_c;
@ -348,6 +363,9 @@ int
nc_var_par_access(int ncid, int varid, int par_access)
{
#ifndef USE_PARALLEL
NC_UNUSED(ncid);
NC_UNUSED(varid);
NC_UNUSED(par_access);
return NC_ENOPAR;
#else
int stat = NC_NOERR;
@ -403,6 +421,11 @@ nc_create_par_fortran(const char *path, int cmode, int comm,
int info, int *ncidp)
{
#ifndef USE_PARALLEL
NC_UNUSED(path);
NC_UNUSED(cmode);
NC_UNUSED(comm);
NC_UNUSED(info);
NC_UNUSED(ncidp);
return NC_ENOPAR;
#else
MPI_Comm comm_c;

View File

@ -396,8 +396,8 @@ rcsearch(const char* prefix, const char* rcname, char** pathp)
{
char* path = NULL;
FILE* f = NULL;
int plen = strlen(prefix);
int rclen = strlen(rcname);
size_t plen = strlen(prefix);
size_t rclen = strlen(rcname);
int ret = NC_NOERR;
size_t pathlen = plen+rclen+1; /*+1 for '/' */

View File

@ -210,7 +210,7 @@ NC_mktmp(const char* base)
char spid[7];
if(rno < 0) rno = -rno;
snprintf(spid,sizeof(spid),"%06d",rno);
strncat(tmp,spid,sizeof(tmp));
strncat(tmp,spid,sizeof(tmp) - strlen(tmp) - 1);
}
#endif /* HAVE_MKTEMP */
#ifdef _MSC_VER

View File

@ -213,6 +213,7 @@ Each line will be sent using nclog with the specified tag.
void
nclogtextn(int tag, const char* text, size_t count)
{
NC_UNUSED(tag);
if(!nclogging || nclogstream == NULL) return;
fwrite(text,1,count,nclogstream);
fflush(nclogstream);

View File

@ -23,6 +23,7 @@
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "ncconfigure.h"
#include "nctime.h"
static int cuErrOpts; /* Error options */
@ -309,7 +310,7 @@ cdParseRelunits(cdCalenType timetype, char* relunits, cdUnitTime* unit, cdCompTi
char charunits[CD_MAX_RELUNITS];
char basetime_1[CD_MAX_CHARTIME];
char basetime_2[CD_MAX_CHARTIME];
char basetime[CD_MAX_CHARTIME];
char basetime[2 * CD_MAX_CHARTIME + 1];
int nconv1, nconv2, nconv;
/* Parse the relunits */
@ -659,6 +660,7 @@ Cdh2e(CdTime *htime, double *etime)
static int
cdValidateTime(cdCalenType timetype, cdCompTime comptime)
{
NC_UNUSED(timetype);
if(comptime.month<1 || comptime.month>12){
cdError("Error on time conversion: invalid month = %hd\n",comptime.month);
return 1;

View File

@ -67,7 +67,7 @@ static char* queryallow =
static char* userpwdallow =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!$&'()*+,-.;=_~?#/";
#ifndef HAVE_STRNCMP
#ifndef HAVE_STRNDUP
#define strndup ncstrndup
/* Not all systems have strndup, so provide one*/
char*
@ -258,7 +258,7 @@ ncuriparse(const char* uri0, NCURI** durip)
isfile = (strcmp(tmp.protocol,"file")==0);
if(isfile) {
int l = strlen(p); /* to test if we have enough characters */
size_t l = strlen(p); /* to test if we have enough characters */
hashost = 0; /* always */
if(l >= 2 && p[1] == ':' && strchr(DRIVELETTERS,p[0]) != NULL) { /* case 1 */
; /* p points to the start of the path */

View File

@ -184,7 +184,11 @@ blksize(int fd)
return 8192;
}
/* else, silent in the face of error */
#else
NC_UNUSED(fd);
#endif
#else
NC_UNUSED(fd);
#endif
return (size_t) 2 * pagesize();
}
@ -445,6 +449,7 @@ px_rel(ncio_px *const pxp, off_t offset, int rflags)
&& offset < pxp->bf_offset + (off_t) pxp->bf_extent);
assert(pIf(fIsSet(rflags, RGN_MODIFIED),
fIsSet(pxp->bf_rflags, RGN_WRITE)));
NC_UNUSED(offset);
if(fIsSet(rflags, RGN_MODIFIED))
{
@ -797,6 +802,7 @@ px_double_buffer(ncio *const nciop, off_t to, off_t from,
int status = NC_NOERR;
void *src;
void *dest;
NC_UNUSED(rflags);
#if INSTRUMENT
fprintf(stderr, "\tdouble_buffr %ld %ld %ld\n",
@ -1152,6 +1158,7 @@ ncio_spx_rel(ncio *const nciop, off_t offset, int rflags)
assert(offset < pxp->bf_offset + X_ALIGN);
assert(pxp->bf_cnt % X_ALIGN == 0 );
#endif
NC_UNUSED(offset);
if(fIsSet(rflags, RGN_MODIFIED))
{
@ -1400,6 +1407,7 @@ ncio_spx_move(ncio *const nciop, off_t to, off_t from,
static int
ncio_spx_sync(ncio *const nciop)
{
NC_UNUSED(nciop);
/* NOOP */
return NC_NOERR;
}
@ -1592,6 +1600,7 @@ posixio_create(const char *path, int ioflags,
int oflags = (O_RDWR|O_CREAT);
int fd;
int status;
NC_UNUSED(parameters);
if(initialsz < (size_t)igeto + igetsz)
initialsz = (size_t)igeto + igetsz;
@ -1736,6 +1745,7 @@ posixio_open(const char *path,
int oflags = fIsSet(ioflags, NC_WRITE) ? O_RDWR : O_RDONLY;
int fd = -1;
int status = 0;
NC_UNUSED(parameters);
if(path == NULL || *path == 0)
return EINVAL;

View File

@ -390,6 +390,9 @@ int
NC4_var_par_access(int ncid, int varid, int par_access)
{
#ifndef USE_PARALLEL4
NC_UNUSED(ncid);
NC_UNUSED(varid);
NC_UNUSED(par_access);
return NC_ENOPAR;
#else
NC *nc;