Closed Bug 728512 Opened 8 years ago Closed 8 years ago
_ASSERT(cond, "message") doesn't work on MSVC due to a compiler bug
It turns out the two-argument form of the MOZ_ASSERT macro improperly expands on MSVC, with the result that MOZ_ASSERT(false, "!!!") won't trigger. That's really not good. Basically it seems MSVC treats __VA_ARGS__ as a single token when expanding it in macro argument lists, rather than as a variadic number of tokens. Here's the bug report: http://connect.microsoft.com/VisualStudio/feedback/details/380090/variadic-macro-replacement This comment suggests the glimmer of a workaround. http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/ The way we use count arguments gets used a bit more trickily than there, tho, so the ultimate fix is not quite as simple as that. I've tested this on MSVC, gcc (including on the demented version on OS X), and clang. According to the .i files that get generated for the two-argument form, this should work correctly everywhere.
Attachment #598475 - Flags: review?(mh+mozilla)
Attachment #598475 - Flags: review?(mh+mozilla) → review+
Target Milestone: --- → mozilla13
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Comment on attachment 653136 [details] [diff] [review] and 733002: add support for labels to DataChannels Uploaded to wrong bug, sorry
Attachment #653136 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.