Check for correct formats specifications only if formats are specified.

This commit is contained in:
asuessenbach 2021-12-08 08:42:04 +01:00
parent ad47832799
commit 78379f769d

View File

@ -1491,22 +1491,25 @@ void VulkanHppGenerator::checkEnumCorrectness() const
} }
// special check for VkFormat // special check for VkFormat
auto enumIt = m_enums.find( "VkFormat" ); if ( !m_formats.empty() )
assert( enumIt != m_enums.end() );
assert( enumIt->second.values.front().name == "VK_FORMAT_UNDEFINED" );
for ( auto enumValueIt = std::next( enumIt->second.values.begin() ); enumValueIt != enumIt->second.values.end();
++enumValueIt )
{ {
auto formatIt = m_formats.find( enumValueIt->name ); auto enumIt = m_enums.find( "VkFormat" );
if ( formatIt == m_formats.end() ) assert( enumIt != m_enums.end() );
assert( enumIt->second.values.front().name == "VK_FORMAT_UNDEFINED" );
for ( auto enumValueIt = std::next( enumIt->second.values.begin() ); enumValueIt != enumIt->second.values.end();
++enumValueIt )
{ {
auto aliasIt = auto formatIt = m_formats.find( enumValueIt->name );
std::find_if( enumIt->second.aliases.begin(), if ( formatIt == m_formats.end() )
enumIt->second.aliases.end(), {
[&enumValueIt]( auto const & ead ) { return ead.second.name == enumValueIt->name; } ); auto aliasIt =
check( aliasIt != enumIt->second.aliases.end(), std::find_if( enumIt->second.aliases.begin(),
enumValueIt->xmlLine, enumIt->second.aliases.end(),
"missing format specification for <" + enumValueIt->name + ">" ); [&enumValueIt]( auto const & ead ) { return ead.second.name == enumValueIt->name; } );
check( aliasIt != enumIt->second.aliases.end(),
enumValueIt->xmlLine,
"missing format specification for <" + enumValueIt->name + ">" );
}
} }
} }
} }