From 7685c5362527e00741900bd519586e1c66627563 Mon Sep 17 00:00:00 2001 From: Markus Tavenrath Date: Mon, 29 Aug 2016 09:55:22 +0200 Subject: [PATCH] issue #25: Change error checking asserts to std::runtime_error exceptions for invalid enums tags. --- VulkanHppGenerator.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index cb1ff37ea..19119bb42 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1075,7 +1075,11 @@ void readComment(tinyxml2::XMLElement * element, std::string & header) void readEnums( tinyxml2::XMLElement * element, VkData & vkData ) { - assert( element->Attribute( "name" ) ); + if (!element->Attribute("name")) + { + throw std::runtime_error(std::string("spec error: enums element is missing the name attribute")); + } + std::string name = getEnumName(element->Attribute("name")); if ( name != "API Constants" ) { @@ -1090,9 +1094,18 @@ void readEnums( tinyxml2::XMLElement * element, VkData & vkData ) } else { - assert(element->Attribute("type")); + if (!element->Attribute("type")) + { + throw std::runtime_error(std::string("spec error: Attribute("type"); - assert((type == "bitmask") || (type == "enum")); + + if (type != "bitmask" && type != "enum") + { + throw std::runtime_error(std::string("spec error: second.bitmask = (type == "bitmask"); std::string prefix, postfix; if (it->second.bitmask)