Removed -Wno-parentheses from posix build and fixed warnings (bug 5745, r=psychonic).

This commit is contained in:
Kyle Sanderson 2013-07-18 15:50:57 -04:00
parent b96e0c8713
commit 29bc273e58
15 changed files with 64 additions and 68 deletions

View File

@ -10,7 +10,6 @@ for i in SM.sdkInfo:
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'game', 'shared')) compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'game', 'shared'))
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang': if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CFLAGS'].append('-Wno-parentheses')
compiler['CXXFLAGS'].append('-Wno-invalid-offsetof') compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
name = 'sdkhooks.ext.' + sdk['ext'] name = 'sdkhooks.ext.' + sdk['ext']

View File

@ -11,7 +11,6 @@ for i in SM.sdkInfo:
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86')) compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang': if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CFLAGS'].append('-Wno-parentheses')
compiler['CXXFLAGS'].append('-Wno-invalid-offsetof') compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
if i != 'ep1': if i != 'ep1':

View File

@ -157,9 +157,9 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
else if(!twoByte) else if(!twoByte)
{ {
if((opcode & 0xC4) == 0x00 || if((opcode & 0xC4) == 0x00 ||
(opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09) || ((opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09)) ||
(opcode & 0xF0) == 0x80 || (opcode & 0xF0) == 0x80 ||
(opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02 || ((opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02) ||
(opcode & 0xFC) == 0xD0 || (opcode & 0xFC) == 0xD0 ||
(opcode & 0xF6) == 0xF6) (opcode & 0xF6) == 0xF6)
{ {
@ -170,11 +170,11 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
} }
else else
{ {
if((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D || if(((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D) ||
(opcode & 0xF0) == 0x30 || (opcode & 0xF0) == 0x30 ||
opcode == 0x77 || opcode == 0x77 ||
(opcode & 0xF0) == 0x80 || (opcode & 0xF0) == 0x80 ||
(opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02 || ((opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02) ||
(opcode & 0xF8) == 0xC8) (opcode & 0xF8) == 0xC8)
{ {
// No mod R/M byte // No mod R/M byte
@ -250,7 +250,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
(opcode & 0xFE) == 0xD4 || // AAD/AAM (opcode & 0xFE) == 0xD4 || // AAD/AAM
(opcode & 0xF8) == 0xE0 || // LOOP/JCXZ (opcode & 0xF8) == 0xE0 || // LOOP/JCXZ
opcode == 0xEB || opcode == 0xEB ||
opcode == 0xF6 && (modRM & 0x30) == 0x00) // TEST (opcode == 0xF6 && (modRM & 0x30) == 0x00)) // TEST
{ {
if (dest) if (dest)
*dest++ = *func++; *dest++ = *func++;
@ -275,7 +275,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
(opcode & 0xFC) == 0xA0 || (opcode & 0xFC) == 0xA0 ||
(opcode & 0xEE) == 0xA8 || (opcode & 0xEE) == 0xA8 ||
opcode == 0xC7 || opcode == 0xC7 ||
opcode == 0xF7 && (modRM & 0x30) == 0x00) (opcode == 0xF7 && (modRM & 0x30) == 0x00))
{ {
if (dest) { if (dest) {
//Fix CALL/JMP offset //Fix CALL/JMP offset

View File

@ -3,8 +3,6 @@ import os
if 'ep2v' in SM.sdkInfo: if 'ep2v' in SM.sdkInfo:
sdk = SM.sdkInfo['ep2v'] sdk = SM.sdkInfo['ep2v']
compiler = SM.DefaultHL2Compiler('extensions/tf2', 'ep2v') compiler = SM.DefaultHL2Compiler('extensions/tf2', 'ep2v')
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CFLAGS'].append('-Wno-parentheses')
name = 'game.tf2.ext.' + sdk['ext'] name = 'game.tf2.ext.' + sdk['ext']
extension = AMBuild.AddJob(name) extension = AMBuild.AddJob(name)

View File

@ -157,9 +157,9 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
else if(!twoByte) else if(!twoByte)
{ {
if((opcode & 0xC4) == 0x00 || if((opcode & 0xC4) == 0x00 ||
(opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09) || ((opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09)) ||
(opcode & 0xF0) == 0x80 || (opcode & 0xF0) == 0x80 ||
(opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02 || ((opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02) ||
(opcode & 0xFC) == 0xD0 || (opcode & 0xFC) == 0xD0 ||
(opcode & 0xF6) == 0xF6) (opcode & 0xF6) == 0xF6)
{ {
@ -170,11 +170,11 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
} }
else else
{ {
if((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D || if(((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D) ||
(opcode & 0xF0) == 0x30 || (opcode & 0xF0) == 0x30 ||
opcode == 0x77 || opcode == 0x77 ||
(opcode & 0xF0) == 0x80 || (opcode & 0xF0) == 0x80 ||
(opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02 || ((opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02) ||
(opcode & 0xF8) == 0xC8) (opcode & 0xF8) == 0xC8)
{ {
// No mod R/M byte // No mod R/M byte
@ -250,7 +250,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
(opcode & 0xFE) == 0xD4 || // AAD/AAM (opcode & 0xFE) == 0xD4 || // AAD/AAM
(opcode & 0xF8) == 0xE0 || // LOOP/JCXZ (opcode & 0xF8) == 0xE0 || // LOOP/JCXZ
opcode == 0xEB || opcode == 0xEB ||
opcode == 0xF6 && (modRM & 0x30) == 0x00) // TEST (opcode == 0xF6 && (modRM & 0x30) == 0x00)) // TEST
{ {
if (dest) if (dest)
*dest++ = *func++; *dest++ = *func++;
@ -275,7 +275,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
(opcode & 0xFC) == 0xA0 || (opcode & 0xFC) == 0xA0 ||
(opcode & 0xEE) == 0xA8 || (opcode & 0xEE) == 0xA8 ||
opcode == 0xC7 || opcode == 0xC7 ||
opcode == 0xF7 && (modRM & 0x30) == 0x00) (opcode == 0xF7 && (modRM & 0x30) == 0x00))
{ {
if (dest) { if (dest) {
//Fix CALL/JMP offset //Fix CALL/JMP offset

View File

@ -8,7 +8,7 @@ compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'c
compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes')) compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes'))
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang': if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CFLAGS'].extend(['-Wno-parentheses', '-Wno-format']) compiler['CFLAGS'].append('-Wno-format')
if AMBuild.target['platform'] == 'linux': if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm']) compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm'])
elif compiler.cc.name == 'msvc': elif compiler.cc.name == 'msvc':

View File

@ -479,7 +479,7 @@ cleanup:
} /* if */ } /* if */
if (pc_amxram>0 && (glb_declared+pc_stksize)*sizeof(cell)>=(unsigned long)pc_amxram) if (pc_amxram>0 && (glb_declared+pc_stksize)*sizeof(cell)>=(unsigned long)pc_amxram)
flag_exceed=1; flag_exceed=1;
if (!norun && (sc_debug & sSYMBOLIC)!=0 || verbosity>=2 || flag_exceed) { if ((!norun && (sc_debug & sSYMBOLIC)!=0) || verbosity>=2 || flag_exceed) {
pc_printf("Header size: %8ld bytes\n", (long)hdrsize); pc_printf("Header size: %8ld bytes\n", (long)hdrsize);
pc_printf("Code size: %8ld bytes\n", (long)code_idx); pc_printf("Code size: %8ld bytes\n", (long)code_idx);
pc_printf("Data size: %8ld bytes\n", (long)glb_declared*sizeof(cell)); pc_printf("Data size: %8ld bytes\n", (long)glb_declared*sizeof(cell));
@ -1871,8 +1871,8 @@ static void declstructvar(char *firstname,int fpublic, pstruct_t *pstruct)
{ {
error(23); error(23);
} else { } else {
if (arg->tag == pc_addtag("Float") && tok == tNUMBER || if ((arg->tag == pc_addtag("Float") && tok == tNUMBER) ||
arg->tag == 0 && tok == tRATIONAL) (arg->tag == 0 && tok == tRATIONAL))
{ {
error(213); error(213);
} }
@ -2069,8 +2069,8 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst
* c) found a state variable in the automaton that we were looking for * c) found a state variable in the automaton that we were looking for
*/ */
assert(sym==NULL assert(sym==NULL
|| sym->states==NULL && sc_curstates==0 || (sym->states==NULL && sc_curstates==0)
|| sym->states!=NULL && sym->next!=NULL && sym->states->next->index==sc_curstates); || (sym->states!=NULL && sym->next!=NULL && sym->states->next->index==sc_curstates));
/* a state variable may only have a single id in its list (so either this /* a state variable may only have a single id in its list (so either this
* variable has no states, or it has a single list) * variable has no states, or it has a single list)
*/ */
@ -2212,8 +2212,8 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst
if (sc_curstates>0) if (sc_curstates>0)
attachstatelist(sym,sc_curstates); attachstatelist(sym,sc_curstates);
} else { /* if declared but not yet defined, adjust the variable's address */ } else { /* if declared but not yet defined, adjust the variable's address */
assert(sym->states==NULL && sc_curstates==0 assert((sym->states==NULL && sc_curstates==0)
|| sym->states->next!=NULL && sym->states->next->index==sc_curstates && sym->states->next->next==NULL); || (sym->states->next!=NULL && sym->states->next->index==sc_curstates && sym->states->next->next==NULL));
sym->addr=address; sym->addr=address;
sym->codeaddr=code_idx; sym->codeaddr=code_idx;
sym->usage|=uDEFINE; sym->usage|=uDEFINE;
@ -2290,7 +2290,7 @@ static int declloc(int fstatic)
* of a global variable or to that of a local variable at a lower * of a global variable or to that of a local variable at a lower
* level might indicate a bug. * level might indicate a bug.
*/ */
if ((sym=findloc(name))!=NULL && sym->compound!=nestlevel || findglb(name,sGLOBAL)!=NULL) if (((sym=findloc(name))!=NULL && sym->compound!=nestlevel) || findglb(name,sGLOBAL)!=NULL)
error(219,name); /* variable shadows another symbol */ error(219,name); /* variable shadows another symbol */
if (matchtoken('[')) { if (matchtoken('[')) {
int _index; int _index;
@ -3407,7 +3407,7 @@ static void dofuncenum(int listmode)
} else { } else {
error(10); error(10);
} }
} while (l == '&' || l == tLABEL || l == tCONST || l != tELLIPS && matchtoken(',')); } while (l == '&' || l == tLABEL || l == tCONST || (l != tELLIPS && matchtoken(',')));
needtoken(')'); needtoken(')');
for (i=0; i<func.argcount; i++) for (i=0; i<func.argcount; i++)
{ {
@ -3847,7 +3847,7 @@ static int operatoradjust(int opertok,symbol *sym,char *opername,int resulttag)
error(62); /* number or placement of the operands does not fit the operator */ error(62); /* number or placement of the operands does not fit the operator */
} /* switch */ } /* switch */
if (tags[0]==0 && (opertok!='=' && tags[1]==0 || opertok=='=' && resulttag==0)) if (tags[0]==0 && ((opertok!='=' && tags[1]==0) || (opertok=='=' && resulttag==0)))
error(64); /* cannot change predefined operators */ error(64); /* cannot change predefined operators */
/* change the operator name */ /* change the operator name */
@ -4035,7 +4035,7 @@ static void funcstub(int fnative)
tok=lex(&val,&str); tok=lex(&val,&str);
fpublic=(tok==tPUBLIC) || (tok==tSYMBOL && str[0]==PUBLIC_CHAR); fpublic=(tok==tPUBLIC) || (tok==tSYMBOL && str[0]==PUBLIC_CHAR);
if (fnative) { if (fnative) {
if (fpublic || tok==tSTOCK || tok==tSTATIC || tok==tSYMBOL && *str==PUBLIC_CHAR) if (fpublic || tok==tSTOCK || tok==tSTATIC || (tok==tSYMBOL && *str==PUBLIC_CHAR))
error(42); /* invalid combination of class specifiers */ error(42); /* invalid combination of class specifiers */
} else { } else {
if (tok==tPUBLIC || tok==tSTOCK || tok==tSTATIC) if (tok==tPUBLIC || tok==tSTOCK || tok==tSTATIC)
@ -4159,7 +4159,7 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc
tag= (firsttag>=0) ? firsttag : pc_addtag(NULL); tag= (firsttag>=0) ? firsttag : pc_addtag(NULL);
tok=lex(&val,&str); tok=lex(&val,&str);
assert(!fpublic); assert(!fpublic);
if (tok==tNATIVE || tok==tPUBLIC && stock) if (tok==tNATIVE || (tok==tPUBLIC && stock))
error(42); /* invalid combination of class specifiers */ error(42); /* invalid combination of class specifiers */
if (tok==tOPERATOR) { if (tok==tOPERATOR) {
opertok=operatorname(symbolname); opertok=operatorname(symbolname);
@ -4489,8 +4489,8 @@ static int declargs(symbol *sym,int chkshadow)
/* may need to free default array argument and the tag list */ /* may need to free default array argument and the tag list */
if (arg.ident==iREFARRAY && arg.hasdefault) if (arg.ident==iREFARRAY && arg.hasdefault)
free(arg.defvalue.array.data); free(arg.defvalue.array.data);
else if (arg.ident==iVARIABLE else if ((arg.ident==iVARIABLE
&& ((arg.hasdefault & uSIZEOF)!=0 || (arg.hasdefault & uTAGOF)!=0) || (arg.hasdefault & uCOUNTOF)!=0) && ((arg.hasdefault & uSIZEOF)!=0 || (arg.hasdefault & uTAGOF)!=0)) || (arg.hasdefault & uCOUNTOF)!=0)
free(arg.defvalue.size.symname); free(arg.defvalue.size.symname);
free(arg.tags); free(arg.tags);
} /* if */ } /* if */
@ -4529,7 +4529,7 @@ static int declargs(symbol *sym,int chkshadow)
error(10); /* illegal function or declaration */ error(10); /* illegal function or declaration */
} /* switch */ } /* switch */
} while (tok=='&' || tok==tLABEL || tok==tCONST } while (tok=='&' || tok==tLABEL || tok==tCONST
|| tok!=tELLIPS && matchtoken(',')); /* more? */ || (tok!=tELLIPS && matchtoken(','))); /* more? */
/* if the next token is not ",", it should be ")" */ /* if the next token is not ",", it should be ")" */
needtoken(')'); needtoken(')');
} /* if */ } /* if */
@ -4770,7 +4770,7 @@ static int find_xmltag(char *source,char *xmltag,char *xmlparam,char *xmlvalue,
assert(inner_length!=NULL); assert(inner_length!=NULL);
/* both NULL or both non-NULL */ /* both NULL or both non-NULL */
assert(xmlvalue!=NULL && xmlparam!=NULL || xmlvalue==NULL && xmlparam==NULL); assert((xmlvalue!=NULL && xmlparam!=NULL) || (xmlvalue==NULL && xmlparam==NULL));
xmltag_len=strlen(xmltag); xmltag_len=strlen(xmltag);
xmlparam_len= (xmlparam!=NULL) ? strlen(xmlparam) : 0; xmlparam_len= (xmlparam!=NULL) ? strlen(xmlparam) : 0;
@ -6419,7 +6419,7 @@ static void doreturn(void)
if ((rettype & uRETVALUE)!=0) { if ((rettype & uRETVALUE)!=0) {
int retarray=(ident==iARRAY || ident==iREFARRAY); int retarray=(ident==iARRAY || ident==iREFARRAY);
/* there was an earlier "return" statement in this function */ /* there was an earlier "return" statement in this function */
if (sub==NULL && retarray || sub!=NULL && !retarray) if ((sub==NULL && retarray) || (sub!=NULL && !retarray))
error(79); /* mixing "return array;" and "return value;" */ error(79); /* mixing "return array;" and "return value;" */
if (retarray && (curfunc->usage & uPUBLIC)!=0) if (retarray && (curfunc->usage & uPUBLIC)!=0)
error(90,curfunc->name); /* public function may not return array */ error(90,curfunc->name); /* public function may not return array */
@ -6632,7 +6632,7 @@ static void dostate(void)
assert(state!=NULL); assert(state!=NULL);
ldconst(state->value,sPRI); ldconst(state->value,sPRI);
assert(automaton!=NULL); assert(automaton!=NULL);
assert(automaton->index==0 && automaton->name[0]=='\0' || automaton->index>0); assert((automaton->index==0 && automaton->name[0]=='\0') || automaton->index>0);
storereg(automaton->value,sPRI); storereg(automaton->value,sPRI);
/* find the optional entry() function for the state */ /* find the optional entry() function for the state */

View File

@ -416,7 +416,7 @@ static void stripcom(unsigned char *line)
#if !defined SC_LIGHT #if !defined SC_LIGHT
/* collect the comment characters in a string */ /* collect the comment characters in a string */
if (icomment==2) { if (icomment==2) {
if (skipstar && (*line!='\0' && *line<=' ' || *line=='*')) { if (skipstar && ((*line!='\0' && *line<=' ') || *line=='*')) {
/* ignore leading whitespace and '*' characters */ /* ignore leading whitespace and '*' characters */
} else if (commentidx<COMMENT_LIMIT+COMMENT_MARGIN-1) { } else if (commentidx<COMMENT_LIMIT+COMMENT_MARGIN-1) {
comment[commentidx++]=(char)((*line!='\n') ? *line : ' '); comment[commentidx++]=(char)((*line!='\n') ? *line : ' ');
@ -1232,7 +1232,7 @@ static int command(void)
sym=findloc(str); sym=findloc(str);
if (sym==NULL) if (sym==NULL)
sym=findglb(str,sSTATEVAR); sym=findglb(str,sSTATEVAR);
if (sym==NULL || sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && (sym->usage & uDEFINE)==0) { if (sym==NULL || (sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && (sym->usage & uDEFINE)==0)) {
error(17,str); /* undefined symbol */ error(17,str); /* undefined symbol */
} else { } else {
outval(sym->addr,FALSE); outval(sym->addr,FALSE);
@ -1668,7 +1668,7 @@ static void substallpatterns(unsigned char *line,int buffersize)
if (strncmp((char*)start,"defined",7)==0 && !isalpha((char)*(start+7))) { if (strncmp((char*)start,"defined",7)==0 && !isalpha((char)*(start+7))) {
start+=7; /* skip "defined" */ start+=7; /* skip "defined" */
/* skip white space & parantheses */ /* skip white space & parantheses */
while (*start<=' ' && *start!='\0' || *start=='(') while ((*start<=' ' && *start!='\0') || *start=='(')
start++; start++;
/* skip the symbol behind it */ /* skip the symbol behind it */
while (alphanum(*start)) while (alphanum(*start))
@ -1974,7 +1974,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
error(220); error(220);
} /* if */ } /* if */
} /* if */ } /* if */
} else if (*lptr=='\"' || *lptr==sc_ctrlchar && *(lptr+1)=='\"') } else if (*lptr=='\"' || (*lptr==sc_ctrlchar && *(lptr+1)=='\"'))
{ /* unpacked string literal */ { /* unpacked string literal */
_lextok=tSTRING; _lextok=tSTRING;
stringflags= (*lptr==sc_ctrlchar) ? RAWMODE : 0; stringflags= (*lptr==sc_ctrlchar) ? RAWMODE : 0;
@ -1988,9 +1988,9 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
lptr+=1; /* skip final quote */ lptr+=1; /* skip final quote */
else else
error(37); /* invalid (non-terminated) string */ error(37); /* invalid (non-terminated) string */
} else if (*lptr=='!' && *(lptr+1)=='\"' } else if ((*lptr=='!' && *(lptr+1)=='\"')
|| *lptr=='!' && *(lptr+1)==sc_ctrlchar && *(lptr+2)=='\"' || (*lptr=='!' && *(lptr+1)==sc_ctrlchar && *(lptr+2)=='\"')
|| *lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"') || (*lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"'))
{ /* packed string literal */ { /* packed string literal */
_lextok=tSTRING; _lextok=tSTRING;
stringflags= (*lptr==sc_ctrlchar || *(lptr+1)==sc_ctrlchar) ? RAWMODE : 0; stringflags= (*lptr==sc_ctrlchar || *(lptr+1)==sc_ctrlchar) ? RAWMODE : 0;
@ -2081,7 +2081,7 @@ SC_FUNC int matchtoken(int token)
int tok; int tok;
tok=lex(&val,&str); tok=lex(&val,&str);
if (tok==token || token==tTERM && (tok==';' || tok==tENDEXPR)) { if (tok==token || (token==tTERM && (tok==';' || tok==tENDEXPR))) {
return 1; return 1;
} else if (!sc_needsemicolon && token==tTERM && (_lexnewline || !freading)) { } else if (!sc_needsemicolon && token==tTERM && (_lexnewline || !freading)) {
/* Push "tok" back, because it is the token following the implicit statement /* Push "tok" back, because it is the token following the implicit statement
@ -2555,8 +2555,8 @@ static symbol *find_symbol(const symbol *root,const char *name,int fnumber,int a
{ {
assert(sym->states==NULL || sym->states->next!=NULL); /* first element of the state list is the "root" */ assert(sym->states==NULL || sym->states->next!=NULL); /* first element of the state list is the "root" */
if (sym->ident==iFUNCTN if (sym->ident==iFUNCTN
|| automaton<0 && sym->states==NULL || (automaton<0 && sym->states==NULL)
|| automaton>=0 && sym->states!=NULL && state_getfsa(sym->states->next->index)==automaton) || (automaton>=0 && sym->states!=NULL && state_getfsa(sym->states->next->index)==automaton))
{ {
if (cmptag==NULL) if (cmptag==NULL)
return sym; /* return first match */ return sym; /* return first match */
@ -2785,8 +2785,8 @@ SC_FUNC symbol *addvariable2(const char *name,cell addr,int ident,int vclass,int
* the symbol without states if no symbol with states exists). * the symbol without states if no symbol with states exists).
*/ */
assert(vclass!=sGLOBAL || (sym=findglb(name,sGLOBAL))==NULL || (sym->usage & uDEFINE)==0 assert(vclass!=sGLOBAL || (sym=findglb(name,sGLOBAL))==NULL || (sym->usage & uDEFINE)==0
|| sym->ident==iFUNCTN && sym==curfunc || (sym->ident==iFUNCTN && sym==curfunc)
|| sym->states==NULL && sc_curstates>0); || (sym->states==NULL && sc_curstates>0));
if (ident==iARRAY || ident==iREFARRAY) { if (ident==iARRAY || ident==iREFARRAY) {
symbol *parent=NULL,*top; symbol *parent=NULL,*top;

View File

@ -1211,7 +1211,7 @@ static int hier14(value *lval1)
} /* if */ } /* if */
if (lval3.sym->dim.array.level!=level) if (lval3.sym->dim.array.level!=level)
return error(47); /* array dimensions must match */ return error(47); /* array dimensions must match */
else if (ltlength<val || exactmatch && ltlength>val || val==0) else if (ltlength<val || (exactmatch && ltlength>val) || val==0)
return error(47); /* array sizes must match */ return error(47); /* array sizes must match */
else if (lval3.ident!=iARRAYCELL && !matchtag(lval3.sym->x.tags.index,idxtag,TRUE)) else if (lval3.ident!=iARRAYCELL && !matchtag(lval3.sym->x.tags.index,idxtag,TRUE))
error(229,(lval2.sym!=NULL) ? lval2.sym->name : lval3.sym->name); /* index tag mismatch */ error(229,(lval2.sym!=NULL) ? lval2.sym->name : lval3.sym->name); /* index tag mismatch */
@ -1706,7 +1706,7 @@ static int hier2(value *lval)
constvalue *state; constvalue *state;
if (sc_getstateid(&automaton,&state)) { if (sc_getstateid(&automaton,&state)) {
assert(automaton!=NULL); assert(automaton!=NULL);
assert(automaton->index==0 && automaton->name[0]=='\0' || automaton->index>0); assert((automaton->index==0 && automaton->name[0]=='\0') || automaton->index>0);
loadreg(automaton->value,sALT); loadreg(automaton->value,sALT);
assert(state!=NULL); assert(state!=NULL);
ldconst(state->value,sPRI); ldconst(state->value,sPRI);
@ -1871,7 +1871,7 @@ restart:
} /* if */ } /* if */
if (close==']' && !(sym->tag == pc_tag_string && sym->dim.array.level == 0)) { if (close==']' && !(sym->tag == pc_tag_string && sym->dim.array.level == 0)) {
/* normal array index */ /* normal array index */
if (lval2.constval<0 || sym->dim.array.length!=0 && sym->dim.array.length<=lval2.constval) if (lval2.constval<0 || (sym->dim.array.length!=0 && sym->dim.array.length<=lval2.constval))
error(32,sym->name); /* array index out of bounds */ error(32,sym->name); /* array index out of bounds */
if (lval2.constval!=0) { if (lval2.constval!=0) {
/* don't add offsets for zero subscripts */ /* don't add offsets for zero subscripts */
@ -1888,8 +1888,8 @@ restart:
} /* if */ } /* if */
} else { } else {
/* character index */ /* character index */
if (lval2.constval<0 || sym->dim.array.length!=0 if (lval2.constval<0 || (sym->dim.array.length!=0
&& sym->dim.array.length*((8*sizeof(cell))/sCHARBITS)<=(ucell)lval2.constval) && sym->dim.array.length*((8*sizeof(cell))/sCHARBITS)<=(ucell)lval2.constval))
error(32,sym->name); /* array index out of bounds */ error(32,sym->name); /* array index out of bounds */
if (lval2.constval!=0) { if (lval2.constval!=0) {
/* don't add offsets for zero subscripts */ /* don't add offsets for zero subscripts */
@ -2504,8 +2504,8 @@ static int nesting=0;
* function argument; a literal string may be smaller than * function argument; a literal string may be smaller than
* the function argument. * the function argument.
*/ */
if (lval.constval>0 && arg[argidx].dim[0]!=lval.constval if ((lval.constval>0 && arg[argidx].dim[0]!=lval.constval)
|| lval.constval<0 && arg[argidx].dim[0] < -lval.constval) || (lval.constval<0 && arg[argidx].dim[0] < -lval.constval))
error(47); /* array sizes must match */ error(47); /* array sizes must match */
} /* if */ } /* if */
} /* if */ } /* if */

View File

@ -249,7 +249,7 @@ SC_FUNC void setline(int chkbounds)
stgwrite("\t; line "); stgwrite("\t; line ");
outval(fline,TRUE); outval(fline,TRUE);
} /* if */ } /* if */
if ((sc_debug & sSYMBOLIC)!=0 || chkbounds && (sc_debug & sCHKBOUNDS)!=0) { if ((sc_debug & sSYMBOLIC)!=0 || (chkbounds && (sc_debug & sCHKBOUNDS)!=0)) {
/* generate a "break" (start statement) opcode rather than a "line" opcode /* generate a "break" (start statement) opcode rather than a "line" opcode
* because earlier versions of Small/Pawn have an incompatible version of the * because earlier versions of Small/Pawn have an incompatible version of the
* line opcode * line opcode
@ -781,7 +781,7 @@ SC_FUNC void ffcall(symbol *sym,const char *label,int numargs)
stgwrite(sym->name); stgwrite(sym->name);
} /* if */ } /* if */
if (sc_asmfile if (sc_asmfile
&& (label!=NULL || !isalpha(sym->name[0]) && sym->name[0]!='_' && sym->name[0]!=sc_ctrlchar)) && (label!=NULL || (!isalpha(sym->name[0]) && sym->name[0]!='_' && sym->name[0]!=sc_ctrlchar)))
{ {
stgwrite("\t; "); stgwrite("\t; ");
stgwrite(symname); stgwrite(symname);

View File

@ -135,7 +135,7 @@ static short lastfile;
} /* if */ } /* if */
va_end(argptr); va_end(argptr);
if (number>=120 && number<200 || errnum>25){ if ((number>=120 && number<200) || errnum>25){
if (strlen(errfname)==0) { if (strlen(errfname)==0) {
va_start(argptr,number); va_start(argptr,number);
pc_error(0,"\nCompilation aborted.",NULL,0,0,argptr); pc_error(0,"\nCompilation aborted.",NULL,0,0,argptr);

View File

@ -998,7 +998,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
instr=skipwhitespace(line); instr=skipwhitespace(line);
/* ignore empty lines and labels (labels have a special syntax, so these /* ignore empty lines and labels (labels have a special syntax, so these
* must be parsed separately) */ * must be parsed separately) */
if (*instr=='\0' || tolower(*instr)=='l' && *(instr+1)=='.') if (*instr=='\0' || (tolower(*instr)=='l' && *(instr+1)=='.'))
continue; continue;
/* get to the end of the instruction (make use of the '\n' that fgets() /* get to the end of the instruction (make use of the '\n' that fgets()
* added at the end of the line; this way we will *always* drop on a * added at the end of the line; this way we will *always* drop on a
@ -1149,7 +1149,7 @@ static void append_dbginfo(FILE *fout)
/* automaton table */ /* automaton table */
for (constptr=sc_automaton_tab.next; constptr!=NULL; constptr=constptr->next) { for (constptr=sc_automaton_tab.next; constptr!=NULL; constptr=constptr->next) {
assert(constptr->index==0 && strlen(constptr->name)==0 || strlen(constptr->name)>0); assert((constptr->index==0 && strlen(constptr->name)==0) || strlen(constptr->name)>0);
dbghdr.automatons++; dbghdr.automatons++;
dbghdr.size+=sizeof(AMX_DBG_MACHINE)+strlen(constptr->name); dbghdr.size+=sizeof(AMX_DBG_MACHINE)+strlen(constptr->name);
} /* for */ } /* for */
@ -1288,7 +1288,7 @@ static void append_dbginfo(FILE *fout)
/* automaton table */ /* automaton table */
for (constptr=sc_automaton_tab.next; constptr!=NULL; constptr=constptr->next) { for (constptr=sc_automaton_tab.next; constptr!=NULL; constptr=constptr->next) {
assert(constptr->index==0 && strlen(constptr->name)==0 || strlen(constptr->name)>0); assert((constptr->index==0 && strlen(constptr->name)==0) || strlen(constptr->name)>0);
id1=(int16_t)constptr->index; id1=(int16_t)constptr->index;
address=(ucell)constptr->value; address=(ucell)constptr->value;
#if BYTE_ORDER==BIG_ENDIAN #if BYTE_ORDER==BIG_ENDIAN

View File

@ -532,7 +532,7 @@ static int matchsequence(char *start,char *end,char *pattern,
assert(*(start+1)=='\0'); assert(*(start+1)=='\0');
start+=2; /* skip '\n' and '\0' */ start+=2; /* skip '\n' and '\0' */
if (*(pattern+1)!='\0') if (*(pattern+1)!='\0')
while (start<end && *start=='\t' || *start==' ') while ((start<end && *start=='\t') || *start==' ')
start++; /* skip leading white space of next instruction */ start++; /* skip leading white space of next instruction */
break; break;
default: default:
@ -690,7 +690,7 @@ static void stgopt(char *start,char *end,int (*outputfunc)(char *str))
seq++; seq++;
} /* if */ } /* if */
} /* while */ } /* while */
assert(sequences[seq].find==NULL || *sequences[seq].find=='\0' && pc_optimize==sOPTIMIZE_NOMACRO); assert(sequences[seq].find==NULL || (*sequences[seq].find=='\0' && pc_optimize==sOPTIMIZE_NOMACRO));
start += strlen(start) + 1; /* to next string */ start += strlen(start) + 1; /* to next string */
} /* while (start<end) */ } /* while (start<end) */
} while (matches>0); } while (matches>0);

View File

@ -217,8 +217,8 @@ SC_FUNC int cp_set(const char *name)
/* clear the tables */ /* clear the tables */
for (index=0; index<ELEMENTS(bytetable); index++) for (index=0; index<ELEMENTS(bytetable); index++)
bytetable[index]=INVALID; /* special code meaning "not found" */ bytetable[index]=INVALID; /* special code meaning "not found" */
assert(wordtablesize==0 && wordtabletop==0 && wordtable==NULL assert((wordtablesize==0 && wordtabletop==0 && wordtable==NULL)
|| wordtablesize>0 && wordtable!=NULL); || (wordtablesize>0 && wordtable!=NULL));
if (wordtable!=NULL) { if (wordtable!=NULL) {
free(wordtable); free(wordtable);
wordtable=NULL; wordtable=NULL;
@ -339,7 +339,7 @@ SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **end
/* the code positions 0xd800--0xdfff and 0xfffe & 0xffff do not /* the code positions 0xd800--0xdfff and 0xfffe & 0xffff do not
* exist in UCS-4 (and hence, they do not exist in Unicode) * exist in UCS-4 (and hence, they do not exist in Unicode)
*/ */
if (result>=0xd800 && result<=0xdfff || result==0xfffe || result==0xffff) if ((result>=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
return -1; return -1;
} /* if */ } /* if */
break; break;

View File

@ -267,7 +267,7 @@ static stringpair *substindex['z'-PUBLIC_CHAR+1]; /* quick index to first charac
static void adjustindex(char c) static void adjustindex(char c)
{ {
stringpair *cur; stringpair *cur;
assert(c>='A' && c<='Z' || c>='a' && c<='z' || c=='_' || c==PUBLIC_CHAR); assert((c>='A' && c<='Z') || (c>='a' && c<='z') || c=='_' || c==PUBLIC_CHAR);
assert(PUBLIC_CHAR<'A' && 'A'<'_' && '_'<'z'); assert(PUBLIC_CHAR<'A' && 'A'<'_' && '_'<'z');
for (cur=substpair.next; cur!=NULL && cur->first[0]!=c; cur=cur->next) for (cur=substpair.next; cur!=NULL && cur->first[0]!=c; cur=cur->next)
@ -311,7 +311,7 @@ SC_FUNC stringpair *find_subst(char *name,int length)
stringpair *item; stringpair *item;
assert(name!=NULL); assert(name!=NULL);
assert(length>0); assert(length>0);
assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR); assert((*name>='A' && *name<='Z') || (*name>='a' && *name<='z') || *name=='_' || *name==PUBLIC_CHAR);
item=substindex[(int)*name-PUBLIC_CHAR]; item=substindex[(int)*name-PUBLIC_CHAR];
if (item!=NULL) if (item!=NULL)
item=find_stringpair(item,name,length); item=find_stringpair(item,name,length);
@ -340,7 +340,7 @@ SC_FUNC int delete_subst(char *name,int length)
stringpair *item; stringpair *item;
assert(name!=NULL); assert(name!=NULL);
assert(length>0); assert(length>0);
assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR); assert((*name>='A' && *name<='Z') || (*name>='a' && *name<='z') || *name=='_' || *name==PUBLIC_CHAR);
item=substindex[(int)*name-PUBLIC_CHAR]; item=substindex[(int)*name-PUBLIC_CHAR];
if (item!=NULL) if (item!=NULL)
item=find_stringpair(item,name,length); item=find_stringpair(item,name,length);