I initially misunderstood my actual problem, so here it is. This code results in successful regular builds but failed MinGW builds: ```c++ #if defined(_M_X64) constexpr bool kInitiallyTargetingX64 = true; #else constexpr bool kInitiallyTargetingX64 = false; #endif #include <stdint.h> #if defined(_M_X64) constexpr bool kFinallyTargetingX64 = true; #else constexpr bool kFinallyTargetingX64 = false; #endif static_assert(kInitiallyTargetingX64 == kFinallyTargetingX64); ``` In regular builds, `_M_X64` is defined directly by the compiler if targeting x64. When you can compile something `_M_X64` will be available from the start of the C++ file. However in mingwclang builds, `_M_X64` is not directly defined like this. It only appears after including some header files, such as [`windows.h`](https://treeherder.mozilla.org/jobs?revision=05a681a41e8a0eae6f35030e908798d04c7162fa&repo=try) or [`stdint.h`](https://treeherder.mozilla.org/jobs?revision=9445236bacca2c6b17e9571a944c0f154b8ae1b0&repo=try) (the list in unclear to me), likely because they end up including [`_mingw_mac.h`](https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/crt/_mingw_mac.h). Including [`stddef.h`](https://treeherder.mozilla.org/jobs?revision=fda40c1f39e775c9ccd20a63d2b4e37dbfc0b79d&repo=try) does not result in defining `_M_X64`, for example.
Bug 1866562 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I initially misunderstood my actual problem, so here it is. This code results in successful regular builds but failed MinGW builds: ```c++ #if defined(_M_X64) constexpr bool kInitiallyTargetingX64 = true; #else constexpr bool kInitiallyTargetingX64 = false; #endif #include <stdint.h> #if defined(_M_X64) constexpr bool kFinallyTargetingX64 = true; #else constexpr bool kFinallyTargetingX64 = false; #endif static_assert(kInitiallyTargetingX64 == kFinallyTargetingX64); ``` In regular builds, `_M_X64` is defined directly by the compiler if targeting x64. When you compile something `_M_X64` will be available from the start of the C++ file. However in mingwclang builds, `_M_X64` is not directly defined like this. It only appears after including some header files, such as [`windows.h`](https://treeherder.mozilla.org/jobs?revision=05a681a41e8a0eae6f35030e908798d04c7162fa&repo=try) or [`stdint.h`](https://treeherder.mozilla.org/jobs?revision=9445236bacca2c6b17e9571a944c0f154b8ae1b0&repo=try) (the list in unclear to me), likely because they end up including [`_mingw_mac.h`](https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/crt/_mingw_mac.h). Including [`stddef.h`](https://treeherder.mozilla.org/jobs?revision=fda40c1f39e775c9ccd20a63d2b4e37dbfc0b79d&repo=try) does not result in defining `_M_X64`, for example.
I initially misunderstood my actual problem, so here it is. This code results in successful regular builds but failed MinGW builds: ```c++ #if defined(_M_X64) constexpr bool kInitiallyTargetingX64 = true; #else constexpr bool kInitiallyTargetingX64 = false; #endif #include <stdint.h> #if defined(_M_X64) constexpr bool kFinallyTargetingX64 = true; #else constexpr bool kFinallyTargetingX64 = false; #endif static_assert(kInitiallyTargetingX64 == kFinallyTargetingX64); ``` In regular builds, `_M_X64` is defined directly by the compiler if targeting x64. When you compile something `_M_X64` will be available from the start of the C++ file. However in mingwclang builds, `_M_X64` is not directly defined like this. It only appears after including some header files, such as [`windows.h`](https://treeherder.mozilla.org/jobs?revision=05a681a41e8a0eae6f35030e908798d04c7162fa&repo=try) or [`stdint.h`](https://treeherder.mozilla.org/jobs?revision=9445236bacca2c6b17e9571a944c0f154b8ae1b0&repo=try) (the list in unclear to me), likely because they end up including [`_mingw_mac.h`](https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/crt/_mingw_mac.h). (Including [`stddef.h`](https://treeherder.mozilla.org/jobs?revision=fda40c1f39e775c9ccd20a63d2b4e37dbfc0b79d&repo=try) does not result in defining `_M_X64`, for example.)