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

RESOLVED FIXED in mozilla33

Status

()

Core
JavaScript Engine
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

unspecified
mozilla33
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
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)

Comment 1

4 years ago
Created 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
(Assignee)

Updated

4 years ago
Assignee: nobody → ehsan
Blocks: 752004
(Assignee)

Updated

4 years ago
Attachment #8439658 - Flags: review?(jorendorff)
(Assignee)

Updated

4 years ago
Attachment #8439658 - Flags: review?(jorendorff) → review?(jwalden+bmo)

Comment 2

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.