Merge pull request #718 from pcercuei/update-lightrec-20230224
[pcsx_rearmed.git] / deps / lightning / check / setcode.c
index 62719ee..08611d9 100644 (file)
@@ -31,14 +31,14 @@ main(int argc, char *argv[])
     int                          mmap_fd;
 #endif
     void               (*function)(void);
-    int                          mmap_prot, mmap_flags;
+    int                          mmap_prot, mmap_flags, result;
 
 #if defined(__sgi)
     mmap_fd = open("/dev/zero", O_RDWR);
 #endif
 
     mmap_prot = PROT_READ | PROT_WRITE;
-#if !__OpenBSD__
+#if !(__OpenBSD__ || __APPLE__)
     mmap_prot |= PROT_EXEC;
 #endif
 #if __NetBSD__
@@ -83,7 +83,8 @@ main(int argc, char *argv[])
        abort();
 
 #if __NetBSD__
-    assert(mprotect(ptr, 1024 * 1024, PROT_READ | PROT_WRITE) == 0);
+    result = mprotect(ptr, 1024 * 1024, PROT_READ | PROT_WRITE);
+    assert(result == 0);
 #endif
     /* and calling again with enough space works */
     jit_set_code(ptr, 1024 * 1024);
@@ -92,8 +93,9 @@ main(int argc, char *argv[])
        abort();
 
     jit_clear_state();
-#if __NetBSD__ ||  __OpenBSD__
-    assert(mprotect(ptr, 1024 * 1024, PROT_READ | PROT_EXEC) == 0);
+#if __NetBSD__ ||  __OpenBSD__ || __APPLE__
+    result = mprotect(ptr, 1024 * 1024, PROT_READ | PROT_EXEC);
+    assert(result == 0);
 #endif
     (*function)();
     jit_destroy_state();