Merge pull request #132 from jkdansereau/fix/macos-errno-include

romdata: include <errno.h> after ultra64.h (Linux build fix on macos)
This commit is contained in:
James Dansereau authored and GitHub committed 2026-09-30 10:06:29 -04:00
commit 39d4f8d088
1 file changed
+10 -2
+10 -2
View File
@@ -35,8 +35,7 @@ extern int snprintf(char *str, size_t maxsize, const char *format, ...);
#else
/* POSIX: mmap the ROM at the fixed cart address (mirrors the VirtualAlloc
* path). <sys/mman.h> is a host header the decomp include path does not
* shadow. */
#include <errno.h>
* shadow. <errno.h> is included further down, after ultra64.h. */
#include <sys/mman.h>
#endif
@@ -52,6 +51,15 @@ extern int snprintf(char *str, size_t maxsize, const char *format, ...);
#include <ultra64.h>
#include "bondtypes.h"
#if !defined(PLATFORM_WINDOWS)
/* Must come after ultra64.h: libc defines `errno` as a macro (glibc:
* `(*__errno_location ())`), which would rewrite the N64 `u8 errno;`
* fields in PR/os.h (OSContStatus, OSContPad, ...) into a function
* declaration and break the build ("field '__errno_location' declared as
* a function"). Only the mmap-failure diagnostic below reads errno. */
#include <errno.h>
#endif
#define CART_BASE 0x10000000u
static u8 *rom = NULL; /* heap copy (fallback path) */