From c452aa891fd08d292811b75974a81921c85a7e66 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 9 Jul 2019 15:46:22 +0200 Subject: [PATCH] AK: Add Platform.h with an ARCH() macro. You can currently use this to detect the CPU architecture like so: #if ARCH(I386) ... #elif ARCH(X86_64) ... #else ... #endif This will be helpful for separating out architecture-specific code blocks. --- AK/Platform.h | 12 ++++++++++++ Makefile.common | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 AK/Platform.h diff --git a/AK/Platform.h b/AK/Platform.h new file mode 100644 index 0000000000..55eba697cd --- /dev/null +++ b/AK/Platform.h @@ -0,0 +1,12 @@ +#pragma once + +#ifdef __i386__ +#define AK_ARCH_I386 1 +#endif + +#ifdef __x86_64__ +#define AK_ARCH_X86_64 1 +#endif + +#define ARCH(arch) (defined(AK_ARCH_##arch) && AK_ARCH_##arch) + diff --git a/Makefile.common b/Makefile.common index 2ec359732f..4320617826 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,6 +1,6 @@ ARCH_FLAGS = STANDARD_FLAGS = -std=c++17 -Wno-sized-deallocation -fno-sized-deallocation -WARNING_FLAGS = -Werror -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough +WARNING_FLAGS = -Werror -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-expansion-to-defined FLAVOR_FLAGS = -fno-exceptions -fno-rtti OPTIMIZATION_FLAGS = -Os