From: Mika Väinölä Date: Wed, 10 Mar 2021 11:16:38 +0000 (+0200) Subject: GCC 11 build fixes X-Git-Tag: upstream/1.3.5~332^2~53^2~1^2~1^2^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=faa7e3fbf9cb168da6c9f7515e216f7a23f8c53f;p=platform%2Fupstream%2FVK-GL-CTS.git GCC 11 build fixes Some files used std::numeric_limits without including and failed to compile. Some dynamic casts and calls to AndroidHardwareBufferExternalApi:: getInstance() produced nonnull warnings. Suppress these by wrapping them in if statements. This commit also removes implicit-fallthrough from the list of ignored GCC warnings in check_build_sanity.py. All such warnings in the CTS should be fixed by now and recent versions of Clang also support this warning. VK-GL-CTS issue: 2842 Change-Id: I5bd290f9c312a30c2fcb223307c7b5c785a0fa92 --- diff --git a/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp b/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp index fb90f95..184dbe9 100644 --- a/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp +++ b/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace vk { diff --git a/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp b/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp index 8446d74..19592fc 100644 --- a/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp +++ b/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp @@ -34,6 +34,7 @@ #include "tcuVectorType.hpp" #include +#include namespace vk { diff --git a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp index a64577c..97cf062 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp @@ -35,6 +35,7 @@ #include "tcuPlatform.hpp" #include +#include namespace vkt { diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp index bd6089d..0b59f4c 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmNonSemanticInfoTests.cpp @@ -28,6 +28,8 @@ #include "vktSpvAsmComputeShaderCase.hpp" #include "vktSpvAsmGraphicsShaderTestUtil.hpp" +#include + namespace vkt { namespace SpirVAssembly diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp index f703185..ac2c7ae 100644 --- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp +++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp @@ -25,6 +25,7 @@ #include "vkTypeUtil.hpp" #include "vkCmdUtil.hpp" #include "deStringUtil.hpp" +#include namespace vkt { diff --git a/external/vulkancts/modules/vulkan/util/vktExternalMemoryUtil.cpp b/external/vulkancts/modules/vulkan/util/vktExternalMemoryUtil.cpp index 9bdb8be..233e0cc 100644 --- a/external/vulkancts/modules/vulkan/util/vktExternalMemoryUtil.cpp +++ b/external/vulkancts/modules/vulkan/util/vktExternalMemoryUtil.cpp @@ -118,7 +118,11 @@ NativeHandle::NativeHandle (const NativeHandle& other) DE_ASSERT(other.m_fd == -1); DE_ASSERT(!other.m_win32Handle.internal); m_androidHardwareBuffer = other.m_androidHardwareBuffer; - AndroidHardwareBufferExternalApi::getInstance()->acquire(m_androidHardwareBuffer); + + if (AndroidHardwareBufferExternalApi* ahbApi = AndroidHardwareBufferExternalApi::getInstance()) + ahbApi->acquire(m_androidHardwareBuffer); + else + DE_FATAL("Platform doesn't support Android Hardware Buffer handles"); } else DE_FATAL("Native handle can't be duplicated"); @@ -194,7 +198,11 @@ void NativeHandle::reset (void) { DE_ASSERT(m_fd == -1); DE_ASSERT(!m_win32Handle.internal); - AndroidHardwareBufferExternalApi::getInstance()->release(m_androidHardwareBuffer); + + if (AndroidHardwareBufferExternalApi* ahbApi = AndroidHardwareBufferExternalApi::getInstance()) + ahbApi->release(m_androidHardwareBuffer); + else + DE_FATAL("Platform doesn't support Android Hardware Buffer handles"); } m_fd = -1; m_win32Handle = vk::pt::Win32Handle(DE_NULL); diff --git a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp index 17d0b79..20b4970 100644 --- a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp +++ b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp @@ -38,6 +38,8 @@ #include "deSTLUtil.hpp" #include "deUniquePtr.hpp" +#include + namespace vkt { namespace ycbcr diff --git a/framework/opengl/simplereference/sglrReferenceContext.cpp b/framework/opengl/simplereference/sglrReferenceContext.cpp index d781b81..99b3ab8 100644 --- a/framework/opengl/simplereference/sglrReferenceContext.cpp +++ b/framework/opengl/simplereference/sglrReferenceContext.cpp @@ -2341,9 +2341,19 @@ tcu::PixelBufferAccess ReferenceContext::getFboAttachment (const rc::Framebuffer TCU_CHECK(texture); if (texture->getType() == Texture::TYPE_2D) - return dynamic_cast(texture)->getLevel(attachment.level); + { + if (Texture2D* texture2D = dynamic_cast(texture)) + return texture2D->getLevel(attachment.level); + else + return nullAccess(); + } else if (texture->getType() == Texture::TYPE_CUBE_MAP) - return dynamic_cast(texture)->getFace(attachment.level, texTargetToFace(attachment.texTarget)); + { + if (TextureCube* cubeMap = dynamic_cast(texture)) + return cubeMap->getFace(attachment.level, texTargetToFace(attachment.texTarget)); + else + return nullAccess(); + } else if (texture->getType() == Texture::TYPE_2D_ARRAY || texture->getType() == Texture::TYPE_3D || texture->getType() == Texture::TYPE_CUBE_MAP_ARRAY) @@ -2351,11 +2361,20 @@ tcu::PixelBufferAccess ReferenceContext::getFboAttachment (const rc::Framebuffer tcu::PixelBufferAccess level; if (texture->getType() == Texture::TYPE_2D_ARRAY) - level = dynamic_cast(texture)->getLevel(attachment.level); + { + if (Texture2DArray* texture2DArray = dynamic_cast(texture)) + level = texture2DArray->getLevel(attachment.level); + } else if (texture->getType() == Texture::TYPE_3D) - level = dynamic_cast(texture)->getLevel(attachment.level); + { + if (Texture3D* texture3D = dynamic_cast(texture)) + level = texture3D->getLevel(attachment.level); + } else if (texture->getType() == Texture::TYPE_CUBE_MAP_ARRAY) - level = dynamic_cast(texture)->getLevel(attachment.level); + { + if (TextureCubeArray* cubeArray = dynamic_cast(texture)) + level = cubeArray->getLevel(attachment.level); + } void* layerData = static_cast(level.getDataPtr()) + level.getSlicePitch() * attachment.layer; diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp index fbeee6a..291554f 100644 --- a/modules/glshared/glsBuiltinPrecisionTests.cpp +++ b/modules/glshared/glsBuiltinPrecisionTests.cpp @@ -56,6 +56,7 @@ #include #include #include +#include // Uncomment this to get evaluation trace dumps to std::cerr // #define GLS_ENABLE_TRACE diff --git a/scripts/check_build_sanity.py b/scripts/check_build_sanity.py index 67101cd..aa8d22a 100644 --- a/scripts/check_build_sanity.py +++ b/scripts/check_build_sanity.py @@ -139,7 +139,7 @@ def runSteps (steps): print("Skip: %s" % step.getName()) COMMON_CFLAGS = ["-Werror", "-Wno-error=unused-function"] -COMMON_GCC_CFLAGS = COMMON_CFLAGS + ["-Wno-implicit-fallthrough", "-Wno-error=array-bounds"] +COMMON_GCC_CFLAGS = COMMON_CFLAGS + ["-Wno-error=array-bounds"] 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"]