From bfeb9f11270c909b470efec9bf9ff3d32dc55525 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sat, 14 Nov 2015 00:06:58 -0800 Subject: [PATCH] Bug 1224951 - Part 2: Fix -Wunreachable-code warnings in layout. r=dholbert layout/base/nsCSSFrameConstructor.cpp:12067:12: warning: will never be executed [-Wunreachable-code] layout/base/nsPresContext.cpp:2861:10: warning: will never be executed [-Wunreachable-code] layout/generic/nsFrameSetFrame.cpp:730:11: warning: will never be executed [-Wunreachable-code] layout/generic/nsFrameSetFrame.cpp:725:11: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:268:62: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:269:66: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:270:68: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:271:75: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:272:73: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:273:81: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:274:69: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:275:60: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:276:68: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:277:68: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:279:18: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:290:62: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:291:66: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:292:68: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:293:75: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:294:73: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:295:81: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:296:69: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:297:60: warning: will never be executed [-Wunreachable-code] layout/generic/nsSelection.cpp:5657:7: warning: will never be executed [-Wunreachable-code] layout/mathml/nsMathMLmrootFrame.cpp:405:5: warning: will never be executed [-Wunreachable-code] --- layout/base/nsCSSFrameConstructor.cpp | 4 +-- layout/generic/nsFrameSetFrame.cpp | 2 -- layout/generic/nsSelection.cpp | 49 +++++++++++++-------------- layout/mathml/nsMathMLmrootFrame.cpp | 1 - 4 files changed, 25 insertions(+), 31 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 6bdeee645ee6..fffa9479b6bc 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -12062,8 +12062,8 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState, return false; } - // We might have some inline kids for this block. Just reconstruct. - break; + // We might have some inline kids for this block. Just fall out of the + // loop and reconstruct. } while (0); // If we don't have a containing block, start with aFrame and look for one. diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 22a2d274e7c6..36c37e0ef588 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -722,12 +722,10 @@ nsFrameborder GetFrameBorderHelper(nsGenericHTMLElement* aContent) case NS_STYLE_FRAME_YES: case NS_STYLE_FRAME_1: return eFrameborder_Yes; - break; case NS_STYLE_FRAME_NO: case NS_STYLE_FRAME_0: return eFrameborder_No; - break; } } } diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 95604afdae19..1edee6b3aa5e 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -265,43 +265,41 @@ GetIndexFromSelectionType(SelectionType aType) { switch (aType) { - case nsISelectionController::SELECTION_NORMAL: return 0; break; - case nsISelectionController::SELECTION_SPELLCHECK: return 1; break; - case nsISelectionController::SELECTION_IME_RAWINPUT: return 2; break; - case nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT: return 3; break; - case nsISelectionController::SELECTION_IME_CONVERTEDTEXT: return 4; break; - case nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT: return 5; break; - case nsISelectionController::SELECTION_ACCESSIBILITY: return 6; break; - case nsISelectionController::SELECTION_FIND: return 7; break; - case nsISelectionController::SELECTION_URLSECONDARY: return 8; break; - case nsISelectionController::SELECTION_URLSTRIKEOUT: return 9; break; + case nsISelectionController::SELECTION_NORMAL: return 0; + case nsISelectionController::SELECTION_SPELLCHECK: return 1; + case nsISelectionController::SELECTION_IME_RAWINPUT: return 2; + case nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT: return 3; + case nsISelectionController::SELECTION_IME_CONVERTEDTEXT: return 4; + case nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT: return 5; + case nsISelectionController::SELECTION_ACCESSIBILITY: return 6; + case nsISelectionController::SELECTION_FIND: return 7; + case nsISelectionController::SELECTION_URLSECONDARY: return 8; + case nsISelectionController::SELECTION_URLSTRIKEOUT: return 9; default: - return -1; break; + return -1; } /* NOTREACHED */ - return 0; } -static SelectionType +static SelectionType GetSelectionTypeFromIndex(int8_t aIndex) { switch (aIndex) { - case 0: return nsISelectionController::SELECTION_NORMAL; break; - case 1: return nsISelectionController::SELECTION_SPELLCHECK; break; - case 2: return nsISelectionController::SELECTION_IME_RAWINPUT; break; - case 3: return nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT; break; - case 4: return nsISelectionController::SELECTION_IME_CONVERTEDTEXT; break; - case 5: return nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT; break; - case 6: return nsISelectionController::SELECTION_ACCESSIBILITY; break; - case 7: return nsISelectionController::SELECTION_FIND; break; - case 8: return nsISelectionController::SELECTION_URLSECONDARY; break; - case 9: return nsISelectionController::SELECTION_URLSTRIKEOUT; break; + case 0: return nsISelectionController::SELECTION_NORMAL; + case 1: return nsISelectionController::SELECTION_SPELLCHECK; + case 2: return nsISelectionController::SELECTION_IME_RAWINPUT; + case 3: return nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT; + case 4: return nsISelectionController::SELECTION_IME_CONVERTEDTEXT; + case 5: return nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT; + case 6: return nsISelectionController::SELECTION_ACCESSIBILITY; + case 7: return nsISelectionController::SELECTION_FIND; + case 8: return nsISelectionController::SELECTION_URLSECONDARY; + case 9: return nsISelectionController::SELECTION_URLSTRIKEOUT; default: - return nsISelectionController::SELECTION_NORMAL; break; + return nsISelectionController::SELECTION_NORMAL; } /* NOTREACHED */ - return 0; } /* @@ -5669,7 +5667,6 @@ Selection::GetSelectionAnchorGeometry(SelectionRegion aRegion, nsRect* aRect) case nsISelectionController::SELECTION_ANCHOR_REGION: case nsISelectionController::SELECTION_FOCUS_REGION: return GetSelectionEndPointGeometry(aRegion, aRect); - break; case nsISelectionController::SELECTION_WHOLE_SELECTION: break; default: diff --git a/layout/mathml/nsMathMLmrootFrame.cpp b/layout/mathml/nsMathMLmrootFrame.cpp index c4a0de628551..fddbbf528f4d 100644 --- a/layout/mathml/nsMathMLmrootFrame.cpp +++ b/layout/mathml/nsMathMLmrootFrame.cpp @@ -402,7 +402,6 @@ nsMathMLmrootFrame::GetAdditionalStyleContext(int32_t aIndex) const switch (aIndex) { case NS_SQR_CHAR_STYLE_CONTEXT_INDEX: return mSqrChar.GetStyleContext(); - break; default: return nullptr; }