Closed Bug 1411142 Opened 7 years ago Closed 7 years ago

Resolve enum-compare warnings exposed by MinGW build

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: tjr, Assigned: tjr)

References

Details

Attachments

(1 file)

I think there's a few of these, but here's the first:

> /builds/worker/workspace/build/src/dom/plugins/ipc/hangui/MiniShmBase.h:303:23: error: comparison between 'enum mozilla::plugins::MiniShmBase::MiniShmInit::identifier_t' and 'enum mozilla::plugins::MiniShmBase::ReservedCodes' [-Werror=enum-compare]
>          T::identifier > RESERVED_CODE_LAST) {
>          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Second: 

>  /builds/worker/workspace/build/src/dom/plugins/ipc/hangui/MiniShmBase.h: In instantiation of 'nsresult mozilla::plugins::MiniShmBase::GetWritePtr(T*&) [with T = mozilla::plugins::PluginHangUICommand]':
>  /builds/worker/workspace/build/src/dom/plugins/ipc/PluginHangUIParent.cpp:334:41:   required from here
>  /builds/worker/workspace/build/src/dom/plugins/ipc/hangui/MiniShmBase.h:133:23: error: comparison between 'enum mozilla::plugins::PluginHangUICommand::<anonymous>' and 'enum mozilla::plugins::MiniShmBase::ReservedCodes' [-Werror=enum-compare]
>           T::identifier <= RESERVED_CODE_LAST) {
>           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Attachment #8921334 - Flags: review?(jld)
Comment on attachment 8921334 [details]
Bug 1411142 Cast enums to int to silence warning about comparing enums of different types

https://reviewboard.mozilla.org/r/192340/#review197826

The template magic here is a little weird — in general that comparison is going to be between two different enums (with different ranges), so the int cast looks like the right way to deal with that.
Attachment #8921334 - Flags: review?(jld) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/92b3336f6941
Cast enums to int to silence warning about comparing enums of different types r=jld
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/92b3336f6941
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: