diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-02-03 23:38:06 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-02-03 23:38:06 +0000 |
| commit | a8e37f967bec33dfe131a4eb8f8739fa2bf6d98c (patch) | |
| tree | 7b51a1ceada129e833ef9bf8c1d0ca8cdb3bb76f | |
| parent | Disallowed missing direct and indirect dependencies when linking GL and VK sh... (diff) | |
| download | DiligentCore-a8e37f967bec33dfe131a4eb8f8739fa2bf6d98c.tar.gz DiligentCore-a8e37f967bec33dfe131a4eb8f8739fa2bf6d98c.zip | |
Silenced a bunch of clang warnings
| -rw-r--r-- | Graphics/GLSLTools/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/CMakeLists.txt | 20 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | Tests/DiligentCoreAPITest/CMakeLists.txt | 13 | ||||
| -rw-r--r-- | Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp | 3 | ||||
| -rw-r--r-- | Tests/DiligentCoreTest/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c | 16 |
7 files changed, 71 insertions, 7 deletions
diff --git a/Graphics/GLSLTools/CMakeLists.txt b/Graphics/GLSLTools/CMakeLists.txt index 239342e6..2962c669 100644 --- a/Graphics/GLSLTools/CMakeLists.txt +++ b/Graphics/GLSLTools/CMakeLists.txt @@ -25,6 +25,14 @@ if(VULKAN_SUPPORTED) list(APPEND INCLUDE include/SPIRVUtils.hpp ) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Disable the following warning: + # moving a local object in a return statement prevents copy elision [-Wpessimizing-move] + set_source_files_properties(src/SPIRVUtils.cpp + PROPERTIES + COMPILE_FLAGS -Wno-pessimizing-move + ) + endif() endif() endif() @@ -80,4 +88,4 @@ set_target_properties(Diligent-GLSLTools PROPERTIES if(DILIGENT_INSTALL_CORE) install_core_lib(Diligent-GLSLTools) -endif()
\ No newline at end of file +endif() diff --git a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt index 0039de56..bbaf59c5 100644 --- a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt +++ b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt @@ -192,6 +192,26 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # as hiding is intended target_compile_options(Diligent-GraphicsEngineOpenGL-static PRIVATE -Wno-overloaded-virtual) target_compile_options(Diligent-GraphicsEngineOpenGL-shared PRIVATE -Wno-overloaded-virtual) + + # Disable warings like this one: + # comparison of function 'glPolygonMode' not equal to a null pointer is always true [-Wtautological-pointer-compare] + set_source_files_properties(src/RenderDeviceGLImpl.cpp src/GLContextState.cpp + PROPERTIES + COMPILE_FLAGS -Wno-tautological-pointer-compare + ) + + if (PLATFORM_IOS) + # Disable warings like this one: + # unused variable 'BottomLeftY' [-Wunused-variable] + set_source_files_properties( + src/DeviceContextGLImpl.cpp + src/GLContextState.cpp + src/RenderDeviceGLImpl.cpp + src/Texture1D_OGL.cpp + PROPERTIES + COMPILE_FLAGS -Wno-unused-variable + ) + endif() elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set_target_properties(Diligent-GraphicsEngineOpenGL-shared PROPERTIES # Disallow missing direct and indirect dependencies to enssure that .so is self-contained diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt index 9300a081..baf08498 100644 --- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt +++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt @@ -217,6 +217,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # as hiding is intended target_compile_options(Diligent-GraphicsEngineVk-static PRIVATE -Wno-overloaded-virtual) target_compile_options(Diligent-GraphicsEngineVk-shared PRIVATE -Wno-overloaded-virtual) + + # Disable the following warning: + # moving a local object in a return statement prevents copy elision [-Wpessimizing-move] + set_source_files_properties(src/CommandPoolManager.cpp src/VulkanUtilities/VulkanDebug.cpp + PROPERTIES + COMPILE_FLAGS -Wno-pessimizing-move + ) elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set_target_properties(Diligent-GraphicsEngineVk-shared PROPERTIES # Disallow missing direct and indirect dependencies to enssure that .so is self-contained diff --git a/Tests/DiligentCoreAPITest/CMakeLists.txt b/Tests/DiligentCoreAPITest/CMakeLists.txt index 64006ed3..0c3e970e 100644 --- a/Tests/DiligentCoreAPITest/CMakeLists.txt +++ b/Tests/DiligentCoreAPITest/CMakeLists.txt @@ -131,6 +131,19 @@ if(VULKAN_SUPPORTED) endif() endif() +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Disable warings like this one: + # comparison of function 'glPolygonMode' not equal to a null pointer is always true [-Wtautological-pointer-compare] + set_source_files_properties( + src/GL/DrawCommandReferenceGL.cpp + src/GL/GeometryShaderRefenceGL.cpp + src/GL/TessellationRefenceGL.cpp + src/GL/TestingEnvironmentGL.cpp + PROPERTIES + COMPILE_FLAGS -Wno-tautological-pointer-compare + ) +endif() + target_include_directories(DiligentCoreAPITest PRIVATE include diff --git a/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp b/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp index b9e39e96..c47ff98e 100644 --- a/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp +++ b/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp @@ -104,6 +104,7 @@ TestingEnvironment::TestingEnvironment(RENDER_DEVICE_TYPE deviceType, ADAPTER_TY std::vector<IDeviceContext*> ppContexts; std::vector<AdapterAttribs> Adapters; +#if D3D11_SUPPORTED || D3D12_SUPPORTED auto PrintAdapterInfo = [](Uint32 AdapterId, const AdapterAttribs& AdapterInfo, const std::vector<DisplayModeAttribs>& DisplayModes) // { const char* AdapterTypeStr = nullptr; @@ -117,6 +118,8 @@ TestingEnvironment::TestingEnvironment(RENDER_DEVICE_TYPE deviceType, ADAPTER_TY AdapterTypeStr, ", ", AdapterInfo.DedicatedVideoMemory / (1 << 20), " MB); ", DisplayModes.size(), (DisplayModes.size() == 1 ? " display mode" : " display modes")); }; +#endif + switch (m_DeviceType) { #if D3D11_SUPPORTED diff --git a/Tests/DiligentCoreTest/CMakeLists.txt b/Tests/DiligentCoreTest/CMakeLists.txt index 780a9cc2..4f612b01 100644 --- a/Tests/DiligentCoreTest/CMakeLists.txt +++ b/Tests/DiligentCoreTest/CMakeLists.txt @@ -9,6 +9,15 @@ file(GLOB PLATFORMS_SOURCE src/Platforms/*) set(SOURCE ${COMMON_SOURCE} ${GRAPHICS_ACCESSORIES_SOURCE} ${PLATFORMS_SOURCE}) set(INCLUDE) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Disable the following warning: + # explicitly moving variable of type '(anonymous namespace)::SmartPtr' (aka 'RefCntAutoPtr<(anonymous namespace)::Object>') to itself [-Wself-move] + set_source_files_properties(src/Common/RefCntAutoPtrTest.cpp + PROPERTIES + COMPILE_FLAGS "-Wno-self-move -Wno-self-assign" + ) +endif() + add_executable(DiligentCoreTest ${SOURCE} ${INCLUDE}) set_common_target_properties(DiligentCoreTest) diff --git a/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c index fa7c9c0b..3751e7df 100644 --- a/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c +++ b/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c @@ -25,6 +25,8 @@ * of the possibility of such damages. */ +#include <string.h> + #ifndef ENGINE_DLL # define ENGINE_DLL 1 #endif @@ -41,13 +43,15 @@ void TestEngineFactoryVk_CInterface() IEngineFactoryVk* pFactory = Diligent_GetEngineFactoryVk(); #endif - struct EngineVkCreateInfo EngineCI = {0}; - IRenderDevice* pDevice = NULL; - IDeviceContext* pCtx = NULL; + EngineVkCreateInfo EngineCI; + memset(&EngineCI, 0, sizeof(EngineCI)); + IRenderDevice* pDevice = NULL; + IDeviceContext* pCtx = NULL; IEngineFactoryVk_CreateDeviceAndContextsVk(pFactory, &EngineCI, &pDevice, &pCtx); - struct SwapChainDesc SCDesc = {0}; - void* pNativeWndHandle = NULL; - ISwapChain* pSwapChain = NULL; + SwapChainDesc SCDesc; + memset(&SCDesc, 0, sizeof(SCDesc)); + void* pNativeWndHandle = NULL; + ISwapChain* pSwapChain = NULL; IEngineFactoryVk_CreateSwapChainVk(pFactory, pDevice, pCtx, &SCDesc, pNativeWndHandle, &pSwapChain); } |
