build: Cleanup warnings when compiling with clang
authorKarl Schultz <karl@lunarg.com>
Thu, 29 Dec 2016 22:59:06 +0000 (15:59 -0700)
committerKarl Schultz <karl@lunarg.com>
Wed, 4 Jan 2017 15:11:32 +0000 (08:11 -0700)
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

demos/cube.cpp
demos/smoke/Meshes.cpp
demos/smoke/Simulation.cpp
demos/smoke/Smoke.cpp

index b28476a..ffbb30c 100644 (file)
@@ -525,7 +525,7 @@ struct Demo {
             vk::CommandBufferUsageFlagBits::eSimultaneousUse);
 
         vk::ClearValue const clearValues[2] = {
-            vk::ClearColorValue(std::array<float, 4>({0.2f, 0.2f, 0.2f, 0.2f})),
+            vk::ClearColorValue(std::array<float, 4>({{0.2f, 0.2f, 0.2f, 0.2f}})),
             vk::ClearDepthStencilValue(1.0f, 0u)};
 
         auto const passInfo =
index ef6e37b..dcdb642 100644 (file)
@@ -166,20 +166,20 @@ public:
     {
         const std::vector<std::array<float, 6>> 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<std::array<int, 3>> 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<std::array<float, 6>> 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<std::array<int, 3>> 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);
index 67cccfb..36e3f5b 100644 (file)
@@ -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)
     {
     }
 
index c52cd7c..f3086b9 100644 (file)
@@ -40,7 +40,7 @@ struct ShaderParamBlock {
 Smoke::Smoke(const std::vector<std::string> &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<VkDynamicState, 2> 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;