From 9642f7705b27e5c270c15fa526d14e1848c2c27d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 31 Jul 2018 19:12:18 -0500 Subject: [PATCH] arch: Cleanup of __ARM__ checks * gcc 7.x defines __arm__ and __ARM__ (and others) * clang defines __arm__ and __arm * cleanup a few related ifdef vs if macros Change-Id: I5da4bafac590f6fa3e10e543688001c2449f840d --- headers/config/HaikuConfig.h | 14 +++++++------- headers/os/kernel/debugger.h | 12 ++++++------ headers/posix/arch/arm/signal.h | 4 ++-- headers/posix/fenv.h | 2 +- src/system/boot/platform/u-boot/serial.cpp | 2 +- src/system/boot/platform/u-boot/start.cpp | 4 ++-- src/system/boot/platform/u-boot/video.cpp | 2 +- src/system/kernel/platform/u-boot/fdt_serial.cpp | 4 ++-- src/system/libroot/os/atomic.c | 2 +- src/system/libroot/posix/stdlib/strtod.c | 3 +-- .../libroot/posix/string/arch/generic/memset.c | 2 +- src/system/libroot/posix/string/memmove.c | 2 +- 12 files changed, 26 insertions(+), 27 deletions(-) diff --git a/headers/config/HaikuConfig.h b/headers/config/HaikuConfig.h index 6648f53ec4..d99a23285b 100644 --- a/headers/config/HaikuConfig.h +++ b/headers/config/HaikuConfig.h @@ -18,7 +18,7 @@ __HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures (defaults to undefined) */ -#ifdef __INTEL__ +#if defined(__INTEL__) # define __HAIKU_ARCH x86 # if __GNUC__ == 2 # define __HAIKU_ARCH_ABI "x86_gcc2" @@ -27,31 +27,31 @@ # endif # define __HAIKU_ARCH_X86 1 # define __HAIKU_ARCH_PHYSICAL_BITS 64 -#elif __x86_64__ +#elif defined(__x86_64__) # define __HAIKU_ARCH x86_64 # define __HAIKU_ARCH_ABI "x86_64" # define __HAIKU_ARCH_X86_64 1 # define __HAIKU_ARCH_BITS 64 -#elif __POWERPC__ +#elif defined(__POWERPC__) # define __HAIKU_ARCH ppc # define __HAIKU_ARCH_ABI "ppc" # define __HAIKU_ARCH_PPC 1 # define __HAIKU_ARCH_PHYSICAL_BITS 64 # define __HAIKU_BIG_ENDIAN 1 -#elif __M68K__ +#elif defined(__M68K__) # define __HAIKU_ARCH m68k # define __HAIKU_ARCH_ABI "m68k" # define __HAIKU_ARCH_M68K 1 # define __HAIKU_BIG_ENDIAN 1 -#elif __MIPSEL__ +#elif defined(__MIPSEL__) # define __HAIKU_ARCH mipsel # define __HAIKU_ARCH_ABI "mipsel" # define __HAIKU_ARCH_MIPSEL 1 -#elif __ARM__ || __ARMEL__ +#elif defined(__ARMEL__) || defined(__arm__) # define __HAIKU_ARCH arm # define __HAIKU_ARCH_ABI "arm" # define __HAIKU_ARCH_ARM 1 -#elif __ARMEB__ +#elif defined(__ARMEB__) # define __HAIKU_ARCH armeb # define __HAIKU_ARCH_ABI "armeb" # define __HAIKU_ARCH_ARM 1 diff --git a/headers/os/kernel/debugger.h b/headers/os/kernel/debugger.h index d7589452dd..56b476bacf 100644 --- a/headers/os/kernel/debugger.h +++ b/headers/os/kernel/debugger.h @@ -20,17 +20,17 @@ #include -#ifdef __x86_64__ +#if defined(__x86_64__) typedef struct x86_64_debug_cpu_state debug_cpu_state; -#elif __INTEL__ +#elif defined( __INTEL__) typedef struct x86_debug_cpu_state debug_cpu_state; -#elif __POWERPC__ +#elif defined(__POWERPC__) typedef struct ppc_debug_cpu_state debug_cpu_state; -#elif __M68K__ +#elif defined(__M68K__) typedef struct m68k_debug_cpu_state debug_cpu_state; -#elif __MIPSEL__ +#elif defined(__MIPSEL__) typedef struct mipsel_debug_cpu_state debug_cpu_state; -#elif __ARM__ +#elif defined(__arm__) typedef struct arm_debug_cpu_state debug_cpu_state; #else #error unsupported architecture diff --git a/headers/posix/arch/arm/signal.h b/headers/posix/arch/arm/signal.h index 1bf092b83d..35596792ed 100644 --- a/headers/posix/arch/arm/signal.h +++ b/headers/posix/arch/arm/signal.h @@ -10,7 +10,7 @@ * Architecture-specific structure passed to signal handlers */ -#if __ARM__ +#if defined(__arm__) struct vregs { ulong r0; @@ -32,7 +32,7 @@ struct vregs ulong cpsr; // TODO: ARM: fix floats in vregs, add missing stuff. }; -#endif /* __ARM__ */ +#endif /* defined(__arm__) */ #endif /* _ARCH_SIGNAL_H_ */ diff --git a/headers/posix/fenv.h b/headers/posix/fenv.h index 31fdd0b851..fb6dd1aa0e 100644 --- a/headers/posix/fenv.h +++ b/headers/posix/fenv.h @@ -5,7 +5,7 @@ # include #elif defined(__x86_64__) # include -#elif defined(__ARM__) +#elif defined(__arm__) # include #elif defined(__POWERPC__) # include diff --git a/src/system/boot/platform/u-boot/serial.cpp b/src/system/boot/platform/u-boot/serial.cpp index e78c5af4f0..381f092f2a 100644 --- a/src/system/boot/platform/u-boot/serial.cpp +++ b/src/system/boot/platform/u-boot/serial.cpp @@ -15,7 +15,7 @@ #include -#if defined(__ARM__) +#if defined(__arm__) #include #endif diff --git a/src/system/boot/platform/u-boot/start.cpp b/src/system/boot/platform/u-boot/start.cpp index a631076cdf..108ea9c2df 100644 --- a/src/system/boot/platform/u-boot/start.cpp +++ b/src/system/boot/platform/u-boot/start.cpp @@ -70,7 +70,7 @@ extern "C" void _start(void); extern "C" int start_gen(int argc, const char **argv, struct image_header *uimage=NULL, void *fdt=NULL); extern "C" void dump_uimage(struct image_header *image); -#if defined(__ARM__) +#if defined(__arm__) extern "C" status_t arch_mailbox_init(); #endif @@ -230,7 +230,7 @@ start_gen(int argc, const char **argv, struct image_header *uimage, void *fdt) serial_init(gFDT); - #if defined(__ARM__) + #if defined(__arm__) arch_mailbox_init(); #endif diff --git a/src/system/boot/platform/u-boot/video.cpp b/src/system/boot/platform/u-boot/video.cpp index 1c245f439a..1c149b0523 100644 --- a/src/system/boot/platform/u-boot/video.cpp +++ b/src/system/boot/platform/u-boot/video.cpp @@ -105,7 +105,7 @@ platform_init_video(void) { #warning TODO: Fix u-boot arm framebuffer location from fdt! -#ifdef __ARM__ +#if defined(__arm__) #if defined(BOARD_CPU_ARM920T) extern ArchFramebuffer *arch_get_fb_arm_920(addr_t base); gFramebuffer = arch_get_fb_arm_920(0x88000000); diff --git a/src/system/kernel/platform/u-boot/fdt_serial.cpp b/src/system/kernel/platform/u-boot/fdt_serial.cpp index 2c8f2984a2..04c221d0ea 100644 --- a/src/system/kernel/platform/u-boot/fdt_serial.cpp +++ b/src/system/kernel/platform/u-boot/fdt_serial.cpp @@ -17,7 +17,7 @@ #include -#ifdef __ARM__ +#if defined(__arm__) #include #endif @@ -101,7 +101,7 @@ debug_uart_from_fdt(const void *fdt) || fdt_node_check_compatible(fdt, node, "ns16550") == 0) { TRACE(("serial: Found 8250 serial UART!\n")); uart = arch_get_uart_8250(regs, clock); - #ifdef __ARM__ + #if defined(__arm__) } else if (fdt_node_check_compatible(fdt, node, "ti,omap3-uart") == 0 || fdt_node_check_compatible(fdt, node, "ti,omap4-uart") == 0 || fdt_node_check_compatible(fdt, node, "ti,omap5-uart") == 0 diff --git a/src/system/libroot/os/atomic.c b/src/system/libroot/os/atomic.c index b08c260b86..a64fb67bb4 100644 --- a/src/system/libroot/os/atomic.c +++ b/src/system/libroot/os/atomic.c @@ -108,7 +108,7 @@ atomic_get64(int64 *value) #endif /* ATOMIC64_FUNCS_ARE_SYSCALLS */ -#ifdef __ARM__ +#if defined(__arm__) /* GCC compatibility: libstdc++ needs this one. * TODO: Update libstdc++ and drop this. diff --git a/src/system/libroot/posix/stdlib/strtod.c b/src/system/libroot/posix/stdlib/strtod.c index 1dc2e54dd3..32a23149f8 100644 --- a/src/system/libroot/posix/stdlib/strtod.c +++ b/src/system/libroot/posix/stdlib/strtod.c @@ -126,8 +126,7 @@ #if defined(__i386__) || defined(__ia64__) || defined(__alpha__) || \ defined(__sparc64__) || defined(__powerpc__) || defined(__POWERPC__) || \ defined(__m68k__) || defined(__M68K__) || defined(__arm__) || \ - defined(__ARM__) || defined(__mipsel__) || defined(__MIPSEL__) || \ - defined(__x86_64__) + defined(__mipsel__) || defined(__MIPSEL__) || defined(__x86_64__)1 # include # if BYTE_ORDER == BIG_ENDIAN # define IEEE_BIG_ENDIAN diff --git a/src/system/libroot/posix/string/arch/generic/memset.c b/src/system/libroot/posix/string/arch/generic/memset.c index bd75a763f4..17c2b06527 100644 --- a/src/system/libroot/posix/string/arch/generic/memset.c +++ b/src/system/libroot/posix/string/arch/generic/memset.c @@ -18,7 +18,7 @@ memset(void *s, int c, size_t count) return s; } -#ifdef __ARM__ +#if defined(__arm__) void* __aeabi_memset(void *s, int c, size_t count) __attribute__((__alias__("memset"))); #endif diff --git a/src/system/libroot/posix/string/memmove.c b/src/system/libroot/posix/string/memmove.c index 38974d8fdc..0fe136336d 100644 --- a/src/system/libroot/posix/string/memmove.c +++ b/src/system/libroot/posix/string/memmove.c @@ -70,7 +70,7 @@ memmove(void* dest, void const* src, size_t count) return dest; } -#ifdef __ARM__ +#if defined(__arm__) void* __aeabi_memmove(void* dest, void const* src, size_t count) __attribute__((__alias__("memmove"))); #endif