Closed
Bug 795238
Opened 13 years ago
Closed 13 years ago
Ensure nsresult is unsigned
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: neil, Assigned: ehsan.akhgari)
References
Details
Attachments
(1 file)
803 bytes,
patch
|
ayg
:
review+
|
Details | Diff | Splinter Review |
After the main nsresult enum landing, there were several places where MSVC was interpreting nsresult as signed even though its range exceeds INT_MAX. We should use MSVC's enum base type extension to force MSVC to treat it as unsigned. This should also allow us to back out the MSVC-specific workarounds.
Comment 1•13 years ago
|
||
That extension actually became part of the C++11 standard. The right way to check for this is #if defined(MOZ_HAVE_CXX11_ENUM_TYPE), which currently will be true for _MSC_VER >= 1400 (see mfbt/Attributes.h). FWIW, the C++ standard already guarantees that the underlying type in our case must be at least the size of uint32_t, so this is a bug in MSVC per spec (as well as per common sense!).
It looks like bug 794734 already added this workaround for MSVC 64-bit. IMO, the line
#if defined(__cplusplus) && defined(_MSC_VER) && defined(_M_X64)
should just be changed to
#if defined(__cplusplus) && defined(MOZ_HAVE_CXX11_ENUM_TYPE)
and that should be fine.
Assignee | ||
Comment 2•13 years ago
|
||
Reporter | ||
Comment 3•13 years ago
|
||
So, do I need to file a separate bug on backing out the previous MSVC-specific workarounds?
Assignee | ||
Comment 4•13 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #3)
> So, do I need to file a separate bug on backing out the previous
> MSVC-specific workarounds?
Sure.
Comment 5•13 years ago
|
||
Comment on attachment 666006 [details] [diff] [review]
Patch (v1)
LGTM. Sorry for the long delay -- I should have changed my Bugzilla name to note I was away for a week or so.
Attachment #666006 -
Flags: review?(ayg) → review+
Assignee | ||
Comment 6•13 years ago
|
||
Target Milestone: --- → mozilla19
Assignee | ||
Comment 7•13 years ago
|
||
Pushed a follow-up:
https://hg.mozilla.org/integration/mozilla-inbound/rev/52c773840b00
We need mozilla/Attributes.h #included there since that's where MOZ_HAVE_CXX11_ENUM_TYPE is defined.
Comment 8•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/13d96461b2da
https://hg.mozilla.org/mozilla-central/rev/52c773840b00
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•