From 19dd940b224e0ed722e6a7e8db119fbb3363d923 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 17 Mar 2016 15:10:55 -0400 Subject: [PATCH 1/2] Fix pointer-bool-conversion warning on newer compiler versions. error: address of array 'lval->sym->name' will always evaluate to 'true' --- compiler/libpc300/sc3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/libpc300/sc3.c b/compiler/libpc300/sc3.c index 6cab3c54..1cc436ed 100755 --- a/compiler/libpc300/sc3.c +++ b/compiler/libpc300/sc3.c @@ -375,11 +375,11 @@ static int skim(int *opstr,void (*testfunc)(int),int dropval,int endval, } /* if */ dropout(lvalue,testfunc,droplab,lval); if (!lvalue && sc_intest && (lval->ident==iARRAY || lval->ident==iREFARRAY)) { - error(33, lval->sym ? (lval->sym->name ? lval->sym->name : "-unknown") : "-unknown-"); /* array was not indexed in an expression */ + error(33, lval->sym ? lval->sym->name : "-unknown-"); /* array was not indexed in an expression */ } } else if (hits) { /* no (more) identical operators */ if (!lvalue && sc_intest && (lval->ident==iARRAY || lval->ident==iREFARRAY)) { - error(33, lval->sym ? (lval->sym->name ? lval->sym->name : "-unknown") : "-unknown-"); /* array was not indexed in an expression */ + error(33, lval->sym ? lval->sym->name : "-unknown-"); /* array was not indexed in an expression */ } dropout(lvalue,testfunc,droplab,lval); /* found at least one operator! */ ldconst(endval,sPRI); From 79a6dc9501447a19181ed47e1807977b9e9ccbd8 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 17 Mar 2016 15:12:26 -0400 Subject: [PATCH 2/2] Fix shift-negative-value warning on newer compiler versions. error: shifting a negative signed value is undefined --- compiler/libpc300/sc1.c | 2 +- compiler/libpc300/sc3.c | 2 +- third_party/zlib/inflate.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 9fe5f005..f261d642 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -1456,7 +1456,7 @@ static void setconstants(void) #endif add_constant("charbits",sCHARBITS,sGLOBAL,0); add_constant("charmin",0,sGLOBAL,0); - add_constant("charmax",~(-1 << sCHARBITS) - 1,sGLOBAL,0); + add_constant("charmax",~(-1UL << sCHARBITS) - 1,sGLOBAL,0); add_constant("ucharmax",(1 << (sizeof(cell)-1)*8)-1,sGLOBAL,0); add_constant("__Pawn",VERSION_INT,sGLOBAL,0); diff --git a/compiler/libpc300/sc3.c b/compiler/libpc300/sc3.c index 1cc436ed..e7bc320f 100755 --- a/compiler/libpc300/sc3.c +++ b/compiler/libpc300/sc3.c @@ -749,7 +749,7 @@ static int hier14(value *lval1) * negative value would do). */ for (i=0; iarrayidx; /* save current pointer, to reset later */ if (lval1->arrayidx==NULL) lval1->arrayidx=arrayidx1; diff --git a/third_party/zlib/inflate.c b/third_party/zlib/inflate.c index 870f89bb..2f78dc49 100644 --- a/third_party/zlib/inflate.c +++ b/third_party/zlib/inflate.c @@ -1504,7 +1504,7 @@ z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + if (strm == Z_NULL || strm->state == Z_NULL) return -1UL << 16; state = (struct inflate_state FAR *)strm->state; return ((long)(state->back) << 16) + (state->mode == COPY ? state->length :