tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PlatformMacros.h (3665B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef PLATFORM_MACROS_H
      7 #define PLATFORM_MACROS_H
      8 
      9 // Define platform selection macros in a consistent way. Don't add anything
     10 // else to this file, so it can remain freestanding. The primary factorisation
     11 // is on (ARCH,OS) pairs ("PLATforms") but ARCH_ and OS_ macros are defined
     12 // too, since they are sometimes convenient.
     13 //
     14 // Note: "GP" is short for "Gecko Profiler".
     15 
     16 #undef GP_PLAT_x86_android
     17 #undef GP_PLAT_amd64_android
     18 #undef GP_PLAT_arm_android
     19 #undef GP_PLAT_arm64_android
     20 #undef GP_PLAT_x86_linux
     21 #undef GP_PLAT_amd64_linux
     22 #undef GP_PLAT_arm_linux
     23 #undef GP_PLAT_mips64_linux
     24 #undef GP_PLAT_amd64_darwin
     25 #undef GP_PLAT_arm64_darwin
     26 #undef GP_PLAT_x86_windows
     27 #undef GP_PLAT_amd64_windows
     28 #undef GP_PLAT_arm64_windows
     29 
     30 #undef GP_ARCH_x86
     31 #undef GP_ARCH_amd64
     32 #undef GP_ARCH_arm
     33 #undef GP_ARCH_arm64
     34 #undef GP_ARCH_mips64
     35 
     36 #undef GP_OS_android
     37 #undef GP_OS_linux
     38 #undef GP_OS_darwin
     39 #undef GP_OS_windows
     40 
     41 // We test __ANDROID__ before __linux__ because __linux__ is defined on both
     42 // Android and Linux, whereas GP_OS_android is not defined on vanilla Linux.
     43 
     44 #if defined(__ANDROID__) && defined(__i386__)
     45 #  define GP_PLAT_x86_android 1
     46 #  define GP_ARCH_x86 1
     47 #  define GP_OS_android 1
     48 
     49 #elif defined(__ANDROID__) && defined(__x86_64__)
     50 #  define GP_PLAT_amd64_android 1
     51 #  define GP_ARCH_amd64 1
     52 #  define GP_OS_android 1
     53 
     54 #elif defined(__ANDROID__) && defined(__arm__)
     55 #  define GP_PLAT_arm_android 1
     56 #  define GP_ARCH_arm 1
     57 #  define GP_OS_android 1
     58 
     59 #elif defined(__ANDROID__) && defined(__aarch64__)
     60 #  define GP_PLAT_arm64_android 1
     61 #  define GP_ARCH_arm64 1
     62 #  define GP_OS_android 1
     63 
     64 #elif defined(__linux__) && defined(__i386__)
     65 #  define GP_PLAT_x86_linux 1
     66 #  define GP_ARCH_x86 1
     67 #  define GP_OS_linux 1
     68 
     69 #elif defined(__linux__) && defined(__x86_64__)
     70 #  define GP_PLAT_amd64_linux 1
     71 #  define GP_ARCH_amd64 1
     72 #  define GP_OS_linux 1
     73 
     74 #elif defined(__linux__) && defined(__arm__)
     75 #  define GP_PLAT_arm_linux 1
     76 #  define GP_ARCH_arm 1
     77 #  define GP_OS_linux 1
     78 
     79 #elif defined(__linux__) && defined(__aarch64__)
     80 #  define GP_PLAT_arm64_linux 1
     81 #  define GP_ARCH_arm64 1
     82 #  define GP_OS_linux 1
     83 
     84 #elif defined(__linux__) && defined(__mips64)
     85 #  define GP_PLAT_mips64_linux 1
     86 #  define GP_ARCH_mips64 1
     87 #  define GP_OS_linux 1
     88 
     89 #elif defined(__APPLE__) && defined(__aarch64__)
     90 #  define GP_PLAT_arm64_darwin 1
     91 #  define GP_ARCH_arm64 1
     92 #  define GP_OS_darwin 1
     93 
     94 #elif defined(__APPLE__) && defined(__x86_64__)
     95 #  define GP_PLAT_amd64_darwin 1
     96 #  define GP_ARCH_amd64 1
     97 #  define GP_OS_darwin 1
     98 
     99 #elif defined(__FreeBSD__) && defined(__x86_64__)
    100 #  define GP_PLAT_amd64_freebsd 1
    101 #  define GP_ARCH_amd64 1
    102 #  define GP_OS_freebsd 1
    103 
    104 #elif defined(__FreeBSD__) && defined(__aarch64__)
    105 #  define GP_PLAT_arm64_freebsd 1
    106 #  define GP_ARCH_arm64 1
    107 #  define GP_OS_freebsd 1
    108 
    109 #elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
    110    (defined(_M_IX86) || defined(__i386__))
    111 #  define GP_PLAT_x86_windows 1
    112 #  define GP_ARCH_x86 1
    113 #  define GP_OS_windows 1
    114 
    115 #elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
    116    (defined(_M_X64) || defined(__x86_64__))
    117 #  define GP_PLAT_amd64_windows 1
    118 #  define GP_ARCH_amd64 1
    119 #  define GP_OS_windows 1
    120 
    121 #elif defined(_MSC_VER) && defined(_M_ARM64)
    122 #  define GP_PLAT_arm64_windows 1
    123 #  define GP_ARCH_arm64 1
    124 #  define GP_OS_windows 1
    125 
    126 #else
    127 #  error "Unsupported platform"
    128 #endif
    129 
    130 #endif /* ndef PLATFORM_MACROS_H */