Bug 1491615 - Re-enable warnings-as-errors on clang-cl in gfx/layers/. r=jrmuizel
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sun, 16 Sep 2018 08:00:02 +0900
changeset 436623 b58b63ffcf08
parent 436622 1cef5144d067
child 436624 7ed950e60f3c
push id34651
push usernerli@mozilla.com
push dateSun, 16 Sep 2018 09:50:45 +0000
treeherdermozilla-central@7ed950e60f3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1491615
milestone64.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 1491615 - Re-enable warnings-as-errors on clang-cl in gfx/layers/. r=jrmuizel * TexSlot caused warnings because some TexSlot constants are unused. Since some files under gfx/vr/ want TexSlot constants, I moved the definition to CompositionD3D11.h. (But I didn't fix gfx/vr/ in this patch.) * Since MOZ_ASSERT_UNREACHABLE falls through in release builds, we should assign a value even in the `default` case instead of invoking UB. If we do not care about UB, we should use MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE.
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.h
gfx/layers/d3d11/MLGDeviceD3D11.cpp
gfx/layers/moz.build
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -43,26 +43,16 @@ namespace mozilla {
 using namespace gfx;
 
 namespace layers {
 
 bool CanUsePartialPresents(ID3D11Device* aDevice);
 
 const FLOAT sBlendFactor[] = { 0, 0, 0, 0 };
 
-namespace TexSlot {
-  static const int RGB = 0;
-  static const int Y = 1;
-  static const int Cb = 2;
-  static const int Cr = 3;
-  static const int RGBWhite = 4;
-  static const int Mask = 5;
-  static const int Backdrop = 6;
-}
-
 CompositorD3D11::CompositorD3D11(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
   : Compositor(aWidget, aParent)
   , mAttachments(nullptr)
   , mHwnd(nullptr)
   , mDisableSequenceForNextFrame(false)
   , mAllowPartialPresents(false)
   , mIsDoubleBuffered(false)
   , mVerifyBuffersFailed(false)
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -235,12 +235,22 @@ private:
   gfx::IntRegion mBackBufferInvalid;
   // This is the clip rect applied to the default DrawTarget (i.e. the window)
   gfx::IntRect mCurrentClip;
 
   bool mVerifyBuffersFailed;
   bool mUseMutexOnPresent;
 };
 
+namespace TexSlot {
+  static const int RGB = 0;
+  static const int Y = 1;
+  static const int Cb = 2;
+  static const int Cr = 3;
+  static const int RGBWhite = 4;
+  static const int Mask = 5;
+  static const int Backdrop = 6;
+}
+
 }
 }
 
 #endif
--- a/gfx/layers/d3d11/MLGDeviceD3D11.cpp
+++ b/gfx/layers/d3d11/MLGDeviceD3D11.cpp
@@ -1578,16 +1578,17 @@ MLGDeviceD3D11::SetPrimitiveTopology(MLG
     topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
     break;
   case MLGPrimitiveTopology::UnitTriangle:
     SetVertexBuffer(0, mUnitTriangleVB, sizeof(float) * 3, 0);
     topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
     break;
   default:
     MOZ_ASSERT_UNREACHABLE("Unknown topology");
+    topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
     break;
   }
 
   mCtx->IASetPrimitiveTopology(topology);
 }
 
 RefPtr<MLGBuffer>
 MLGDeviceD3D11::CreateBuffer(MLGBufferType aType,
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -577,11 +577,8 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
     CXXFLAGS += [
         '-Wno-maybe-uninitialized'
     ]
 
 if CONFIG['MOZ_ENABLE_SKIA']:
   UNIFIED_SOURCES += [
     'composite/PaintCounter.cpp',
   ]
-
-if CONFIG['CC_TYPE'] == 'clang-cl':
-    AllowCompilerWarnings()  # workaround for bug 1090497