Removed -Wno-parentheses from posix build and fixed warnings (bug 5745, r=psychonic).
This commit is contained in:
parent
b96e0c8713
commit
29bc273e58
@ -10,7 +10,6 @@ for i in SM.sdkInfo:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'game', 'shared'))
|
||||
|
||||
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
|
||||
compiler['CFLAGS'].append('-Wno-parentheses')
|
||||
compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
|
||||
|
||||
name = 'sdkhooks.ext.' + sdk['ext']
|
||||
|
@ -11,7 +11,6 @@ for i in SM.sdkInfo:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
|
||||
|
||||
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
|
||||
compiler['CFLAGS'].append('-Wno-parentheses')
|
||||
compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
|
||||
|
||||
if i != 'ep1':
|
||||
|
@ -157,9 +157,9 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
else if(!twoByte)
|
||||
{
|
||||
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 & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02 ||
|
||||
((opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02) ||
|
||||
(opcode & 0xFC) == 0xD0 ||
|
||||
(opcode & 0xF6) == 0xF6)
|
||||
{
|
||||
@ -170,11 +170,11 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
}
|
||||
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 == 0x77 ||
|
||||
(opcode & 0xF0) == 0x80 ||
|
||||
(opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02 ||
|
||||
((opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02) ||
|
||||
(opcode & 0xF8) == 0xC8)
|
||||
{
|
||||
// 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 & 0xF8) == 0xE0 || // LOOP/JCXZ
|
||||
opcode == 0xEB ||
|
||||
opcode == 0xF6 && (modRM & 0x30) == 0x00) // TEST
|
||||
(opcode == 0xF6 && (modRM & 0x30) == 0x00)) // TEST
|
||||
{
|
||||
if (dest)
|
||||
*dest++ = *func++;
|
||||
@ -275,7 +275,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
(opcode & 0xFC) == 0xA0 ||
|
||||
(opcode & 0xEE) == 0xA8 ||
|
||||
opcode == 0xC7 ||
|
||||
opcode == 0xF7 && (modRM & 0x30) == 0x00)
|
||||
(opcode == 0xF7 && (modRM & 0x30) == 0x00))
|
||||
{
|
||||
if (dest) {
|
||||
//Fix CALL/JMP offset
|
||||
|
@ -3,8 +3,6 @@ import os
|
||||
if 'ep2v' in SM.sdkInfo:
|
||||
sdk = SM.sdkInfo['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']
|
||||
extension = AMBuild.AddJob(name)
|
||||
|
@ -157,9 +157,9 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
else if(!twoByte)
|
||||
{
|
||||
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 & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02 ||
|
||||
((opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02) ||
|
||||
(opcode & 0xFC) == 0xD0 ||
|
||||
(opcode & 0xF6) == 0xF6)
|
||||
{
|
||||
@ -170,11 +170,11 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
}
|
||||
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 == 0x77 ||
|
||||
(opcode & 0xF0) == 0x80 ||
|
||||
(opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02 ||
|
||||
((opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02) ||
|
||||
(opcode & 0xF8) == 0xC8)
|
||||
{
|
||||
// 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 & 0xF8) == 0xE0 || // LOOP/JCXZ
|
||||
opcode == 0xEB ||
|
||||
opcode == 0xF6 && (modRM & 0x30) == 0x00) // TEST
|
||||
(opcode == 0xF6 && (modRM & 0x30) == 0x00)) // TEST
|
||||
{
|
||||
if (dest)
|
||||
*dest++ = *func++;
|
||||
@ -275,7 +275,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
(opcode & 0xFC) == 0xA0 ||
|
||||
(opcode & 0xEE) == 0xA8 ||
|
||||
opcode == 0xC7 ||
|
||||
opcode == 0xF7 && (modRM & 0x30) == 0x00)
|
||||
(opcode == 0xF7 && (modRM & 0x30) == 0x00))
|
||||
{
|
||||
if (dest) {
|
||||
//Fix CALL/JMP offset
|
||||
|
@ -8,7 +8,7 @@ compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'c
|
||||
compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
|
||||
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':
|
||||
compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm'])
|
||||
elif compiler.cc.name == 'msvc':
|
||||
|
@ -479,7 +479,7 @@ cleanup:
|
||||
} /* if */
|
||||
if (pc_amxram>0 && (glb_declared+pc_stksize)*sizeof(cell)>=(unsigned long)pc_amxram)
|
||||
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("Code size: %8ld bytes\n", (long)code_idx);
|
||||
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);
|
||||
} else {
|
||||
if (arg->tag == pc_addtag("Float") && tok == tNUMBER ||
|
||||
arg->tag == 0 && tok == tRATIONAL)
|
||||
if ((arg->tag == pc_addtag("Float") && tok == tNUMBER) ||
|
||||
(arg->tag == 0 && tok == tRATIONAL))
|
||||
{
|
||||
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
|
||||
*/
|
||||
assert(sym==NULL
|
||||
|| sym->states==NULL && sc_curstates==0
|
||||
|| sym->states!=NULL && sym->next!=NULL && sym->states->next->index==sc_curstates);
|
||||
|| (sym->states==NULL && sc_curstates==0)
|
||||
|| (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
|
||||
* 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)
|
||||
attachstatelist(sym,sc_curstates);
|
||||
} else { /* if declared but not yet defined, adjust the variable's address */
|
||||
assert(sym->states==NULL && sc_curstates==0
|
||||
|| sym->states->next!=NULL && sym->states->next->index==sc_curstates && sym->states->next->next==NULL);
|
||||
assert((sym->states==NULL && sc_curstates==0)
|
||||
|| (sym->states->next!=NULL && sym->states->next->index==sc_curstates && sym->states->next->next==NULL));
|
||||
sym->addr=address;
|
||||
sym->codeaddr=code_idx;
|
||||
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
|
||||
* 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 */
|
||||
if (matchtoken('[')) {
|
||||
int _index;
|
||||
@ -3407,7 +3407,7 @@ static void dofuncenum(int listmode)
|
||||
} else {
|
||||
error(10);
|
||||
}
|
||||
} while (l == '&' || l == tLABEL || l == tCONST || l != tELLIPS && matchtoken(','));
|
||||
} while (l == '&' || l == tLABEL || l == tCONST || (l != tELLIPS && matchtoken(',')));
|
||||
needtoken(')');
|
||||
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 */
|
||||
} /* 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 */
|
||||
|
||||
/* change the operator name */
|
||||
@ -4035,7 +4035,7 @@ static void funcstub(int fnative)
|
||||
tok=lex(&val,&str);
|
||||
fpublic=(tok==tPUBLIC) || (tok==tSYMBOL && str[0]==PUBLIC_CHAR);
|
||||
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 */
|
||||
} else {
|
||||
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);
|
||||
tok=lex(&val,&str);
|
||||
assert(!fpublic);
|
||||
if (tok==tNATIVE || tok==tPUBLIC && stock)
|
||||
if (tok==tNATIVE || (tok==tPUBLIC && stock))
|
||||
error(42); /* invalid combination of class specifiers */
|
||||
if (tok==tOPERATOR) {
|
||||
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 */
|
||||
if (arg.ident==iREFARRAY && arg.hasdefault)
|
||||
free(arg.defvalue.array.data);
|
||||
else if (arg.ident==iVARIABLE
|
||||
&& ((arg.hasdefault & uSIZEOF)!=0 || (arg.hasdefault & uTAGOF)!=0) || (arg.hasdefault & uCOUNTOF)!=0)
|
||||
else if ((arg.ident==iVARIABLE
|
||||
&& ((arg.hasdefault & uSIZEOF)!=0 || (arg.hasdefault & uTAGOF)!=0)) || (arg.hasdefault & uCOUNTOF)!=0)
|
||||
free(arg.defvalue.size.symname);
|
||||
free(arg.tags);
|
||||
} /* if */
|
||||
@ -4529,7 +4529,7 @@ static int declargs(symbol *sym,int chkshadow)
|
||||
error(10); /* illegal function or declaration */
|
||||
} /* switch */
|
||||
} while (tok=='&' || tok==tLABEL || tok==tCONST
|
||||
|| tok!=tELLIPS && matchtoken(',')); /* more? */
|
||||
|| (tok!=tELLIPS && matchtoken(','))); /* more? */
|
||||
/* if the next token is not ",", it should be ")" */
|
||||
needtoken(')');
|
||||
} /* if */
|
||||
@ -4770,7 +4770,7 @@ static int find_xmltag(char *source,char *xmltag,char *xmlparam,char *xmlvalue,
|
||||
assert(inner_length!=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);
|
||||
xmlparam_len= (xmlparam!=NULL) ? strlen(xmlparam) : 0;
|
||||
@ -6419,7 +6419,7 @@ static void doreturn(void)
|
||||
if ((rettype & uRETVALUE)!=0) {
|
||||
int retarray=(ident==iARRAY || ident==iREFARRAY);
|
||||
/* 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;" */
|
||||
if (retarray && (curfunc->usage & uPUBLIC)!=0)
|
||||
error(90,curfunc->name); /* public function may not return array */
|
||||
@ -6632,7 +6632,7 @@ static void dostate(void)
|
||||
assert(state!=NULL);
|
||||
ldconst(state->value,sPRI);
|
||||
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);
|
||||
|
||||
/* find the optional entry() function for the state */
|
||||
|
@ -416,7 +416,7 @@ static void stripcom(unsigned char *line)
|
||||
#if !defined SC_LIGHT
|
||||
/* collect the comment characters in a string */
|
||||
if (icomment==2) {
|
||||
if (skipstar && (*line!='\0' && *line<=' ' || *line=='*')) {
|
||||
if (skipstar && ((*line!='\0' && *line<=' ') || *line=='*')) {
|
||||
/* ignore leading whitespace and '*' characters */
|
||||
} else if (commentidx<COMMENT_LIMIT+COMMENT_MARGIN-1) {
|
||||
comment[commentidx++]=(char)((*line!='\n') ? *line : ' ');
|
||||
@ -1232,7 +1232,7 @@ static int command(void)
|
||||
sym=findloc(str);
|
||||
if (sym==NULL)
|
||||
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 */
|
||||
} else {
|
||||
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))) {
|
||||
start+=7; /* skip "defined" */
|
||||
/* skip white space & parantheses */
|
||||
while (*start<=' ' && *start!='\0' || *start=='(')
|
||||
while ((*start<=' ' && *start!='\0') || *start=='(')
|
||||
start++;
|
||||
/* skip the symbol behind it */
|
||||
while (alphanum(*start))
|
||||
@ -1974,7 +1974,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||
error(220);
|
||||
} /* if */
|
||||
} /* if */
|
||||
} else if (*lptr=='\"' || *lptr==sc_ctrlchar && *(lptr+1)=='\"')
|
||||
} else if (*lptr=='\"' || (*lptr==sc_ctrlchar && *(lptr+1)=='\"'))
|
||||
{ /* unpacked string literal */
|
||||
_lextok=tSTRING;
|
||||
stringflags= (*lptr==sc_ctrlchar) ? RAWMODE : 0;
|
||||
@ -1988,9 +1988,9 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||
lptr+=1; /* skip final quote */
|
||||
else
|
||||
error(37); /* invalid (non-terminated) string */
|
||||
} else if (*lptr=='!' && *(lptr+1)=='\"'
|
||||
|| *lptr=='!' && *(lptr+1)==sc_ctrlchar && *(lptr+2)=='\"'
|
||||
|| *lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"')
|
||||
} else if ((*lptr=='!' && *(lptr+1)=='\"')
|
||||
|| (*lptr=='!' && *(lptr+1)==sc_ctrlchar && *(lptr+2)=='\"')
|
||||
|| (*lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"'))
|
||||
{ /* packed string literal */
|
||||
_lextok=tSTRING;
|
||||
stringflags= (*lptr==sc_ctrlchar || *(lptr+1)==sc_ctrlchar) ? RAWMODE : 0;
|
||||
@ -2081,7 +2081,7 @@ SC_FUNC int matchtoken(int token)
|
||||
int tok;
|
||||
|
||||
tok=lex(&val,&str);
|
||||
if (tok==token || token==tTERM && (tok==';' || tok==tENDEXPR)) {
|
||||
if (tok==token || (token==tTERM && (tok==';' || tok==tENDEXPR))) {
|
||||
return 1;
|
||||
} else if (!sc_needsemicolon && token==tTERM && (_lexnewline || !freading)) {
|
||||
/* 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" */
|
||||
if (sym->ident==iFUNCTN
|
||||
|| automaton<0 && sym->states==NULL
|
||||
|| automaton>=0 && sym->states!=NULL && state_getfsa(sym->states->next->index)==automaton)
|
||||
|| (automaton<0 && sym->states==NULL)
|
||||
|| (automaton>=0 && sym->states!=NULL && state_getfsa(sym->states->next->index)==automaton))
|
||||
{
|
||||
if (cmptag==NULL)
|
||||
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).
|
||||
*/
|
||||
assert(vclass!=sGLOBAL || (sym=findglb(name,sGLOBAL))==NULL || (sym->usage & uDEFINE)==0
|
||||
|| sym->ident==iFUNCTN && sym==curfunc
|
||||
|| sym->states==NULL && sc_curstates>0);
|
||||
|| (sym->ident==iFUNCTN && sym==curfunc)
|
||||
|| (sym->states==NULL && sc_curstates>0));
|
||||
|
||||
if (ident==iARRAY || ident==iREFARRAY) {
|
||||
symbol *parent=NULL,*top;
|
||||
|
@ -1211,7 +1211,7 @@ static int hier14(value *lval1)
|
||||
} /* if */
|
||||
if (lval3.sym->dim.array.level!=level)
|
||||
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 */
|
||||
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 */
|
||||
@ -1706,7 +1706,7 @@ static int hier2(value *lval)
|
||||
constvalue *state;
|
||||
if (sc_getstateid(&automaton,&state)) {
|
||||
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);
|
||||
assert(state!=NULL);
|
||||
ldconst(state->value,sPRI);
|
||||
@ -1871,7 +1871,7 @@ restart:
|
||||
} /* if */
|
||||
if (close==']' && !(sym->tag == pc_tag_string && sym->dim.array.level == 0)) {
|
||||
/* 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 */
|
||||
if (lval2.constval!=0) {
|
||||
/* don't add offsets for zero subscripts */
|
||||
@ -1888,8 +1888,8 @@ restart:
|
||||
} /* if */
|
||||
} else {
|
||||
/* character index */
|
||||
if (lval2.constval<0 || sym->dim.array.length!=0
|
||||
&& sym->dim.array.length*((8*sizeof(cell))/sCHARBITS)<=(ucell)lval2.constval)
|
||||
if (lval2.constval<0 || (sym->dim.array.length!=0
|
||||
&& sym->dim.array.length*((8*sizeof(cell))/sCHARBITS)<=(ucell)lval2.constval))
|
||||
error(32,sym->name); /* array index out of bounds */
|
||||
if (lval2.constval!=0) {
|
||||
/* don't add offsets for zero subscripts */
|
||||
@ -2504,8 +2504,8 @@ static int nesting=0;
|
||||
* function argument; a literal string may be smaller than
|
||||
* the function argument.
|
||||
*/
|
||||
if (lval.constval>0 && arg[argidx].dim[0]!=lval.constval
|
||||
|| 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))
|
||||
error(47); /* array sizes must match */
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
@ -249,7 +249,7 @@ SC_FUNC void setline(int chkbounds)
|
||||
stgwrite("\t; line ");
|
||||
outval(fline,TRUE);
|
||||
} /* 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
|
||||
* because earlier versions of Small/Pawn have an incompatible version of the
|
||||
* line opcode
|
||||
@ -781,7 +781,7 @@ SC_FUNC void ffcall(symbol *sym,const char *label,int numargs)
|
||||
stgwrite(sym->name);
|
||||
} /* if */
|
||||
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(symname);
|
||||
|
@ -135,7 +135,7 @@ static short lastfile;
|
||||
} /* if */
|
||||
va_end(argptr);
|
||||
|
||||
if (number>=120 && number<200 || errnum>25){
|
||||
if ((number>=120 && number<200) || errnum>25){
|
||||
if (strlen(errfname)==0) {
|
||||
va_start(argptr,number);
|
||||
pc_error(0,"\nCompilation aborted.",NULL,0,0,argptr);
|
||||
|
@ -998,7 +998,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
|
||||
instr=skipwhitespace(line);
|
||||
/* ignore empty lines and labels (labels have a special syntax, so these
|
||||
* must be parsed separately) */
|
||||
if (*instr=='\0' || tolower(*instr)=='l' && *(instr+1)=='.')
|
||||
if (*instr=='\0' || (tolower(*instr)=='l' && *(instr+1)=='.'))
|
||||
continue;
|
||||
/* 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
|
||||
@ -1149,7 +1149,7 @@ static void append_dbginfo(FILE *fout)
|
||||
|
||||
/* automaton table */
|
||||
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.size+=sizeof(AMX_DBG_MACHINE)+strlen(constptr->name);
|
||||
} /* for */
|
||||
@ -1288,7 +1288,7 @@ static void append_dbginfo(FILE *fout)
|
||||
|
||||
/* automaton table */
|
||||
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;
|
||||
address=(ucell)constptr->value;
|
||||
#if BYTE_ORDER==BIG_ENDIAN
|
||||
|
@ -532,7 +532,7 @@ static int matchsequence(char *start,char *end,char *pattern,
|
||||
assert(*(start+1)=='\0');
|
||||
start+=2; /* skip '\n' and '\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 */
|
||||
break;
|
||||
default:
|
||||
@ -690,7 +690,7 @@ static void stgopt(char *start,char *end,int (*outputfunc)(char *str))
|
||||
seq++;
|
||||
} /* if */
|
||||
} /* 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 */
|
||||
} /* while (start<end) */
|
||||
} while (matches>0);
|
||||
|
@ -217,8 +217,8 @@ SC_FUNC int cp_set(const char *name)
|
||||
/* clear the tables */
|
||||
for (index=0; index<ELEMENTS(bytetable); index++)
|
||||
bytetable[index]=INVALID; /* special code meaning "not found" */
|
||||
assert(wordtablesize==0 && wordtabletop==0 && wordtable==NULL
|
||||
|| wordtablesize>0 && wordtable!=NULL);
|
||||
assert((wordtablesize==0 && wordtabletop==0 && wordtable==NULL)
|
||||
|| (wordtablesize>0 && wordtable!=NULL));
|
||||
if (wordtable!=NULL) {
|
||||
free(wordtable);
|
||||
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
|
||||
* 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;
|
||||
} /* if */
|
||||
break;
|
||||
|
@ -267,7 +267,7 @@ static stringpair *substindex['z'-PUBLIC_CHAR+1]; /* quick index to first charac
|
||||
static void adjustindex(char c)
|
||||
{
|
||||
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');
|
||||
|
||||
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;
|
||||
assert(name!=NULL);
|
||||
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];
|
||||
if (item!=NULL)
|
||||
item=find_stringpair(item,name,length);
|
||||
@ -340,7 +340,7 @@ SC_FUNC int delete_subst(char *name,int length)
|
||||
stringpair *item;
|
||||
assert(name!=NULL);
|
||||
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];
|
||||
if (item!=NULL)
|
||||
item=find_stringpair(item,name,length);
|
||||
|
Loading…
Reference in New Issue
Block a user