tor-browser

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

TestWinArchDefs.cpp (1418B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 // This code tests the consistency of architecture-specific predefined macros
      8 // inherited from MSVC, before and after windows.h inclusion. See
      9 // https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros for a
     10 // list of such macros.
     11 
     12 // If this test compiles, it is successful. See bug 1866562 for an example
     13 // where mingwclang builds were failing to compile this code.
     14 
     15 #if defined(_M_IX86)
     16 constexpr auto kIX86 = _M_IX86;
     17 #endif
     18 
     19 #if defined(_M_X64)
     20 constexpr auto kX64 = _M_X64;
     21 #endif
     22 
     23 #if defined(_M_AMD64)
     24 constexpr auto kAMD64 = _M_AMD64;
     25 #endif
     26 
     27 #if defined(_M_ARM)
     28 constexpr auto kARM = _M_ARM;
     29 #endif
     30 
     31 #if defined(_M_ARM64)
     32 constexpr auto kARM64 = _M_ARM64;
     33 #endif
     34 
     35 #include <windows.h>
     36 
     37 #if defined(_M_IX86)
     38 static_assert(kIX86 == _M_IX86);
     39 #endif
     40 
     41 #if defined(_M_X64)
     42 static_assert(kX64 == _M_X64);
     43 #endif
     44 
     45 #if defined(_M_AMD64)
     46 static_assert(kAMD64 == _M_AMD64);
     47 #endif
     48 
     49 #if defined(_M_ARM)
     50 static_assert(kARM == _M_ARM);
     51 #endif
     52 
     53 #if defined(_M_ARM64)
     54 static_assert(kARM64 == _M_ARM64);
     55 #endif
     56 
     57 // If this test compiles, it is successful.
     58 int main() { return 0; }