Fix warnings with clang and GCC
authorRicardo Garcia <rgarcia@igalia.com>
Mon, 4 Apr 2022 08:14:57 +0000 (10:14 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 14 Apr 2022 15:58:34 +0000 (15:58 +0000)
Affected tests:
No test result should be affected by these changes.

Components: OpenGL, Vulkan
VK-GL-CTS issue: 3602

Change-Id: If2eb0736d296add732aaff53c80a705cc306d7a3

13 files changed:
external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp
external/openglcts/modules/glesext/tessellation_shader/esextcTessellationShaderVertexSpacing.hpp
external/vulkancts/modules/vulkan/compute/vktComputeWorkgroupMemoryExplicitLayoutTests.cpp
external/vulkancts/modules/vulkan/compute/vktComputeZeroInitializeWorkgroupMemoryTests.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageAlignedMipSize.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageBlockShapes.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseBinding.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseResidency.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesMipmapSparseResidency.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsics.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmEmptyStructTests.cpp

index bebac24..aef62df 100644 (file)
@@ -12379,32 +12379,45 @@ template <int Size>
 static tcu::Matrix<glw::GLdouble, Size - 1, Size - 1> eliminate(const tcu::Matrix<glw::GLdouble, Size, Size>& matrix,
                                                                                                                                glw::GLuint column, glw::GLuint row)
 {
+       // GCC sometimes diagnoses an incorrect out of bounds write here. The code has been verified to be correct.
+#if (DE_COMPILER == DE_COMPILER_GCC)
+#      pragma GCC diagnostic push
+#      pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
+       const glw::GLint eCol = static_cast<glw::GLint>(column);
+       const glw::GLint eRow = static_cast<glw::GLint>(row);
+
        tcu::Matrix<glw::GLdouble, Size - 1, Size - 1> result;
 
-       for (glw::GLuint c = 0; c < Size; ++c)
+       for (glw::GLint c = 0; c < Size; ++c)
        {
                /* Skip eliminated column */
-               if (column == c)
+               if (eCol == c)
                {
                        continue;
                }
 
-               for (glw::GLuint r = 0; r < Size; ++r)
+               for (glw::GLint r = 0; r < Size; ++r)
                {
                        /* Skip eliminated row */
-                       if (row == r)
+                       if (eRow == r)
                        {
                                continue;
                        }
 
-                       const glw::GLint r_offset = (r > row) ? -1 : 0;
-                       const glw::GLint c_offset = (c > column) ? -1 : 0;
+                       const glw::GLint r_offset = (r > eRow) ? -1 : 0;
+                       const glw::GLint c_offset = (c > eCol) ? -1 : 0;
 
                        result(r + r_offset, c + c_offset) = matrix(r, c);
                }
        }
 
        return result;
+
+#if (DE_COMPILER == DE_COMPILER_GCC)
+#      pragma GCC diagnostic pop
+#endif
 }
 
 template <int Size>
index 22eece2..1ea6fc8 100644 (file)
@@ -279,7 +279,7 @@ private:
        /** Comparator that is used to compare two tessellation coordinates using FP value
         *  equal operator.
         */
-       struct _comparator_exact_tess_coordinate_match : public std::unary_function<float, bool>
+       struct _comparator_exact_tess_coordinate_match
        {
                /* Constructor.
                 *
index 0d117e8..c38c025 100644 (file)
@@ -314,6 +314,30 @@ public:
                Synchronization sync;
                Requirements requirements;
 
+               CaseDef (const std::string&     extraTypes_,
+                                const std::string&     writeDesc_,
+                                const std::string&     writeType_,
+                                const std::string&     writeValue_,
+                                const std::string&     readDesc_,
+                                const std::string&     readType_,
+                                const std::string&     readValue_,
+                                LayoutFlags            layout_,
+                                Function                       func_,
+                                Synchronization        sync_,
+                                Requirements           requirements_)
+                       : extraTypes    (extraTypes_)
+                       , writeDesc             (writeDesc_)
+                       , writeType             (writeType_)
+                       , writeValue    (writeValue_)
+                       , readDesc              (readDesc_)
+                       , readType              (readType_)
+                       , readValue             (readValue_)
+                       , layout                (layout_)
+                       , func                  (func_)
+                       , sync                  (sync_)
+                       , requirements  (requirements_)
+                       {}
+
                std::string testName() const
                {
                        std::string name = writeDesc + "_to_" + readDesc;
@@ -565,7 +589,7 @@ void AddAliasTests(tcu::TestCaseGroup* group)
 #define CASE(L, R, D1, T1, V1, D2, T2, V2)                             CASE_EXTRA(L, R, "", D1, T1, V1, D2, T2, V2)
 
 
-       std::vector<AliasTest::CaseDef> cases =
+       const std::vector<AliasTest::CaseDef> cases
        {
                CASE_SAME_TYPE(0,               "bool_true",    "bool v",               "true"),
                CASE_SAME_TYPE(0,               "bool_false",   "bool v",               "false"),
index 5cc0e51..4884bde 100644 (file)
@@ -568,6 +568,14 @@ struct CompositeCaseDef
        std::string                             assignment;
        deUint32                                elements;
        std::vector<deUint32>   specValues;
+
+       CompositeCaseDef (uint32_t index_, const std::string& typeDefinition_, const std::string& assignment_, uint32_t elements_, const std::vector<uint32_t>& specValues_)
+               : index                         (index_)
+               , typeDefinition        (typeDefinition_)
+               , assignment            (assignment_)
+               , elements                      (elements_)
+               , specValues            (specValues_)
+               {}
 };
 
 class CompositeTestInstance : public vkt::TestInstance
@@ -669,7 +677,7 @@ tcu::TestStatus CompositeTestInstance::iterate(void)
 
 void AddCompositeTests(tcu::TestCaseGroup* group)
 {
-       std::vector<CompositeCaseDef> cases =
+       const std::vector<CompositeCaseDef> cases
        {
                {0,
                "shared uint wg_mem[specId0] = {};\n",
index b3ff118..8d45d0f 100644 (file)
@@ -263,7 +263,7 @@ tcu::TestCaseGroup* createImageAlignedMipSizeTests (tcu::TestContext& testCtx)
 {
        de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, "aligned_mip_size", "Aligned mip size"));
 
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_2D,                 { tcu::UVec3(512u, 256u, 1u) },        getTestFormats(IMAGE_TYPE_2D) },
                { IMAGE_TYPE_2D_ARRAY,   { tcu::UVec3(512u, 256u, 6u) },        getTestFormats(IMAGE_TYPE_2D_ARRAY) },
index a8a5eb8..400467b 100644 (file)
@@ -449,7 +449,7 @@ tcu::TestCaseGroup* createImageBlockShapesTests (tcu::TestContext& testCtx)
 {
        de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, "image_block_shapes", "Standard block shape"));
 
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_2D,                        { tcu::UVec3(512u, 256u, 1u) },         getTestFormats(IMAGE_TYPE_2D) },
                { IMAGE_TYPE_2D_ARRAY,          { tcu::UVec3(512u, 256u, 6u) },         getTestFormats(IMAGE_TYPE_2D_ARRAY) },
index a8ad9cb..f465a93 100755 (executable)
@@ -899,7 +899,7 @@ TestInstance* ImageSparseMemoryAliasingCase::createInstance (Context& context) c
 tcu::TestCaseGroup* createImageSparseMemoryAliasingTestsCommon(tcu::TestContext& testCtx, de::MovePtr<tcu::TestCaseGroup> testGroup, const bool useDeviceGroup = false)
 {
 
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_2D,                { tcu::UVec3(512u, 256u, 1u),   tcu::UVec3(128u, 128u, 1u),     tcu::UVec3(503u, 137u, 1u),     tcu::UVec3(11u, 37u, 1u) },     getTestFormats(IMAGE_TYPE_2D) },
                { IMAGE_TYPE_2D_ARRAY,  { tcu::UVec3(512u, 256u, 6u),   tcu::UVec3(128u, 128u, 8u),     tcu::UVec3(503u, 137u, 3u),     tcu::UVec3(11u, 37u, 3u) },     getTestFormats(IMAGE_TYPE_2D_ARRAY) },
index c80367f..8f0b596 100755 (executable)
@@ -479,7 +479,7 @@ TestInstance* ImageSparseBindingCase::createInstance (Context& context) const
 
 tcu::TestCaseGroup* createImageSparseBindingTestsCommon(tcu::TestContext& testCtx, de::MovePtr<tcu::TestCaseGroup> testGroup, const bool useDeviceGroup = false)
 {
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_1D,                        { tcu::UVec3(512u, 1u,   1u ),  tcu::UVec3(1024u, 1u,   1u),    tcu::UVec3(11u,  1u,   1u) },   getTestFormats(IMAGE_TYPE_1D) },
                { IMAGE_TYPE_1D_ARRAY,          { tcu::UVec3(512u, 1u,   64u),  tcu::UVec3(1024u, 1u,   8u),    tcu::UVec3(11u,  1u,   3u) },   getTestFormats(IMAGE_TYPE_1D_ARRAY) },
index c292e58..b28891f 100755 (executable)
@@ -1020,7 +1020,7 @@ TestInstance* ImageSparseResidencyCase::createInstance (Context& context) const
 
 tcu::TestCaseGroup* createImageSparseResidencyTestsCommon (tcu::TestContext& testCtx, de::MovePtr<tcu::TestCaseGroup> testGroup, const bool useDeviceGroup = false)
 {
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_2D,                        { tcu::UVec3(512u, 256u,  1u),  tcu::UVec3(1024u, 128u, 1u),    tcu::UVec3(11u,  137u, 1u) },   getTestFormats(IMAGE_TYPE_2D) },
                { IMAGE_TYPE_2D_ARRAY,          { tcu::UVec3(512u, 256u,  6u),  tcu::UVec3(1024u, 128u, 8u),    tcu::UVec3(11u,  137u, 3u) },   getTestFormats(IMAGE_TYPE_2D_ARRAY) },
index 5c02cc9..b3f3665 100755 (executable)
@@ -600,7 +600,7 @@ TestInstance* MipmapSparseResidencyCase::createInstance (Context& context) const
 
 tcu::TestCaseGroup* createMipmapSparseResidencyTestsCommon (tcu::TestContext& testCtx, de::MovePtr<tcu::TestCaseGroup> testGroup, const bool useDeviceGroup = false)
 {
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_2D,                        { tcu::UVec3(512u, 256u, 1u),   tcu::UVec3(1024u, 128u, 1u),    tcu::UVec3(11u,  137u, 1u) },   getTestFormats(IMAGE_TYPE_2D) },
                { IMAGE_TYPE_2D_ARRAY,          { tcu::UVec3(512u, 256u, 6u),   tcu::UVec3(1024u, 128u, 8u),    tcu::UVec3(11u,  137u, 3u) },   getTestFormats(IMAGE_TYPE_2D_ARRAY) },
index 079464e..79f3e94 100644 (file)
@@ -35,7 +35,7 @@ tcu::TestCaseGroup* createSparseResourcesShaderIntrinsicsTests (tcu::TestContext
 {
        de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, "shader_intrinsics", "Sparse Resources Shader Intrinsics"));
 
-       const std::vector<TestImageParameters> imageParameters =
+       const std::vector<TestImageParameters> imageParameters
        {
                { IMAGE_TYPE_2D,                        { tcu::UVec3(512u, 256u, 1u),   tcu::UVec3(128u, 128u, 1u), tcu::UVec3(503u, 137u, 1u), tcu::UVec3(11u, 37u, 1u) },     getTestFormats(IMAGE_TYPE_2D) },
                { IMAGE_TYPE_2D_ARRAY,          { tcu::UVec3(512u, 256u, 6u),   tcu::UVec3(128u, 128u, 8u),     tcu::UVec3(503u, 137u, 3u),     tcu::UVec3(11u, 37u, 3u) },     getTestFormats(IMAGE_TYPE_2D_ARRAY) },
index 9853162..ccb6ef1 100644 (file)
@@ -80,6 +80,12 @@ struct TestImageParameters
        ImageType                               imageType;
        std::vector<tcu::UVec3> imageSizes;
        std::vector<TestFormat> formats;
+
+       TestImageParameters (ImageType imageType_, const std::vector<tcu::UVec3>& imageSizes_, const std::vector<TestFormat>& formats_)
+               : imageType             (imageType_)
+               , imageSizes    (imageSizes_)
+               , formats               (formats_)
+               {}
 };
 
 bool                                                   formatIsR64                                                     (const vk::VkFormat& format);
index 4fc60c5..fd8f111 100644 (file)
@@ -126,8 +126,24 @@ void addCopyingComputeGroup(tcu::TestCaseGroup* group)
                std::vector<int>                expectedOutput;
                std::string                             spirvVariables;
                std::string                             spirvCopyObject;
+
+               BufferType (const std::string&                          name_,
+                                       VkDescriptorType                                descriptorType_,
+                                       const std::vector<uint32_t>&    offsets_,
+                                       const std::vector<int>&                 input_,
+                                       const std::vector<int>&                 expectedOutput_,
+                                       const std::string&                              spirvVariables_,
+                                       const std::string&                              spirvCopyObject_)
+                       : name                          (name_)
+                       , descriptorType        (descriptorType_)
+                       , offsets                       (offsets_)
+                       , input                         (input_)
+                       , expectedOutput        (expectedOutput_)
+                       , spirvVariables        (spirvVariables_)
+                       , spirvCopyObject       (spirvCopyObject_)
+                       {}
        };
-       std::vector<BufferType> bufferTypes
+       const std::vector<BufferType> bufferTypes
        {
                {
                        "ubo",
@@ -163,8 +179,13 @@ void addCopyingComputeGroup(tcu::TestCaseGroup* group)
        {
                std::string name;
                std::string spirvCopyCode;
+
+               CopyingMethod (const std::string& name_, const std::string& spirvCopyCode_)
+                       : name                  (name_)
+                       , spirvCopyCode (spirvCopyCode_)
+                       {}
        };
-       std::vector<CopyingMethod> copyingMethods
+       const std::vector<CopyingMethod> copyingMethods
        {
                {
                        "copy_object",