Bug 1223258 - Fix -Wunreachable-code warnings in widget. r=masayuki
authorChris Peterson <cpeterson@mozilla.com>
Sun, 08 Nov 2015 22:46:00 -0800
changeset 274596 0bff869df8f69901447d6d8feca1f7aba7a2f336
parent 274595 dec5fee37b1232542d0561633df4916a0acabc73
child 274597 1a8bc262190e5e647c59e17311f62457ea05d4aa
push id29734
push usercbook@mozilla.com
push dateMon, 30 Nov 2015 12:19:25 +0000
treeherdermozilla-central@a18630f9ab42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1223258
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 1223258 - Fix -Wunreachable-code warnings in widget. r=masayuki widget/tests/TestAppShellSteadyState.cpp:397:5: warning: code will never be executed [-Wunreachable-code] widget\widgetutils.cpp(95) : warning C4702: unreachable code widget\mouseevents.h(97) : warning C4702: unreachable code widget\textevents.h(492) : warning C4702: unreachable code
widget/MouseEvents.h
widget/TextEvents.h
widget/WidgetUtils.cpp
widget/tests/TestAppShellSteadyState.cpp
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -89,17 +89,16 @@ protected:
  }
 
 public:
   virtual WidgetMouseEventBase* AsMouseEventBase() override { return this; }
 
   virtual WidgetEvent* Duplicate() const override
   {
     MOZ_CRASH("WidgetMouseEventBase must not be most-subclass");
-    return nullptr;
   }
 
   /// The possible related target
   nsCOMPtr<nsISupports> relatedTarget;
 
   enum buttonType
   {
     eLeftButton   = 0,
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -484,17 +484,16 @@ public:
   }
 
   virtual WidgetEvent* Duplicate() const override
   {
     // This event isn't an internal event of any DOM event.
     NS_ASSERTION(!IsAllowedToDispatchDOMEvent(),
       "WidgetQueryContentEvent needs to support Duplicate()");
     MOZ_CRASH("WidgetQueryContentEvent doesn't support Duplicate()");
-    return nullptr;
   }
 
   void InitForQueryTextContent(uint32_t aOffset, uint32_t aLength,
                                bool aUseNativeLineBreak = true)
   {
     NS_ASSERTION(mMessage == eQueryTextContent,
                  "wrong initializer is called");
     mInput.mOffset = aOffset;
--- a/widget/WidgetUtils.cpp
+++ b/widget/WidgetUtils.cpp
@@ -87,17 +87,16 @@ nsIntRect RotateRect(nsIntRect aRect,
                        aBounds.height - aRect.y - aRect.height,
                        aRect.width, aRect.height);
     case ROTATION_270:
       return nsIntRect(aBounds.height - aRect.y - aRect.height,
                        aRect.x,
                        aRect.height, aRect.width);
     default:
       MOZ_CRASH("Unknown rotation");
-      return aRect;
   }
 }
 
 namespace widget {
 
 uint32_t
 WidgetUtils::IsTouchDeviceSupportPresent()
 {
--- a/widget/tests/TestAppShellSteadyState.cpp
+++ b/widget/tests/TestAppShellSteadyState.cpp
@@ -386,18 +386,17 @@ Test3(nsIAppShell* aAppShell)
 }
 
 bool
 Test4Internal(nsIAppShell* aAppShell)
 {
 #ifndef XP_WIN
   // Not sure how to test on other platforms.
   return false;
-#endif
-
+#else
   nsCOMPtr<nsIAppShellService> appService =
     do_GetService(NS_APPSHELLSERVICE_CONTRACTID);
   if (!appService) {
     fail("Failed to get appshell service!");
     return false;
   }
 
   nsCOMPtr<nsIURI> uri;
@@ -432,16 +431,17 @@ Test4Internal(nsIAppShell* aAppShell)
                                          listener, false, false)) ||
       NS_FAILED(target->AddEventListener(NS_LITERAL_STRING("load"), listener,
                                          false, false))) {
     fail("Can't add event listeners!");
     return false;
   }
 
   return true;
+#endif
 }
 
 void
 Test4(nsIAppShell* aAppShell)
 {
   if (!Test4Internal(aAppShell)) {
     nsCOMPtr<nsIRunnable> runnable = new NextTestRunnable(aAppShell);
     if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) {