pawn-lang / compiler

Pawn compiler for SA-MP with bug fixes and new features - runs on Windows, Linux, macOS
Other
306 stars 72 forks source link

External natives are always in the header, even when not used. #720

Open Y-Less opened 1 year ago

Y-Less commented 1 year ago

Issue description:

If you declare a native with an external name (i.e. native A() = B;) it is placed in the AMX native functions header even if never used.

Minimal complete verifiable example (MCVE):

native MyHeapspace() = heapspace;
main()
{
}

That should have nothing in the natives table. It doesn't.

Workspace Information:

Y-Less commented 1 year ago

OK that MCVE might not be accurate. I just realised that all the ones I was seeing were used in SYSREQ.C in code that isn't itself called:

native MyHeapspace() = heapspace;
stock NotUsed()
{
    __emit(PUSH.C 0, SYSREQ.C MyHeapspace(), STACK 4);
}

main()
{
}
Y-Less commented 1 year ago

For some reason I can't edit:

native MyHeapspace() = heapspace;
stock NotUsed()
{
    __emit(PUSH.C 0, SYSREQ.C MyHeapspace, STACK 4);
}

main()
{
}