Fix #emit SYSREQ.C generating wrong native index for unused natives
This commit fixes a bug where the compiler generated incorrect native index in assembly code for natives invoked via #emit sysreq.c and not called elsewhere with the normal syntax. See 4) here: http://forum.sa-mp.com/showthread.php?t=355877 --------- test code -------- native print(const s[]); native printf(const format[], ...); main() { new string[] = "hi there!"; printf(string); #emit push.adr string #emit push.c 4 #emit sysreq.c print #emit sysreq.c printf #emit stack 8 } ----- end of test code -----
This commit is contained in:
parent
8d238c4830
commit
bb4163ea45
@ -1224,6 +1224,13 @@ static int command(void)
|
||||
assert((sym->ident & iFUNCTN)!=0 || (sym->ident & iREFFUNC)!=0);
|
||||
stgwrite(sym->name);
|
||||
} else {
|
||||
if (strcmp(name, "sysreq.c")==0) {
|
||||
assert((sym->ident & iFUNCTN)!=0 && (sym->usage & uNATIVE)!=0);
|
||||
if (sc_status==statWRITE && (sym->usage & uREAD)==0 && sym->addr>=0) {
|
||||
/* reserve a SYSREQ id if called for the first time */
|
||||
sym->addr=ntv_funcid++;
|
||||
} /* if */
|
||||
}
|
||||
outval(sym->addr,FALSE);
|
||||
} /* if */
|
||||
/* mark symbol as "used", unknown whether for read or write */
|
||||
|
Loading…
x
Reference in New Issue
Block a user