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.
This commit is contained in:
Andreas Kling 2019-07-09 15:46:22 +02:00
parent 149fd7e045
commit c452aa891f
Notes: sideshowbarker 2024-07-19 13:21:25 +09:00
2 changed files with 13 additions and 1 deletions

12
AK/Platform.h Normal file
View file

@ -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)

View file

@ -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