Closed Bug 1866562 Opened 5 months ago Closed 5 months ago

_M_X64 definition is not consistent between regular builds and mingwclang x64 builds

Categories

(Firefox Build System :: General: Unsupported Platforms, defect)

Desktop
Windows
defect

Tracking

(firefox122 fixed)

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: yannis, Assigned: yannis)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

I initially misunderstood my actual problem, so here it is. This code results in successful regular builds but failed MinGW builds:

#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 or stdint.h (the list in unclear to me), likely because they end up including _mingw_mac.h. (Including stddef.h does not result in defining _M_X64, for example.)

Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: _M_X64 definition is inconsistent in mingwclang x64 builds → _M_X64 definition is not consistent between regular builds and mingwclang x64 builds

This patch makes mingwclang build compile with -include _mingw.h so that
MSVC-style constants are defined from the start of C++ files rather than
at the point where they start including files. This makes mingwclang
builds behave more closely to regular builds, thus potentially avoiding
future backouts for mingwclang build failures and/or successful but
incorrect mingwclang builds.

Assignee: nobody → yjuglaret
Attachment #9367281 - Attachment description: WIP: Bug 1866562 - Make MSVC-style architecture constants consistent in mingwclang builds. r=tjr → Bug 1866562 - Make MSVC-style architecture constants consistent in mingwclang builds. r=tjr
Blocks: mingw-clang
Pushed by yjuglaret@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9d5244ee58a6
Make MSVC-style architecture constants consistent in mingwclang builds. r=tjr
Status: REOPENED → RESOLVED
Closed: 5 months ago5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: