Closed Bug 1345331 Opened 8 years ago Closed 8 years ago

VS2017 build fails with mfbt/Compression.cpp(29): error C2668: '__debugbreak': ambiguous call to overloaded function

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: away, Assigned: away)

References

Details

Attachments

(1 file)

mfbt/Compression.cpp does an #include of lz4.c within an anonymous namespace. This puts all of lz4's includes within the anonymous namespace too. We end up getting conflicts with intrinsic functions:

 0:05.94 D:/build/msys/s/exp/mfbt/Compression.cpp(29): error C2668: '__debugbreak': ambiguous call to overloaded function
 0:05.94 predefined C++ types (compiler internal)(185): note: could be 'void __debugbreak(void)'
 0:05.94 c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\intrin.h(169): note: or       'void `anonymous-namespace'::__debugbreak(void)'

This didn't break with VS2015, because VS2015's xatomic.h does an #include <intrin.h>, long before this lz4 business happens, and the include guards prevent intrin.h from being included a second time within the anon namespace.

VS2017 changed xatomic.h to instead #include <intrin0.h>, so now we no longer have the include guard standing in the way.

This actually came up once before, in 888658 comment 21 (I guess we were on VS2010 then?) and we fixed it by explicitly calling the top-level ::__debugbreak() in MOZ_REALLY_CRASH. But I've recently removed the __cplusplus branch of the crash code, so I propose instead that we just #include <intrin.h> ourselves.
Attachment #8844734 - Flags: review?(jwalden+bmo)
Comment on attachment 8844734 [details] [diff] [review]
include itnrin.h outside of the anonymous namespace

Review of attachment 8844734 [details] [diff] [review]:
-----------------------------------------------------------------

Eeugh.  We probably should use lz4.c in a way that doesn't involve putting #includes in an anonymous namespace.  But we can make that a separate bug or something, and this at least keeps things rolling.
Attachment #8844734 - Flags: review?(jwalden+bmo) → review+
Pushed by dmajor@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2cbbb3db5c53
Include <intrin.h> at top-level before lz4.c can include it in a namespace. r=Waldo
https://hg.mozilla.org/mozilla-central/rev/2cbbb3db5c53
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: