summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-09 15:46:22 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-09 15:48:04 +0200
commitc452aa891fd08d292811b75974a81921c85a7e66 (patch)
tree861c07e9359962df8de038508682000d03c0cb9f
parent149fd7e045028d658f0858a62d743ed2e923810a (diff)
downloadserenity-c452aa891fd08d292811b75974a81921c85a7e66.zip
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.
-rw-r--r--AK/Platform.h12
-rw-r--r--Makefile.common2
2 files changed, 13 insertions, 1 deletions
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