Bug 1224951 - Part 2: Fix -Wunreachable-code warnings in layout. r=dholbert
authorChris Peterson <cpeterson@mozilla.com>
Sat, 14 Nov 2015 00:06:58 -0800
changeset 307624 597c3c78da4aaeea391119a1d0887eff3baba6fe
parent 307623 be237dc0a0b5d8b5b8c0c484bcf8c175970ff52e
child 307625 ef2ee7ebb2503f1af7699db407dc09777184243a
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1224951, 12067
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsSelection.cpp
layout/mathml/nsMathMLmrootFrame.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -12057,18 +12057,18 @@ nsCSSFrameConstructor::WipeContainingBlo
     }
 
     // We're adding some kids to a block part of an {ib} split.  If all the
     // kids are blocks, we don't need to reconstruct.
     if (aItems.AreAllItemsBlock()) {
       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.
   if (!aContainingBlock) {
     aContainingBlock = aFrame;
   }
 
   // To find the right block to reframe, just walk up the tree until we find a
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -717,22 +717,20 @@ nsFrameborder GetFrameBorderHelper(nsGen
   if (nullptr != aContent) {
     const nsAttrValue* attr = aContent->GetParsedAttr(nsGkAtoms::frameborder);
     if (attr && attr->Type() == nsAttrValue::eEnum) {
       switch (attr->GetEnumValue())
       {
         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;
       }
     }
   }
   return eFrameborder_Notset;
 }
 
 nsFrameborder nsHTMLFramesetFrame::GetFrameBorder()
 {
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -260,53 +260,51 @@ nsresult NS_NewDomSelection(nsISelection
   return NS_OK;
 }
 
 static int8_t
 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;
 }
 
 /*
 The limiter is used specifically for the text areas and textfields
 In that case it is the DIV tag that is anonymously created for the text
 areas/fields.  Text nodes and BR nodes fall beneath it.  In the case of a 
 BR node the limiter will be the parent and the offset will point before or
 after the BR node.  In the case of the text node the parent content is 
@@ -5664,17 +5662,16 @@ Selection::GetSelectionAnchorGeometry(Se
   NS_ENSURE_TRUE(aRect, nullptr);
 
   aRect->SetRect(0, 0, 0, 0);
 
   switch (aRegion) {
     case nsISelectionController::SELECTION_ANCHOR_REGION:
     case nsISelectionController::SELECTION_FOCUS_REGION:
       return GetSelectionEndPointGeometry(aRegion, aRect);
-      break;
     case nsISelectionController::SELECTION_WHOLE_SELECTION:
       break;
     default:
       return nullptr;
   }
 
   NS_ASSERTION(aRegion == nsISelectionController::SELECTION_WHOLE_SELECTION,
     "should only be SELECTION_WHOLE_SELECTION here");
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -397,17 +397,16 @@ nsMathMLmrootFrame::GetIntrinsicISizeMet
 // ----------------------
 // the Style System will use these to pass the proper style context to our MathMLChar
 nsStyleContext*
 nsMathMLmrootFrame::GetAdditionalStyleContext(int32_t aIndex) const
 {
   switch (aIndex) {
   case NS_SQR_CHAR_STYLE_CONTEXT_INDEX:
     return mSqrChar.GetStyleContext();
-    break;
   default:
     return nullptr;
   }
 }
 
 void
 nsMathMLmrootFrame::SetAdditionalStyleContext(int32_t          aIndex, 
                                               nsStyleContext*  aStyleContext)