Closed Bug 1024842 Opened 10 years ago Closed 10 years ago

Make StructuredDataType a typed enum in order to avoid C++11 narrowing conversion warnings when the values of the enum are used in the switch statement later in the file

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

This will not only fix the build issue with clang-cl but I believe it will also fix this issue on clang trunk on other platforms as well.
Assignee: nobody → ehsan
Blocks: winclang
Attachment #8439658 - Flags: review?(jorendorff)
Attachment #8439658 - Flags: review?(jorendorff) → review?(jwalden+bmo)
Comment on attachment 8439658 [details] [diff] [review]
Make StructuredDataType a typed enum in order to avoid C++11 narrowing conversion warnings when the values of the enum are used in the switch statement later in the file

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

So clang-cl is trying to make that enum...what type, exactly?  The initializers exceed int32_t range, so it can't pick that type.  And I'd have thought the switches I see in that file, that all switch on a uint32_t, would then do just fine resolving against whatever type ended up picked for the enum, because it'd be a widening conversion.  What am I missing?

Stamping because enum/uint32_t consistency is clearer and all, but I don't understand what the fuss is here, or why it's being made, and I'd like to know what pitfall it is we're avoiding, exactly.
Attachment #8439658 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/774ea1fc3272
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: