Skip to content

Commit

Permalink
Replace OS_DARWIN by __APPLE__
Browse files Browse the repository at this point in the history
  • Loading branch information
scribam committed Apr 26, 2020
1 parent a04b7f8 commit 6ee4b6d
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 61 deletions.
2 changes: 1 addition & 1 deletion core/cfg/cl.cpp
Expand Up @@ -129,7 +129,7 @@ bool ParseCommandLine(int argc,char* argv[])
cl-=as;
arg+=as;
}
#ifdef __MACH__
#if defined(__APPLE__)
else if (!strncmp(*arg, "-NSDocumentRevisions", 20))
{
arg++;
Expand Down
2 changes: 1 addition & 1 deletion core/emitter/x86_emitter.h
@@ -1,7 +1,7 @@
#pragma once
#include "types.h"
#include "x86_op_classes.h"
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion core/hw/aica/dsp_x64.cpp
Expand Up @@ -35,7 +35,7 @@ alignas(4096) static u8 CodeBuffer[32 * 1024]
;
#elif HOST_OS == OS_LINUX
__attribute__((section(".text")));
#elif HOST_OS == OS_DARWIN
#elif defined(__APPLE__)
__attribute__((section("__TEXT,.text")));
#else
#error CodeBuffer code section unknown
Expand Down
6 changes: 3 additions & 3 deletions core/hw/arm7/arm7.cpp
Expand Up @@ -361,7 +361,7 @@ void update_armintc()

#include "virt_arm.h"

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
#include <sys/mman.h>
#endif

Expand Down Expand Up @@ -606,7 +606,7 @@ u8 ARM7_TCB[ICacheSize+4096];

u8 ARM7_TCB[ICacheSize+4096] __attribute__((section(".text")));

#elif HOST_OS==OS_DARWIN
#elif defined(__APPLE__)
u8 ARM7_TCB[ICacheSize+4096] __attribute__((section("__TEXT, .text")));
#else
#error ARM7_TCB ALLOC
Expand Down Expand Up @@ -1507,7 +1507,7 @@ void armEmit32(u32 emit32)
icPtr+=4;
}

#if HOST_OS==OS_DARWIN
#if defined(__APPLE__)
#include <libkern/OSCacheControl.h>
extern "C" void armFlushICache(void *code, void *pEnd) {
sys_dcache_flush(code, (u8*)pEnd - (u8*)code + 1);
Expand Down
2 changes: 1 addition & 1 deletion core/hw/pvr/Renderer_if.cpp
Expand Up @@ -289,7 +289,7 @@ static void rend_create_renderer()
case 0:
renderer = rend_GLES2();
break;
#if !defined(GLES) && HOST_OS != OS_DARWIN
#if !defined(GLES) && !defined(__APPLE__)
case 3:
renderer = rend_GL4();
fallback_renderer = rend_GLES2();
Expand Down
2 changes: 1 addition & 1 deletion core/hw/pvr/Renderer_if.h
Expand Up @@ -50,7 +50,7 @@ extern int renderer_changed; // Signals the renderer thread to switch renderer w
extern bool renderer_reinit_requested; // Signals the renderer thread to reinit the renderer

Renderer* rend_GLES2();
#if !defined(GLES) && HOST_OS != OS_DARWIN
#if !defined(GLES) && !defined(__APPLE__)
Renderer* rend_GL4();
#endif
Renderer* rend_norend();
Expand Down
2 changes: 1 addition & 1 deletion core/hw/sh4/dyna/driver.cpp
Expand Up @@ -30,7 +30,7 @@ u8 SH4_TCB[CODE_SIZE + TEMP_CODE_SIZE + 4096]
;
#elif HOST_OS == OS_LINUX
__attribute__((section(".text")));
#elif HOST_OS==OS_DARWIN
#elif defined(__APPLE__)
__attribute__((section("__TEXT,.text")));
#else
#error SH4_TCB ALLOC
Expand Down
4 changes: 2 additions & 2 deletions core/hw/sh4/modules/serial.cpp
Expand Up @@ -77,7 +77,7 @@ static void SerialWrite(u32 addr, u32 data)
//SCIF_SCFSR2 read
static u32 ReadSerialStatus(u32 addr)
{
#if HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN
#if HOST_OS == OS_LINUX || defined(__APPLE__)
int count = 0;
if (settings.debug.SerialConsole && ioctl(tty, FIONREAD, &count) == 0 && count > 0)
{
Expand Down Expand Up @@ -166,7 +166,7 @@ void serial_init()
//SCIF SCLSR2 0xFFE80024 0x1FE80024 16 0x0000 0x0000 Held Held Pclk
sh4_rio_reg(SCIF,SCIF_SCLSR2_addr,RIO_DATA,16);

#if HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN
#if HOST_OS == OS_LINUX || defined(__APPLE__)
if (settings.debug.SerialConsole && settings.debug.SerialPTY)
{
tty = open("/dev/ptmx", O_RDWR | O_NDELAY | O_NOCTTY | O_NONBLOCK);
Expand Down
8 changes: 4 additions & 4 deletions core/linux/common.cpp
@@ -1,7 +1,7 @@
#include "types.h"

#if HOST_OS==OS_LINUX || HOST_OS == OS_DARWIN
#if HOST_OS == OS_DARWIN
#if HOST_OS==OS_LINUX || defined(__APPLE__)
#if defined(__APPLE__)
#define _XOPEN_SOURCE 1
#define __USE_GNU 1
#include <TargetConditionals.h>
Expand All @@ -26,7 +26,7 @@ u32* ngen_readm_fail_v2(u32* ptr,u32* regs,u32 saddr);
bool VramLockedWrite(u8* address);
bool BM_LockedWrite(u8* address);

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
void sigill_handler(int sn, siginfo_t * si, void *segfault_ctx) {

rei_host_context_t ctx;
Expand Down Expand Up @@ -114,7 +114,7 @@ void install_fault_handler(void)
sigemptyset(&act.sa_mask);
act.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &act, &segv_oact);
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
//this is broken on osx/ios/mach in general
sigaction(SIGBUS, &act, &segv_oact);

Expand Down
8 changes: 4 additions & 4 deletions core/linux/context.cpp
Expand Up @@ -3,7 +3,7 @@
#if defined(__ANDROID__)
#include <asm/sigcontext.h>
#else
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
#define _XOPEN_SOURCE 1
#define __USE_GNU 1
#endif
Expand Down Expand Up @@ -43,7 +43,7 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
for (int i = 0; i < 15; i++)
bicopy(reictx->r[i], r[i], to_segfault);

#elif HOST_OS == OS_DARWIN
#elif defined(__APPLE__)
bicopy(reictx->pc, MCTX(->__ss.__pc), to_segfault);

for (int i = 0; i < 15; i++)
Expand All @@ -65,7 +65,7 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
bicopy(reictx->esp, MCTX(.gregs[REG_ESP]), to_segfault);
bicopy(reictx->eax, MCTX(.gregs[REG_EAX]), to_segfault);
bicopy(reictx->ecx, MCTX(.gregs[REG_ECX]), to_segfault);
#elif HOST_OS == OS_DARWIN
#elif defined(__APPLE__)
bicopy(reictx->pc, MCTX(->__ss.__eip), to_segfault);
bicopy(reictx->esp, MCTX(->__ss.__esp), to_segfault);
bicopy(reictx->eax, MCTX(->__ss.__eax), to_segfault);
Expand All @@ -80,7 +80,7 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
bicopy(reictx->pc, MCTX(.__gregs[_REG_RIP]), to_segfault);
#elif HOST_OS == OS_LINUX
bicopy(reictx->pc, MCTX(.gregs[REG_RIP]), to_segfault);
#elif HOST_OS == OS_DARWIN
#elif defined(__APPLE__)
bicopy(reictx->pc, MCTX(->__ss.__rip), to_segfault);
#else
#error HOST_OS
Expand Down
4 changes: 2 additions & 2 deletions core/linux/posix_vmem.cpp
Expand Up @@ -114,7 +114,7 @@ static int allocate_shared_filemem(unsigned size) {
// Use Android's specific shmem stuff.
fd = ashmem_create_region(0, size);
#else
#if HOST_OS != OS_DARWIN
#if !defined(__APPLE__)
fd = shm_open("/dcnzorz_mem", O_CREAT | O_EXCL | O_RDWR, S_IREAD | S_IWRITE);
shm_unlink("/dcnzorz_mem");
#endif
Expand Down Expand Up @@ -289,7 +289,7 @@ static void Arm64_CacheFlush(void* start, void* end) {
if (start == end)
return;

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
// Header file says this is equivalent to: sys_icache_invalidate(start, end - start);
sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start);
#else
Expand Down
2 changes: 1 addition & 1 deletion core/log/ConsoleListenerNix.cpp
Expand Up @@ -52,7 +52,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char* text)
break;
}
}
#if HOST_OS != OS_DARWIN
#if !defined(__APPLE__)
fprintf(stderr, "%s%s%s", color_attr, text, reset_attr);
#else
// Skip the time
Expand Down
2 changes: 1 addition & 1 deletion core/oslib/audiobackend_coreaudio.cpp
Expand Up @@ -14,7 +14,7 @@

#include "audiostream.h"

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
#include "stdclass.h"

#include <atomic>
Expand Down
10 changes: 5 additions & 5 deletions core/rec-ARM/ngen_arm.S
Expand Up @@ -9,7 +9,7 @@
.equ BM_BLOCKLIST_MASK, 65532 @FFFC
.equ CPU_RATIO, 5

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
#define CSYM(n) _##n
#define HIDDEN(n)
#else
Expand Down Expand Up @@ -138,7 +138,7 @@ CSYM(ngen_mainloop):
push { r4-r12,lr }


#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
mov r11, #SH4_TIMESLICE @ load cycle counter
#else
mov r9, #SH4_TIMESLICE @ load cycle counter
Expand All @@ -154,7 +154,7 @@ push { r4-r12,lr }
.global CSYM(intc_sched)
HIDDEN(intc_sched)
CSYM(intc_sched): @ next_pc _MUST_ be on ram
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
add r11,r11,#SH4_TIMESLICE
#else
add r9,r9,#SH4_TIMESLICE
Expand Down Expand Up @@ -219,7 +219,7 @@ XEntryPoints: .word CSYM(EntryPoints)
HIDDEN(arm_mainloop)
CSYM(arm_mainloop): @(cntx,lookup_base,cycles)

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
push {r4,r5,r8,r11,lr}
#else
push {r4,r5,r8,r9,lr}
Expand Down Expand Up @@ -256,7 +256,7 @@ arm_dofiq:
HIDDEN(arm_exit)
CSYM(arm_exit):
str r5,[r8,#192] @if timeslice is over, save remaining cycles
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
pop {r4,r5,r8,r11,pc}
#else
pop {r4,r5,r8,r9,pc}
Expand Down
8 changes: 4 additions & 4 deletions core/rec-ARM/rec_arm.cpp
Expand Up @@ -61,7 +61,7 @@ struct DynaRBI: RuntimeBlockInfo
#include <sys/syscall.h> // for cache flushing.
#endif

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
#include <libkern/OSCacheControl.h>
void CacheFlush(void* code, void* pEnd)
{
Expand All @@ -71,7 +71,7 @@ void CacheFlush(void* code, void* pEnd)
#elif !defined(ARMCC)
void CacheFlush(void* code, void* pEnd)
{
#if !defined(__ANDROID__) && HOST_OS!=OS_DARWIN
#if !defined(__ANDROID__) && !defined(__APPLE__)
__clear_cache((void*)code, pEnd);
#else
void* start=code;
Expand Down Expand Up @@ -224,7 +224,7 @@ void StoreSh4Reg_mem(eReg Rt,u32 Sh4_Reg, eCC CC=CC_AL)
#include "hw/sh4/dyna/ssa_regalloc.h"
#endif

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
eReg alloc_regs[]={r5,r6,r7,r10,(eReg)-1};
#else
eReg alloc_regs[]={r5,r6,r7,r10,r11,(eReg)-1};
Expand Down Expand Up @@ -2284,7 +2284,7 @@ void ngen_Compile(RuntimeBlockInfo* block, bool force_checks, bool reset, bool s
cyc&=~3;
}

#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
SUB(r11,r11,cyc,true,CC_AL);
#else
SUB(rfp_r9,rfp_r9,cyc,true,CC_AL);
Expand Down
6 changes: 3 additions & 3 deletions core/rec-x64/rec_x64.cpp
Expand Up @@ -70,7 +70,7 @@ static __attribute((used)) void end_slice()
}
#endif

#ifdef __MACH__
#if defined(__APPLE__)
#define _U "_"
#else
#define _U
Expand Down Expand Up @@ -114,7 +114,7 @@ void ngen_mainloop(void* v_cntx)
#endif
"pushq %rbx \n\t"
WIN32_ONLY( ".seh_pushreg %rbx \n\t")
#ifndef __MACH__ // rbp is pushed in the standard function prologue
#if !defined(__APPLE__) // rbp is pushed in the standard function prologue
"pushq %rbp \n\t"
#endif
#ifdef _WIN32
Expand Down Expand Up @@ -194,7 +194,7 @@ WIN32_ONLY( ".seh_pushreg %r14 \n\t")
"popq %rsi \n\t"
"popq %rdi \n\t"
#endif
#ifndef __MACH__
#if !defined(__APPLE__)
"popq %rbp \n\t"
#endif
"popq %rbx \n\t"
Expand Down
4 changes: 2 additions & 2 deletions core/rend/gles/gles.cpp
Expand Up @@ -491,7 +491,7 @@ void findGLVersion()
if (gl.gl_major >= 3)
{
gl.gl_version = "GL3";
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
gl.glsl_version_header = "#version 150";
#else
gl.glsl_version_header = "#version 130";
Expand Down Expand Up @@ -1132,7 +1132,7 @@ bool RenderFrame()
}
else
{
#if HOST_OS != OS_DARWIN
#if !defined(__APPLE__)
//Fix this in a proper way
glBindFramebuffer(GL_FRAMEBUFFER,0);
#endif
Expand Down
2 changes: 1 addition & 1 deletion core/rend/gles/gltex.cpp
Expand Up @@ -43,7 +43,7 @@ void TextureCacheData::UploadToGPU(int width, int height, u8 *temp_tex_buffer, b
mipmapLevels++;
dim >>= 1;
}
#if !defined(GLES2) && HOST_OS != OS_DARWIN
#if !defined(GLES2) && !defined(__APPLE__)
// Open GL 4.2 or GLES 3.0 min
if (gl.gl_major > 4 || (gl.gl_major == 4 && gl.gl_minor >= 2)
|| (gl.is_gles && gl.gl_major >= 3))
Expand Down
2 changes: 1 addition & 1 deletion core/rend/gles/imgui_impl_opengl3.cpp
Expand Up @@ -90,7 +90,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
if (theGLContext.IsGLES())
glsl_version = "#version 100"; // OpenGL ES 2.0
else
#if HOST_OS == OS_DARWIN
#if defined(__APPLE__)
glsl_version = "#version 140"; // OpenGL 3.1
#else
glsl_version = "#version 130"; // OpenGL 3.0
Expand Down
4 changes: 2 additions & 2 deletions core/rend/gui.cpp
Expand Up @@ -990,7 +990,7 @@ static void gui_display_settings()
if (ImGui::BeginTabItem("Video"))
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, normal_padding);
#if HOST_OS != OS_DARWIN
#if !defined(__APPLE__)
bool has_per_pixel = false;
if (!vulkan)
has_per_pixel = !theGLContext.IsGLES() && theGLContext.GetMajorVersion() >= 4;
Expand Down Expand Up @@ -1400,7 +1400,7 @@ static void gui_display_settings()
"Android"
#elif HOST_OS == OS_LINUX
"Linux"
#elif HOST_OS == OS_DARWIN
#elif defined(__APPLE__)
#ifdef TARGET_IPHONE
"iOS"
#else
Expand Down
2 changes: 1 addition & 1 deletion core/rend/gui_util.cpp
Expand Up @@ -63,7 +63,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca
else
select_current_directory = home;
}
#elif HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN
#elif HOST_OS == OS_LINUX || defined(__APPLE__)
const char *home = getenv("HOME");
if (home != NULL)
select_current_directory = home;
Expand Down
2 changes: 1 addition & 1 deletion core/rend/vulkan/vulkan_context.cpp
Expand Up @@ -668,7 +668,7 @@ bool VulkanContext::Init()
extern void CreateMainWindow();
CreateMainWindow();
extensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#elif defined(__MACH__)
#elif defined(__APPLE__)
extensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME);
#elif defined(SUPPORT_X11)
extensions.push_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
Expand Down

0 comments on commit 6ee4b6d

Please sign in to comment.