mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-12-25 01:51:09 +00:00
Merge pull request #845 from mtavenrath/fix_warnings
Fix compiler warnings on gcc/clang
This commit is contained in:
commit
b9ec269ab2
@ -113,7 +113,10 @@ add_executable(VulkanHppGenerator
|
||||
set_property(TARGET VulkanHppGenerator PROPERTY CXX_STANDARD 14)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(VulkanHppGenerator PRIVATE /W4 /WX /permissive-)
|
||||
target_compile_options(VulkanHppGenerator PRIVATE /W4 /WX)
|
||||
if (MSVC_VER GREATER_EQUAL 1910)
|
||||
target_compile_options(VulkanHppGenerator PRIVATE /permissive-)
|
||||
endif()
|
||||
else(MSVC)
|
||||
target_compile_options(VulkanHppGenerator PRIVATE -Wall -Wextra -pedantic -Werror)
|
||||
endif(MSVC)
|
||||
|
@ -3067,20 +3067,18 @@ void VulkanHppGenerator::appendStructAssignmentOperators( std::string &
|
||||
std::string const & prefix ) const
|
||||
{
|
||||
static const std::string assignmentFromVulkanType = R"(
|
||||
${prefix}${constexpr_assign}${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
|
||||
${prefix}${structName} & operator=( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
${prefix}{
|
||||
${prefix} *this = *reinterpret_cast<VULKAN_HPP_NAMESPACE::${structName} const *>( &rhs );
|
||||
${prefix} return *this;
|
||||
${prefix}}
|
||||
|
||||
${prefix}${structName} & operator=( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
${prefix}{
|
||||
${prefix} memcpy( static_cast<void *>( this ), &rhs, sizeof( ${structName} ) );
|
||||
${prefix} return *this;
|
||||
${prefix}}
|
||||
)";
|
||||
str += replaceWithMap( assignmentFromVulkanType,
|
||||
{ { "prefix", prefix }, { "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
{ { "constexpr_assign", constructConstexprString( structData, true ) },
|
||||
{ "prefix", prefix },
|
||||
{ "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::appendStructCompareOperators( std::string & str,
|
||||
@ -5365,13 +5363,13 @@ std::string VulkanHppGenerator::constructCommandVoidGetValue( std::string const
|
||||
}
|
||||
|
||||
std::string
|
||||
VulkanHppGenerator::constructConstexprString( std::pair<std::string, StructureData> const & structData ) const
|
||||
VulkanHppGenerator::constructConstexprString( std::pair<std::string, StructureData> const & structData, bool assignmentOperator ) const
|
||||
{
|
||||
// structs with a union (and VkBaseInStructure and VkBaseOutStructure) can't be a constexpr!
|
||||
bool isConstExpression = !containsUnion( structData.first ) && ( structData.first != "VkBaseInStructure" ) &&
|
||||
( structData.first != "VkBaseOutStructure" );
|
||||
return isConstExpression
|
||||
? ( std::string( "VULKAN_HPP_CONSTEXPR" ) + ( containsArray( structData.first ) ? "_14 " : " " ) )
|
||||
? ( std::string( "VULKAN_HPP_CONSTEXPR" ) + ( (containsArray( structData.first ) || assignmentOperator) ? "_14 " : " " ) )
|
||||
: "";
|
||||
}
|
||||
|
||||
@ -5623,9 +5621,8 @@ ${prefix}{}
|
||||
${prefix}${constexpr}${structName}( ${structName} const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
|
||||
${prefix}${structName}( Vk${structName} const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
${prefix}{
|
||||
${prefix} *this = rhs;
|
||||
${prefix}}
|
||||
${prefix} : ${structName}( *reinterpret_cast<${structName} const *>( &rhs ) )
|
||||
${prefix}{}
|
||||
)";
|
||||
|
||||
std::string arguments, initializers;
|
||||
@ -5646,7 +5643,7 @@ ${prefix}}
|
||||
|
||||
str += replaceWithMap( constructors,
|
||||
{ { "arguments", arguments },
|
||||
{ "constexpr", constructConstexprString( structData ) },
|
||||
{ "constexpr", constructConstexprString( structData, false ) },
|
||||
{ "initializers", initializers },
|
||||
{ "prefix", prefix },
|
||||
{ "structName", stripPrefix( structData.first, "Vk" ) } } );
|
||||
@ -5799,11 +5796,6 @@ std::string VulkanHppGenerator::appendStructMembers( std::string &
|
||||
for ( auto const & member : structData.second.members )
|
||||
{
|
||||
str += prefix;
|
||||
if ( member.values.size() == 1 )
|
||||
{
|
||||
// members with just one allowed value are set to be const
|
||||
str += "const ";
|
||||
}
|
||||
if ( !member.bitCount.empty() && beginsWith( member.type.type, "Vk" ) )
|
||||
{
|
||||
assert( member.type.prefix.empty() && member.type.postfix.empty() ); // never encounterd a different case
|
||||
@ -9728,6 +9720,11 @@ int main( int argc, char ** argv )
|
||||
, m_ptr( ptr )
|
||||
{}
|
||||
|
||||
#if __GNUC__ >= 9
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
#endif
|
||||
|
||||
ArrayProxy( std::initializer_list<T> const & list ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( list.size() ) )
|
||||
, m_ptr( list.begin() )
|
||||
@ -9750,6 +9747,10 @@ int main( int argc, char ** argv )
|
||||
, m_ptr( list.begin() )
|
||||
{}
|
||||
|
||||
#if __GNUC__ >= 9
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
template <size_t N>
|
||||
ArrayProxy( std::array<T, N> const & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( N )
|
||||
|
@ -599,7 +599,7 @@ private:
|
||||
bool definition,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
size_t returnParamIndex ) const;
|
||||
std::string constructConstexprString( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string constructConstexprString( std::pair<std::string, StructureData> const & structData, bool assignmentOperator ) const;
|
||||
std::string constructFunctionBodyEnhanced( std::string const & indentation,
|
||||
std::string const & name,
|
||||
CommandData const & commandData,
|
||||
|
@ -15,16 +15,6 @@
|
||||
// VulkanHpp Samples : 13_InitVertexBuffer
|
||||
// Initialize vertex buffer
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
@ -15,16 +15,6 @@
|
||||
// VulkanHpp Samples : 15_DrawCube
|
||||
// Draw a cube
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -15,16 +15,6 @@
|
||||
// VulkanHpp Samples : DrawTexturedCube
|
||||
// Draw a textured cube
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -15,21 +15,22 @@
|
||||
// VulkanHpp Samples : DynamicUniform
|
||||
// Draw 2 Cubes using dynamic uniform buffer
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( disable : 4127 ) // conditional expression is constant
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4100 ) // unreferenced formal parameter (glslang)
|
||||
#endif // endif (_MSC_VER )
|
||||
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -20,9 +20,6 @@
|
||||
#elif defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
static char const * AppName = "InstanceExtensionProperties";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
static char const * AppName = "InstanceLayerExtensionProperties";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
struct PropertyData
|
||||
{
|
||||
PropertyData( vk::LayerProperties const & layerProperties_,
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
static char const * AppName = "InstanceLayerProperties";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
|
@ -20,9 +20,6 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
static char const * AppName = "InstanceVersion";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
std::string decodeAPIVersion( uint32_t apiVersion )
|
||||
{
|
||||
return std::to_string( VK_VERSION_MAJOR( apiVersion ) ) + "." + std::to_string( VK_VERSION_MINOR( apiVersion ) ) +
|
||||
|
@ -20,9 +20,6 @@
|
||||
#elif defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
@ -15,16 +15,6 @@
|
||||
// VulkanHpp Samples : OcclusionQuery
|
||||
// Use occlusion query to determine if drawing renders any samples.
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -20,13 +20,9 @@
|
||||
#elif defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -20,13 +20,9 @@
|
||||
#elif defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -20,13 +20,9 @@
|
||||
#elif defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -15,16 +15,6 @@
|
||||
// VulkanHpp Samples : PushDescriptors
|
||||
// Use Push Descriptors to Draw Textured Cube
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -15,7 +15,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4127 ) // conditional expression is constant (glm)
|
||||
#endif
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
namespace vk
|
||||
|
@ -24,9 +24,6 @@
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-volatile" // to keep glm/detail/type_half.inl compiling
|
||||
# endif
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
@ -20,9 +20,6 @@
|
||||
#elif defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
@ -15,16 +15,6 @@
|
||||
// VulkanHpp Samples : Template
|
||||
// Template sample to start from. Draw textured cube with mostly helpers.
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __GNUC__ )
|
||||
# if ( 9 <= __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
|
||||
# endif
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../utils/geometries.hpp"
|
||||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
|
@ -25,8 +25,18 @@
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4127 ) // conditional expression is constant (glm)
|
||||
#endif
|
||||
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
namespace vk
|
||||
{
|
||||
namespace su
|
||||
|
@ -18,9 +18,6 @@
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include <iostream>
|
||||
|
||||
static char const* AppName = "ArrayProxy";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
|
||||
void fct(vk::ArrayProxy<int> /*ap*/)
|
||||
{}
|
||||
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
char const * appName = "DesignatedInitializers";
|
||||
|
11397
vulkan/vulkan.hpp
11397
vulkan/vulkan.hpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user