(mem_stats) Include mach/mach_port.h explicitly on Apple

mach_port_deallocate() is declared in mach/mach_port.h. The Apple arm
included mach/mach.h and relied on it pulling that header in through
mach/mach_interface.h, which does not hold on every SDK in the build
matrix; where it does not, the call in mem_stats_free() is implicitly
declared and -Werror=implicit-function-declaration ends the build.

mach_task_self() and mach_host_self() are macros over externs declared
in mach/mach_init.h, so they resolve whether or not the interface chain
is walked - which is why mem_stats_free()'s deallocate call was the only
name to fail rather than the whole Apple path.

Include the header directly. No behaviour change.
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-08-07 05:08:17 +02:00
1 parent 4079dc634e
commit 6905998d34
1 file changed
+8
+8
View File
@@ -115,6 +115,14 @@ typedef struct
#include <sys/sysctl.h>
#include <mach/mach.h>
#include <mach/mach_host.h>
/* mach_port_deallocate. mach/mach.h reaches it through
* mach/mach_interface.h on the SDKs that ship that header, but not on
* all of them, and the ones that do not leave the call implicitly
* declared - an error, not a warning, under -Werror. Ask for it
* directly: mach_task_self() and mach_host_self() are macros over
* externs from mach/mach_init.h and resolve either way, so this is the
* one name in the file that depends on the chain holding. */
#include <mach/mach_port.h>
#elif defined(MEM_STATS_WIN32)
#include <windows.h>
#elif defined(MEM_STATS_PROC)