From: Karl Schultz Date: Thu, 29 Dec 2016 22:59:06 +0000 (-0700) Subject: build: Cleanup warnings when compiling with clang X-Git-Tag: upstream/1.1.92~1805 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3e18edbfe28f2e06147222d0a9d4f09fceaacea;p=platform%2Fupstream%2FVulkan-Tools.git build: Cleanup warnings when compiling with clang Travis-CI is building this repo with gcc and clang. This commit fixes warnings reported by clang but not by gcc. All the fixes involved adding an extra set of braces in initializers. Change-Id: I88e7841d9ab13afe2e45362b8f85261863d5b7fa --- diff --git a/demos/cube.cpp b/demos/cube.cpp index b28476a..ffbb30c 100644 --- a/demos/cube.cpp +++ b/demos/cube.cpp @@ -525,7 +525,7 @@ struct Demo { vk::CommandBufferUsageFlagBits::eSimultaneousUse); vk::ClearValue const clearValues[2] = { - vk::ClearColorValue(std::array({0.2f, 0.2f, 0.2f, 0.2f})), + vk::ClearColorValue(std::array({{0.2f, 0.2f, 0.2f, 0.2f}})), vk::ClearDepthStencilValue(1.0f, 0u)}; auto const passInfo = diff --git a/demos/smoke/Meshes.cpp b/demos/smoke/Meshes.cpp index ef6e37b..dcdb642 100644 --- a/demos/smoke/Meshes.cpp +++ b/demos/smoke/Meshes.cpp @@ -166,20 +166,20 @@ public: { const std::vector> vertices = { // position normal - { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f }, - { -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f }, - { 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f }, - { 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f }, - { -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f }, + {{ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f }}, + {{ -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f }}, + {{ 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f }}, + {{ 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f }}, + {{ -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f }}, }; const std::vector> faces = { - { 0, 1, 2 }, - { 0, 2, 3 }, - { 0, 3, 4 }, - { 0, 4, 1 }, - { 1, 4, 3 }, - { 1, 3, 2 }, + {{ 0, 1, 2 }}, + {{ 0, 2, 3 }}, + {{ 0, 3, 4 }}, + {{ 0, 4, 1 }}, + {{ 1, 4, 3 }}, + {{ 1, 3, 2 }}, }; mesh.build(vertices, faces); @@ -206,46 +206,46 @@ private: // vertices are from three golden rectangles const std::vector> icosahedron_vertices = { // position normal - { -l1, -l2, 0.0f, -l1, -l2, 0.0f, }, - { l1, -l2, 0.0f, l1, -l2, 0.0f, }, - { l1, l2, 0.0f, l1, l2, 0.0f, }, - { -l1, l2, 0.0f, -l1, l2, 0.0f, }, - - { -l2, 0.0f, -l1, -l2, 0.0f, -l1, }, - { l2, 0.0f, -l1, l2, 0.0f, -l1, }, - { l2, 0.0f, l1, l2, 0.0f, l1, }, - { -l2, 0.0f, l1, -l2, 0.0f, l1, }, - - { 0.0f, -l1, -l2, 0.0f, -l1, -l2, }, - { 0.0f, l1, -l2, 0.0f, l1, -l2, }, - { 0.0f, l1, l2, 0.0f, l1, l2, }, - { 0.0f, -l1, l2, 0.0f, -l1, l2, }, + {{ -l1, -l2, 0.0f, -l1, -l2, 0.0f, }}, + {{ l1, -l2, 0.0f, l1, -l2, 0.0f, }}, + {{ l1, l2, 0.0f, l1, l2, 0.0f, }}, + {{ -l1, l2, 0.0f, -l1, l2, 0.0f, }}, + + {{ -l2, 0.0f, -l1, -l2, 0.0f, -l1, }}, + {{ l2, 0.0f, -l1, l2, 0.0f, -l1, }}, + {{ l2, 0.0f, l1, l2, 0.0f, l1, }}, + {{ -l2, 0.0f, l1, -l2, 0.0f, l1, }}, + + {{ 0.0f, -l1, -l2, 0.0f, -l1, -l2, }}, + {{ 0.0f, l1, -l2, 0.0f, l1, -l2, }}, + {{ 0.0f, l1, l2, 0.0f, l1, l2, }}, + {{ 0.0f, -l1, l2, 0.0f, -l1, l2, }}, }; const std::vector> icosahedron_faces = { // triangles sharing vertex 0 - { 0, 1, 11 }, - { 0, 11, 7 }, - { 0, 7, 4 }, - { 0, 4, 8 }, - { 0, 8, 1 }, + {{ 0, 1, 11 }}, + {{ 0, 11, 7 }}, + {{ 0, 7, 4 }}, + {{ 0, 4, 8 }}, + {{ 0, 8, 1 }}, // adjacent triangles - { 11, 1, 6 }, - { 7, 11, 10 }, - { 4, 7, 3 }, - { 8, 4, 9 }, - { 1, 8, 5 }, + {{ 11, 1, 6 }}, + {{ 7, 11, 10 }}, + {{ 4, 7, 3 }}, + {{ 8, 4, 9 }}, + {{ 1, 8, 5 }}, // triangles sharing vertex 2 - { 2, 3, 10 }, - { 2, 10, 6 }, - { 2, 6, 5 }, - { 2, 5, 9 }, - { 2, 9, 3 }, + {{ 2, 3, 10 }}, + {{ 2, 10, 6 }}, + {{ 2, 6, 5 }}, + {{ 2, 5, 9 }}, + {{ 2, 9, 3 }}, // adjacent triangles - { 10, 3, 7 }, - { 6, 10, 11 }, - { 5, 6, 1 }, - { 9, 5, 8 }, - { 3, 9, 4 }, + {{ 10, 3, 7 }}, + {{ 6, 10, 11 }}, + {{ 5, 6, 1 }}, + {{ 9, 5, 8 }}, + {{ 3, 9, 4 }}, }; mesh_.build(icosahedron_vertices, icosahedron_faces); diff --git a/demos/smoke/Simulation.cpp b/demos/smoke/Simulation.cpp index 67cccfb..36e3f5b 100644 --- a/demos/smoke/Simulation.cpp +++ b/demos/smoke/Simulation.cpp @@ -25,7 +25,7 @@ namespace { class MeshPicker { public: MeshPicker() : - pattern_({ + pattern_({{ Meshes::MESH_PYRAMID, Meshes::MESH_ICOSPHERE, Meshes::MESH_TEAPOT, @@ -36,7 +36,7 @@ public: Meshes::MESH_PYRAMID, Meshes::MESH_PYRAMID, Meshes::MESH_PYRAMID, - }), cur_(-1) + }}), cur_(-1) { } diff --git a/demos/smoke/Smoke.cpp b/demos/smoke/Smoke.cpp index c52cd7c..f3086b9 100644 --- a/demos/smoke/Smoke.cpp +++ b/demos/smoke/Smoke.cpp @@ -40,7 +40,7 @@ struct ShaderParamBlock { Smoke::Smoke(const std::vector &args) : Game("Smoke", args), multithread_(true), use_push_constants_(false), sim_paused_(false), sim_(5000), camera_(2.5f), frame_data_(), - render_pass_clear_value_({{ 0.0f, 0.1f, 0.2f, 1.0f }}), + render_pass_clear_value_({{{ 0.0f, 0.1f, 0.2f, 1.0f }}}), render_pass_begin_info_(), primary_cmd_begin_info_(), primary_cmd_submit_info_() { @@ -335,8 +335,8 @@ void Smoke::create_pipeline() blend_info.pAttachments = &blend_attachment; std::array dynamic_states = { - VK_DYNAMIC_STATE_VIEWPORT, - VK_DYNAMIC_STATE_SCISSOR + {VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR} }; struct VkPipelineDynamicStateCreateInfo dynamic_info = {}; dynamic_info.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;