mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #1322 from asuessenbach/spaceship
Remove spaceship operator for structures containing function pointers
This commit is contained in:
commit
15788c576c
@ -1961,6 +1961,22 @@ bool VulkanHppGenerator::containsArray( std::string const & type ) const
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VulkanHppGenerator::containsFuncPointer( std::string const & type ) const
|
||||||
|
{
|
||||||
|
// a simple recursive check if a type contains a funcpointer
|
||||||
|
auto structureIt = m_structures.find( type );
|
||||||
|
bool found = false;
|
||||||
|
if ( structureIt != m_structures.end() )
|
||||||
|
{
|
||||||
|
for ( auto memberIt = structureIt->second.members.begin(); memberIt != structureIt->second.members.end() && !found; ++memberIt )
|
||||||
|
{
|
||||||
|
found = ( m_funcPointers.find( memberIt->type.type ) != m_funcPointers.end() ) ||
|
||||||
|
( ( memberIt->type.type != type ) && containsFuncPointer( memberIt->type.type ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
bool VulkanHppGenerator::containsFloatingPoints( std::vector<MemberData> const & members ) const
|
bool VulkanHppGenerator::containsFloatingPoints( std::vector<MemberData> const & members ) const
|
||||||
{
|
{
|
||||||
for ( auto const & m : members )
|
for ( auto const & m : members )
|
||||||
@ -9842,9 +9858,10 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
|
|||||||
|
|
||||||
std::string structName = stripPrefix( structData.first, "Vk" );
|
std::string structName = stripPrefix( structData.first, "Vk" );
|
||||||
|
|
||||||
std::string compareBody, spaceshipOperator, spaceshipOperatorElse, spaceshipOperatorEndif;
|
std::string compareBody, spaceshipOperator, spaceshipOperatorIf, spaceshipOperatorElse, spaceshipOperatorEndif;
|
||||||
if ( nonDefaultCompare )
|
if ( nonDefaultCompare )
|
||||||
{
|
{
|
||||||
|
assert( !containsFuncPointer( structData.first ) );
|
||||||
compareBody = " return " + compareMembers + ";";
|
compareBody = " return " + compareMembers + ";";
|
||||||
|
|
||||||
static const std::string spaceshipOperatorTemplate =
|
static const std::string spaceshipOperatorTemplate =
|
||||||
@ -9853,6 +9870,7 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
|
|||||||
${spaceshipMembers}
|
${spaceshipMembers}
|
||||||
return ${ordering}::equivalent;
|
return ${ordering}::equivalent;
|
||||||
})";
|
})";
|
||||||
|
spaceshipOperatorIf = "#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)";
|
||||||
spaceshipOperator =
|
spaceshipOperator =
|
||||||
replaceWithMap( spaceshipOperatorTemplate, { { "name", structName }, { "ordering", spaceshipOrdering }, { "spaceshipMembers", spaceshipMembers } } );
|
replaceWithMap( spaceshipOperatorTemplate, { { "name", structName }, { "ordering", spaceshipOrdering }, { "spaceshipMembers", spaceshipMembers } } );
|
||||||
spaceshipOperatorElse = "#endif\n";
|
spaceshipOperatorElse = "#endif\n";
|
||||||
@ -9868,13 +9886,17 @@ ${spaceshipMembers}
|
|||||||
#endif)";
|
#endif)";
|
||||||
compareBody = replaceWithMap( compareBodyTemplate, { { "compareMembers", compareMembers } } );
|
compareBody = replaceWithMap( compareBodyTemplate, { { "compareMembers", compareMembers } } );
|
||||||
|
|
||||||
spaceshipOperator = "auto operator<=>( " + structName + " const & ) const = default;";
|
if ( !containsFuncPointer( structData.first ) )
|
||||||
spaceshipOperatorElse = "#else";
|
{
|
||||||
spaceshipOperatorEndif = "#endif\n";
|
spaceshipOperatorIf = "#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)";
|
||||||
|
spaceshipOperator = "auto operator<=>( " + structName + " const & ) const = default;";
|
||||||
|
spaceshipOperatorElse = "#else";
|
||||||
|
spaceshipOperatorEndif = "#endif\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string compareTemplate = R"(
|
static const std::string compareTemplate = R"(
|
||||||
#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)
|
${spaceshipOperatorIf}
|
||||||
${spaceshipOperator}
|
${spaceshipOperator}
|
||||||
${spaceshipOperatorElse}
|
${spaceshipOperatorElse}
|
||||||
bool operator==( ${name} const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator==( ${name} const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
@ -9893,7 +9915,8 @@ ${spaceshipOperatorEndif})";
|
|||||||
{ "compareBody", compareBody },
|
{ "compareBody", compareBody },
|
||||||
{ "spaceshipOperator", spaceshipOperator },
|
{ "spaceshipOperator", spaceshipOperator },
|
||||||
{ "spaceshipOperatorElse", spaceshipOperatorElse },
|
{ "spaceshipOperatorElse", spaceshipOperatorElse },
|
||||||
{ "spaceshipOperatorEndif", spaceshipOperatorEndif } } );
|
{ "spaceshipOperatorEndif", spaceshipOperatorEndif },
|
||||||
|
{ "spaceshipOperatorIf", spaceshipOperatorIf } } );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::string, StructureData> const & structData ) const
|
std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::string, StructureData> const & structData ) const
|
||||||
|
@ -402,6 +402,7 @@ private:
|
|||||||
bool enumerating,
|
bool enumerating,
|
||||||
std::vector<std::string> const & dataTypes ) const;
|
std::vector<std::string> const & dataTypes ) const;
|
||||||
bool containsArray( std::string const & type ) const;
|
bool containsArray( std::string const & type ) const;
|
||||||
|
bool containsFuncPointer( std::string const & type ) const;
|
||||||
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
||||||
bool containsUnion( std::string const & type ) const;
|
bool containsUnion( std::string const & type ) const;
|
||||||
std::vector<size_t> determineConstPointerParams( std::vector<ParamData> const & params ) const;
|
std::vector<size_t> determineConstPointerParams( std::vector<ParamData> const & params ) const;
|
||||||
|
@ -4006,24 +4006,20 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
|
||||||
auto operator<=>( AllocationCallbacks const & ) const = default;
|
|
||||||
#else
|
|
||||||
bool operator==( AllocationCallbacks const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator==( AllocationCallbacks const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
# if defined( VULKAN_HPP_USE_REFLECT )
|
#if defined( VULKAN_HPP_USE_REFLECT )
|
||||||
return this->reflect() == rhs.reflect();
|
return this->reflect() == rhs.reflect();
|
||||||
# else
|
#else
|
||||||
return ( pUserData == rhs.pUserData ) && ( pfnAllocation == rhs.pfnAllocation ) && ( pfnReallocation == rhs.pfnReallocation ) &&
|
return ( pUserData == rhs.pUserData ) && ( pfnAllocation == rhs.pfnAllocation ) && ( pfnReallocation == rhs.pfnReallocation ) &&
|
||||||
( pfnFree == rhs.pfnFree ) && ( pfnInternalAllocation == rhs.pfnInternalAllocation ) && ( pfnInternalFree == rhs.pfnInternalFree );
|
( pfnFree == rhs.pfnFree ) && ( pfnInternalAllocation == rhs.pfnInternalAllocation ) && ( pfnInternalFree == rhs.pfnInternalFree );
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=( AllocationCallbacks const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator!=( AllocationCallbacks const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !operator==( rhs );
|
return !operator==( rhs );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void * pUserData = {};
|
void * pUserData = {};
|
||||||
@ -17685,23 +17681,19 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
|
||||||
auto operator<=>( DebugReportCallbackCreateInfoEXT const & ) const = default;
|
|
||||||
#else
|
|
||||||
bool operator==( DebugReportCallbackCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator==( DebugReportCallbackCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
# if defined( VULKAN_HPP_USE_REFLECT )
|
#if defined( VULKAN_HPP_USE_REFLECT )
|
||||||
return this->reflect() == rhs.reflect();
|
return this->reflect() == rhs.reflect();
|
||||||
# else
|
#else
|
||||||
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( pfnCallback == rhs.pfnCallback ) && ( pUserData == rhs.pUserData );
|
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( pfnCallback == rhs.pfnCallback ) && ( pUserData == rhs.pUserData );
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=( DebugReportCallbackCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator!=( DebugReportCallbackCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !operator==( rhs );
|
return !operator==( rhs );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eDebugReportCallbackCreateInfoEXT;
|
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eDebugReportCallbackCreateInfoEXT;
|
||||||
@ -18364,24 +18356,20 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
|
||||||
auto operator<=>( DebugUtilsMessengerCreateInfoEXT const & ) const = default;
|
|
||||||
#else
|
|
||||||
bool operator==( DebugUtilsMessengerCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator==( DebugUtilsMessengerCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
# if defined( VULKAN_HPP_USE_REFLECT )
|
#if defined( VULKAN_HPP_USE_REFLECT )
|
||||||
return this->reflect() == rhs.reflect();
|
return this->reflect() == rhs.reflect();
|
||||||
# else
|
#else
|
||||||
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( messageSeverity == rhs.messageSeverity ) &&
|
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( messageSeverity == rhs.messageSeverity ) &&
|
||||||
( messageType == rhs.messageType ) && ( pfnUserCallback == rhs.pfnUserCallback ) && ( pUserData == rhs.pUserData );
|
( messageType == rhs.messageType ) && ( pfnUserCallback == rhs.pfnUserCallback ) && ( pUserData == rhs.pUserData );
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=( DebugUtilsMessengerCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator!=( DebugUtilsMessengerCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !operator==( rhs );
|
return !operator==( rhs );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eDebugUtilsMessengerCreateInfoEXT;
|
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eDebugUtilsMessengerCreateInfoEXT;
|
||||||
@ -22930,24 +22918,20 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
|
||||||
auto operator<=>( DeviceDeviceMemoryReportCreateInfoEXT const & ) const = default;
|
|
||||||
#else
|
|
||||||
bool operator==( DeviceDeviceMemoryReportCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator==( DeviceDeviceMemoryReportCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
# if defined( VULKAN_HPP_USE_REFLECT )
|
#if defined( VULKAN_HPP_USE_REFLECT )
|
||||||
return this->reflect() == rhs.reflect();
|
return this->reflect() == rhs.reflect();
|
||||||
# else
|
#else
|
||||||
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( pfnUserCallback == rhs.pfnUserCallback ) &&
|
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( flags == rhs.flags ) && ( pfnUserCallback == rhs.pfnUserCallback ) &&
|
||||||
( pUserData == rhs.pUserData );
|
( pUserData == rhs.pUserData );
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=( DeviceDeviceMemoryReportCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
bool operator!=( DeviceDeviceMemoryReportCreateInfoEXT const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !operator==( rhs );
|
return !operator==( rhs );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eDeviceDeviceMemoryReportCreateInfoEXT;
|
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eDeviceDeviceMemoryReportCreateInfoEXT;
|
||||||
|
Loading…
Reference in New Issue
Block a user