From: Caio Marcelo de Oliveira Filho Date: Thu, 22 Feb 2018 01:54:57 +0000 (-0800) Subject: Handle gcc 7 warnings X-Git-Tag: upstream/1.3.5~1205^2^2~3^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3677383919ebb73a30e28602d9acd1d79af190aa;p=platform%2Fupstream%2FVK-GL-CTS.git Handle gcc 7 warnings - "-Wimplicit-fallthrough" warns on case conditions that fallthrough. GCC does have a way to accept conditions that have a comment about falling through inside the cases, but the codebase has other cases where a single comment explains the fallthrough for the whole switch. This warning is being ignored. It was not possible to use "-Wno-error=WARNING" because older GCCs fail -- but they do accept "-Wno-WARNING" where WARNING is unknown (since at least gcc 4.6.4). - "-Wint-in-bool-context" warns (among other things) about result of multiplication being used in boolean context. Code was changed to use de::max() instead. - "-Wmaybe-uninitialized" warned about some attributes of a struct not being initialized depending on the case. Code was changed to initialize the struct in question. Components: Framework, Vulkan Bug: b/74405145 Change-Id: Iabb26f01e047353c6e2a704ab27b673e85b185be (cherry picked from commit f1ee9253e64f7434cdba7c8ac048c0e9baccc133) --- diff --git a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp index 7fdf498..476fba2 100644 --- a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp +++ b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp @@ -1799,7 +1799,7 @@ void BufferIoExecutor::initBuffers (int numValues) const deUint32 inputStride = getLayoutStride(m_inputLayout); const deUint32 outputStride = getLayoutStride(m_outputLayout); // Avoid creating zero-sized buffer/memory - const size_t inputBufferSize = numValues * inputStride ? (numValues * inputStride) : 1; + const size_t inputBufferSize = de::max(numValues * inputStride, 1u); const size_t outputBufferSize = numValues * outputStride; // Upload data to buffer diff --git a/external/vulkancts/modules/vulkan/texture/vktTextureFilteringExplicitLodTests.cpp b/external/vulkancts/modules/vulkan/texture/vktTextureFilteringExplicitLodTests.cpp index 4462237..c233114 100644 --- a/external/vulkancts/modules/vulkan/texture/vktTextureFilteringExplicitLodTests.cpp +++ b/external/vulkancts/modules/vulkan/texture/vktTextureFilteringExplicitLodTests.cpp @@ -1276,7 +1276,7 @@ public: { for (deUint32 derivNdx = 0; derivNdx < DE_LENGTH_OF_ARRAY(derivativePairs); ++derivNdx) { - SampleArguments cur; + SampleArguments cur = SampleArguments(); cur.coord = Vec4((float)i / (float)(2 * m_testCase->m_dimensions[0]), (float)j / (float)(2 * m_testCase->m_dimensions[1]), 0.0f, 0.0f); @@ -1298,7 +1298,7 @@ public: { for (deUint32 lodNdx = 0; lodNdx < DE_LENGTH_OF_ARRAY(lodList); ++lodNdx) { - SampleArguments cur; + SampleArguments cur = SampleArguments(); cur.coord = Vec4((float)i / (float)(2 * m_testCase->m_dimensions[0]), (float)j / (float)(2 * m_testCase->m_dimensions[1]), 0.0f, 0.0f); diff --git a/scripts/check_build_sanity.py b/scripts/check_build_sanity.py index 2358bd9..e93533c 100644 --- a/scripts/check_build_sanity.py +++ b/scripts/check_build_sanity.py @@ -135,8 +135,9 @@ def runSteps (steps): else: print "Skip: %s" % step.getName() -COMMON_GCC_CFLAGS = ["-Werror", "-Wno-error=unused-function"] -COMMON_CLANG_CFLAGS = COMMON_GCC_CFLAGS + ["-Wno-error=unused-command-line-argument"] +COMMON_CFLAGS = ["-Werror", "-Wno-error=unused-function"] +COMMON_GCC_CFLAGS = COMMON_CFLAGS + ["-Wno-implicit-fallthrough"] +COMMON_CLANG_CFLAGS = COMMON_CFLAGS + ["-Wno-error=unused-command-line-argument"] GCC_32BIT_CFLAGS = COMMON_GCC_CFLAGS + ["-m32"] CLANG_32BIT_CFLAGS = COMMON_CLANG_CFLAGS + ["-m32"] GCC_64BIT_CFLAGS = COMMON_GCC_CFLAGS + ["-m64"]