Closed Bug 609434 Opened 9 years ago Closed 9 years ago

warning C4065: switch statement contains 'default' but no 'case' labels in IPC IPDL files

Categories

(Core :: IPC, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: RyanVM, Assigned: Mitch)

References

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

Warnings like the below are sprinkled throughout the build on Windows.

c:/mozbuild/mozilla-central/objdir-fx/ipc/ipdl/PTestDataStructuresSubParent.cpp(182) : warning C4065: switch statement contains 'default' but no 'case' labels

Code looks like this:
void
PTestDataStructuresSubParent::RemoveManagee(
        int32 aProtocolId,
        ChannelListener* aListener)
{
    switch (aProtocolId) {
    default:
        {
            NS_RUNTIMEABORT("unreached");
            return;
        }
    }
}

Ben, any ideas on an approach to fixing this?
Whiteboard: [build_warning]
Sigh.  I guess this isn't an entirely vacuous warning.  We would need to fix this by adding yet another special case to the part of the IPDL compiler that generates this code [1].  Basically, just emit the abort when there aren't managees.  I can hook up this patch but it's very far down my list right now.

[1] http://mxr.mozilla.org/mozilla-central/source/ipc/ipdl/ipdl/lower.py#3359
Duplicate of this bug: 587502
Chris, any chance that it's moved up higher on your list in the last 5 months? :-)
Not really, but the patch doesn't have to be written by me :).
What line # does this start on now? I don't believe the link in comment #1 is correct anymore.
Attached patch PatchSplinter Review
Assignee: nobody → mitchell.field
Status: NEW → ASSIGNED
Attachment #522224 - Flags: review?(jones.chris.g)
Comment on attachment 522224 [details] [diff] [review]
Patch

>+          else:
>+            default = StmtBlock()
>+            default.addstmts([ _runtimeAbort('unreached'), StmtReturn() ])
>+            switchontype.addcase(DefaultLabel(), default)
>+            removemanagee.addstmt(switchontype)

Drop the for-else, it doesn't make sense here.  Just move this out in the same block as the for-stmt.

r=me with that.
Attachment #522224 - Flags: review?(jones.chris.g) → review+
http://hg.mozilla.org/mozilla-central/rev/44056696abfc
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
OS: Windows 7 → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.