Fix some clang warnings with -Wmissing-braces in ANGLE.
Clang warns if there are missing braces around a subobject
initializer. The most common idiom that triggers this is:
STRUCT s = {0};
which can be more simply written as:
STRUCT s = {};
BUG=505297
Change-Id: Ib4513ee195d43e7c4a4a2f46c328866f0023a2a5
Reviewed-on: https://chromium-review.googlesource.com/282921
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Tested-by: Kenneth Russell <kbr@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index 617080b..5374613 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -1061,7 +1061,7 @@
mShaderVersion = vertexShaderD3D->getShaderVersion();
// Map the varyings to the register file
- VaryingPacking packing = { NULL };
+ VaryingPacking packing = {};
*registers = mDynamicHLSL->packVaryings(infoLog, packing, fragmentShaderD3D, vertexShaderD3D, transformFeedbackVaryings);
if (*registers < 0)
diff --git a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
index 7a8ddd7..a050284 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
@@ -509,7 +509,7 @@
ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget>& rts)
{
- ClearBlendInfo blendKey = { 0 };
+ ClearBlendInfo blendKey = {};
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
if (i < rts.size())
diff --git a/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp b/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
index e1bfdef..53fac65 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
@@ -123,7 +123,7 @@
mRenderer(renderer),
mQuery(NULL)
{
- LARGE_INTEGER counterFreqency = { 0 };
+ LARGE_INTEGER counterFreqency = {};
BOOL success = QueryPerformanceFrequency(&counterFreqency);
UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
@@ -168,7 +168,7 @@
return gl::Error(GL_NO_ERROR);
}
- LARGE_INTEGER currentCounter = { 0 };
+ LARGE_INTEGER currentCounter = {};
BOOL success = QueryPerformanceCounter(¤tCounter);
UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
diff --git a/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp b/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
index 1eade97..5678581 100644
--- a/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
@@ -97,7 +97,7 @@
const FramebufferD3D *framebufferD3D = GetImplAs<FramebufferD3D>(framebuffer);
const gl::AttachmentList &colorbuffers = framebufferD3D->getColorAttachmentsForRender(mRenderer->getWorkarounds());
- BlendStateKey key = { 0 };
+ BlendStateKey key = {};
key.blendState = blendState;
for (size_t colorAttachment = 0; colorAttachment < colorbuffers.size(); ++colorAttachment)
{
@@ -209,7 +209,7 @@
return gl::Error(GL_OUT_OF_MEMORY, "Internal error, RenderStateCache is not initialized.");
}
- RasterizerStateKey key = { 0 };
+ RasterizerStateKey key = {};
key.rasterizerState = rasterState;
key.scissorEnabled = scissorEnabled;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 4438229..b8600de 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -502,7 +502,7 @@
// If DXGI1.2 is available then IDXGIAdapter2::GetDesc2 can be used to get the actual hardware values.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3 && dxgiAdapter2 != NULL)
{
- DXGI_ADAPTER_DESC2 adapterDesc2 = { 0 };
+ DXGI_ADAPTER_DESC2 adapterDesc2 = {};
result = dxgiAdapter2->GetDesc2(&adapterDesc2);
if (SUCCEEDED(result))
{
diff --git a/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp
index 96a8dc8..e74cba7 100644
--- a/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp
@@ -71,7 +71,7 @@
return result;
}
- DXGI_SWAP_CHAIN_DESC swapChainDesc = { 0 };
+ DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
swapChainDesc.BufferCount = 1;
swapChainDesc.BufferDesc.Format = format;
swapChainDesc.BufferDesc.Width = width;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index b04309c..c8f247d 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -1168,8 +1168,8 @@
mCurFar = actualZFar;
mCurDepthFront = depthFront;
- dx_VertexConstants vc = {0};
- dx_PixelConstants pc = {0};
+ dx_VertexConstants vc = {};
+ dx_PixelConstants pc = {};
vc.viewAdjust[0] = (float)((actualViewport.width - (int)dxViewport.Width) + 2 * (actualViewport.x - (int)dxViewport.X) - 1) / dxViewport.Width;
vc.viewAdjust[1] = (float)((actualViewport.height - (int)dxViewport.Height) + 2 * (actualViewport.y - (int)dxViewport.Y) - 1) / dxViewport.Height;
diff --git a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
index 2b62a19..52f9b47 100644
--- a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
@@ -488,7 +488,7 @@
// textureRG is emulated and not performant.
extensions->textureRG = false;
- D3DADAPTER_IDENTIFIER9 adapterId = { 0 };
+ D3DADAPTER_IDENTIFIER9 adapterId = {};
if (SUCCEEDED(d3d9->GetAdapterIdentifier(adapter, 0, &adapterId)))
{
// ATI cards on XP have problems with non-power-of-two textures.