Add new built-in constant __compat
The __compat constant is set to 0 when compatibility mode is disabled and 1 (or some non-zero value) if enabled, either by using -Z or with `#pragma compat`.
This commit is contained in:
parent
898e02b771
commit
6b3c30aa9e
@ -1495,6 +1495,7 @@ static void setconstants(void)
|
||||
|
||||
add_constant("__Pawn",VERSION_INT,sGLOBAL,0);
|
||||
add_constant("__line",0,sGLOBAL,0);
|
||||
add_constant("__compat",pc_compat,sGLOBAL,0);
|
||||
|
||||
debug=0;
|
||||
if ((sc_debug & (sCHKBOUNDS | sSYMBOLIC))==(sCHKBOUNDS | sSYMBOLIC))
|
||||
|
@ -1237,8 +1237,12 @@ static int command(void)
|
||||
}
|
||||
} else if (strcmp(str,"compat")==0) {
|
||||
cell val;
|
||||
symbol *sym;
|
||||
preproc_expr(&val,NULL);
|
||||
pc_compat=(int)val; /* switch compatibility mode on/off */
|
||||
sym=findconst("__compat",NULL);
|
||||
assert(sym!=NULL);
|
||||
sym->addr=pc_compat;
|
||||
} else {
|
||||
error(207); /* unknown #pragma */
|
||||
} /* if */
|
||||
|
Loading…
x
Reference in New Issue
Block a user