Add an error check on functions returning VkResult but not specifying success codes. (#262)

This commit is contained in:
Andreas Süßenbach 2018-10-15 14:27:42 +02:00 committed by Markus Tavenrath
parent 38fd14d13c
commit 605ff24487
2 changed files with 14 additions and 0 deletions

View File

@ -1415,6 +1415,18 @@ bool VulkanHppGenerator::containsUnion(std::string const& type, std::map<std::st
return found;
}
void VulkanHppGenerator::checkCorrectness()
{
for (auto command : m_commands)
{
// check that functions returning a VkResult specify successcodes
if ((command.second.unchangedReturnType == "VkResult") && command.second.successCodes.empty())
{
throw std::runtime_error("Spec error on command Vk" + startUpperCase(command.first) + " : missing successcodes on command returning VkResult!");
}
}
}
std::map<std::string, std::string> VulkanHppGenerator::createDefaults()
{
std::map<std::string, std::string> defaultValues;
@ -5219,6 +5231,7 @@ int main( int argc, char **argv )
}
}
generator.checkCorrectness();
generator.sortDependencies();
#if !defined(NDEBUG)

View File

@ -30,6 +30,7 @@ class VulkanHppGenerator
m_handles.insert(std::make_pair("", HandleData())); // insert the default "handle" without class (for createInstance, and such)
}
void checkCorrectness();
std::map<std::string, std::string> createDefaults();
std::string const& getTypesafeCheck() const;
std::string const& getVersion() const;