Jelajahi Sumber

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.
Andreas Kling 6 tahun lalu
induk
melakukan
c452aa891f
2 mengubah file dengan 13 tambahan dan 1 penghapusan
  1. 12 0
      AK/Platform.h
  2. 1 1
      Makefile.common

+ 12 - 0
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)
+

+ 1 - 1
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