Backed out changeset 88fbb17e3c20 (bug 1865637) for causing animation related mochite...
[gecko.git] / mfbt / tests / TestWinArchDefs.cpp
blobd8965d3d7c27765ad3221615af81cf6917806432
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/. */
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.
12 // If this test compiles, it is successful. See bug 1866562 for an example
13 // where mingwclang builds were failing to compile this code.
15 #if defined(_M_IX86)
16 constexpr auto kIX86 = _M_IX86;
17 #endif
19 #if defined(_M_X64)
20 constexpr auto kX64 = _M_X64;
21 #endif
23 #if defined(_M_AMD64)
24 constexpr auto kAMD64 = _M_AMD64;
25 #endif
27 #if defined(_M_ARM)
28 constexpr auto kARM = _M_ARM;
29 #endif
31 #if defined(_M_ARM64)
32 constexpr auto kARM64 = _M_ARM64;
33 #endif
35 #include <windows.h>
37 #if defined(_M_IX86)
38 static_assert(kIX86 == _M_IX86);
39 #endif
41 #if defined(_M_X64)
42 static_assert(kX64 == _M_X64);
43 #endif
45 #if defined(_M_AMD64)
46 static_assert(kAMD64 == _M_AMD64);
47 #endif
49 #if defined(_M_ARM)
50 static_assert(kARM == _M_ARM);
51 #endif
53 #if defined(_M_ARM64)
54 static_assert(kARM64 == _M_ARM64);
55 #endif
57 // If this test compiles, it is successful.
58 int main() { return 0; }