From 3e0d722ca533d56d3dab641f7f204d6cc0e362ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Wed, 18 Oct 2023 13:45:14 +0200 Subject: [PATCH] Silent warnings on unused variables in some tests; make test UniqueHandleDefaultArguments part of the solution for 64 bit only. (#1704) --- tests/ArrayProxy/ArrayProxy.cpp | 10 ++++++++++ .../ArrayProxyNoTemporaries.cpp | 16 ++++++++-------- tests/CMakeLists.txt | 8 +++++--- tests/StridedArrayProxy/StridedArrayProxy.cpp | 10 ++++++++++ .../UniqueHandleDefaultArguments.cpp | 5 ++--- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/tests/ArrayProxy/ArrayProxy.cpp b/tests/ArrayProxy/ArrayProxy.cpp index 23f1588..31af182 100644 --- a/tests/ArrayProxy/ArrayProxy.cpp +++ b/tests/ArrayProxy/ArrayProxy.cpp @@ -15,6 +15,16 @@ // VulkanHpp Samples : ArrayProxy // Compile test on using vk::ArrayProxy +#if defined( _MSC_VER ) +// no need to ignore any warnings with MSVC +#elif defined( __clang__ ) +# pragma clang diagnostic ignored "-Wunused-variable" +#elif defined( __GNUC__ ) +# pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#else +// unknow compiler... just ignore the warnings for yourselves ;) +#endif + #include #include #if ( 20 <= VULKAN_HPP_CPP_VERSION ) diff --git a/tests/ArrayProxyNoTemporaries/ArrayProxyNoTemporaries.cpp b/tests/ArrayProxyNoTemporaries/ArrayProxyNoTemporaries.cpp index cbc7666..d1bf1da 100644 --- a/tests/ArrayProxyNoTemporaries/ArrayProxyNoTemporaries.cpp +++ b/tests/ArrayProxyNoTemporaries/ArrayProxyNoTemporaries.cpp @@ -69,15 +69,15 @@ std::vector const getConstVector() return { 1, 2 }; } -std::initializer_list getInitializerList() -{ - return { 1, 2 }; -} +//std::initializer_list getInitializerList() +//{ +// return { 1, 2 }; +//} -std::initializer_list const getConstInitializerList() -{ - return { 1, 2 }; -} +//std::initializer_list const getConstInitializerList() +//{ +// return { 1, 2 }; +//} int main( int /*argc*/, char ** /*argv*/ ) { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e51d837..724262e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,6 +15,9 @@ add_subdirectory( ArrayProxy ) add_subdirectory( ArrayProxyNoTemporaries ) add_subdirectory( ArrayWrapper ) +if( VULKAN_HPP_ENABLE_CPP20_MODULES ) + add_subdirectory( Cpp20Modules ) +endif() add_subdirectory( DesignatedInitializers ) add_subdirectory( DeviceFunctions ) add_subdirectory( DispatchLoaderDynamic ) @@ -31,7 +34,6 @@ add_subdirectory( NoExceptions ) add_subdirectory( StridedArrayProxy ) add_subdirectory( StructureChain ) add_subdirectory( UniqueHandle ) -add_subdirectory( UniqueHandleDefaultArguments ) -if( VULKAN_HPP_ENABLE_CPP20_MODULES ) - add_subdirectory( Cpp20Modules ) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + add_subdirectory( UniqueHandleDefaultArguments ) endif() diff --git a/tests/StridedArrayProxy/StridedArrayProxy.cpp b/tests/StridedArrayProxy/StridedArrayProxy.cpp index 4c1415d..679bc47 100644 --- a/tests/StridedArrayProxy/StridedArrayProxy.cpp +++ b/tests/StridedArrayProxy/StridedArrayProxy.cpp @@ -15,6 +15,16 @@ // VulkanHpp Samples : StridedArrayProxy // Compile test on using vk::StridedArrayProxy +#if defined( _MSC_VER ) +// no need to ignore any warnings with MSVC +#elif defined( __clang__ ) +# pragma clang diagnostic ignored "-Wunused-variable" +#elif defined( __GNUC__ ) +# pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#else +// unknow compiler... just ignore the warnings for yourselves ;) +#endif + #include #include #if ( 20 <= VULKAN_HPP_CPP_VERSION ) diff --git a/tests/UniqueHandleDefaultArguments/UniqueHandleDefaultArguments.cpp b/tests/UniqueHandleDefaultArguments/UniqueHandleDefaultArguments.cpp index 5195a0c..449a492 100644 --- a/tests/UniqueHandleDefaultArguments/UniqueHandleDefaultArguments.cpp +++ b/tests/UniqueHandleDefaultArguments/UniqueHandleDefaultArguments.cpp @@ -14,6 +14,8 @@ // // VulkanHpp Test: Compile only test for issue 467. +// Should be used on 64 bit only, as on 32 bit the test is ambiguous. + #define VULKAN_HPP_NO_EXCEPTIONS #define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1 @@ -21,12 +23,9 @@ VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE -#if defined( __x86_64__ ) || defined( _M_X64 ) -// On 32-bit systems the test is ambiguous. int main( int /*argc*/, char ** /*argv*/ ) { VkSurfaceKHR surface = 0; auto uniqueSurface = vk::UniqueSurfaceKHR( surface, vk::Instance() ); return 0; } -#endif