mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Improved tokenizing of extension attribute "depends" (#1546)
This commit is contained in:
parent
4420e1f91e
commit
2175530fd0
@ -1071,24 +1071,29 @@ void VulkanHppGenerator::checkExtensionCorrectness() const
|
|||||||
{
|
{
|
||||||
for ( auto const & extension : m_extensions )
|
for ( auto const & extension : m_extensions )
|
||||||
{
|
{
|
||||||
// check for existence of any deprecation, obsoletion, or promotion
|
// check for existence of any depends, deprecation, obsoletion, or promotion
|
||||||
|
for ( auto const & depends : extension.depends )
|
||||||
|
{
|
||||||
|
checkForError(
|
||||||
|
isFeature( depends ) || isExtension( depends ), extension.xmlLine, "extension <" + extension.name + "> lists an unknown depends <" + depends + ">" );
|
||||||
|
}
|
||||||
if ( !extension.deprecatedBy.empty() )
|
if ( !extension.deprecatedBy.empty() )
|
||||||
{
|
{
|
||||||
checkForError( isFeature( extension.deprecatedBy ) || isExtension( extension.deprecatedBy ),
|
checkForError( isFeature( extension.deprecatedBy ) || isExtension( extension.deprecatedBy ),
|
||||||
extension.xmlLine,
|
extension.xmlLine,
|
||||||
"extension deprecated by unknown extension/version <" + extension.promotedTo + ">" );
|
"extension <" + extension.name + "> is deprecated by unknown extension/version <" + extension.promotedTo + ">" );
|
||||||
}
|
}
|
||||||
if ( !extension.obsoletedBy.empty() )
|
if ( !extension.obsoletedBy.empty() )
|
||||||
{
|
{
|
||||||
checkForError( isFeature( extension.obsoletedBy ) || isExtension( extension.obsoletedBy ),
|
checkForError( isFeature( extension.obsoletedBy ) || isExtension( extension.obsoletedBy ),
|
||||||
extension.xmlLine,
|
extension.xmlLine,
|
||||||
"extension obsoleted by unknown extension/version <" + extension.promotedTo + ">" );
|
"extension <" + extension.name + "> is obsoleted by unknown extension/version <" + extension.promotedTo + ">" );
|
||||||
}
|
}
|
||||||
if ( !extension.promotedTo.empty() )
|
if ( !extension.promotedTo.empty() )
|
||||||
{
|
{
|
||||||
checkForError( isFeature( extension.promotedTo ) || isExtension( extension.promotedTo ),
|
checkForError( isFeature( extension.promotedTo ) || isExtension( extension.promotedTo ),
|
||||||
extension.xmlLine,
|
extension.xmlLine,
|
||||||
"extension promoted to unknown extension/version <" + extension.promotedTo + ">" );
|
"extension <" + extension.name + "> is promoted to unknown extension/version <" + extension.promotedTo + ">" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for existence of any requirement
|
// check for existence of any requirement
|
||||||
@ -11483,7 +11488,7 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element )
|
|||||||
if ( attribute.first == "depends" )
|
if ( attribute.first == "depends" )
|
||||||
{
|
{
|
||||||
// we don't care about the logical implications of ',' and '+' here, we're just interested to get the depends strings
|
// we don't care about the logical implications of ',' and '+' here, we're just interested to get the depends strings
|
||||||
extensionData.depends = tokenize( attribute.second, "," );
|
extensionData.depends = tokenizeAny( attribute.second, ",+()" );
|
||||||
}
|
}
|
||||||
else if ( attribute.first == "deprecatedby" )
|
else if ( attribute.first == "deprecatedby" )
|
||||||
{
|
{
|
||||||
@ -13750,6 +13755,7 @@ std::vector<std::string> tokenize( std::string const & tokenString, std::string
|
|||||||
|
|
||||||
std::vector<std::string> tokenizeAny( std::string const & tokenString, std::string const & separators )
|
std::vector<std::string> tokenizeAny( std::string const & tokenString, std::string const & separators )
|
||||||
{
|
{
|
||||||
|
size_t len = tokenString.length();
|
||||||
std::vector<std::string> tokens;
|
std::vector<std::string> tokens;
|
||||||
if ( !tokenString.empty() )
|
if ( !tokenString.empty() )
|
||||||
{
|
{
|
||||||
@ -13757,7 +13763,7 @@ std::vector<std::string> tokenizeAny( std::string const & tokenString, std::stri
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
end = tokenString.find_first_of( separators, start );
|
end = tokenString.find_first_of( separators, start );
|
||||||
if ( start != end )
|
if ( ( start != end ) && ( start < len ) )
|
||||||
{
|
{
|
||||||
tokens.push_back( trim( tokenString.substr( start, end - start ) ) );
|
tokens.push_back( trim( tokenString.substr( start, end - start ) ) );
|
||||||
}
|
}
|
||||||
|
@ -140,13 +140,16 @@ static_assert( VK_HEADER_VERSION == 245, "Wrong VK_HEADER_VERSION!" );
|
|||||||
# undef MemoryBarrier
|
# undef MemoryBarrier
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined( __GNUC__ )
|
||||||
|
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
|
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
|
||||||
# if defined( __clang__ )
|
# if defined( __clang__ )
|
||||||
# if __has_feature( cxx_unrestricted_unions )
|
# if __has_feature( cxx_unrestricted_unions )
|
||||||
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
||||||
# endif
|
# endif
|
||||||
# elif defined( __GNUC__ )
|
# elif defined( __GNUC__ )
|
||||||
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
|
|
||||||
# if 40600 <= GCC_VERSION
|
# if 40600 <= GCC_VERSION
|
||||||
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
||||||
# endif
|
# endif
|
||||||
@ -181,12 +184,12 @@ static_assert( VK_HEADER_VERSION == 245, "Wrong VK_HEADER_VERSION!" );
|
|||||||
|
|
||||||
#if defined( __cpp_constexpr )
|
#if defined( __cpp_constexpr )
|
||||||
# define VULKAN_HPP_CONSTEXPR constexpr
|
# define VULKAN_HPP_CONSTEXPR constexpr
|
||||||
# if __cpp_constexpr >= 201304
|
# if 201304 <= __cpp_constexpr
|
||||||
# define VULKAN_HPP_CONSTEXPR_14 constexpr
|
# define VULKAN_HPP_CONSTEXPR_14 constexpr
|
||||||
# else
|
# else
|
||||||
# define VULKAN_HPP_CONSTEXPR_14
|
# define VULKAN_HPP_CONSTEXPR_14
|
||||||
# endif
|
# endif
|
||||||
# if __cpp_constexpr >= 201907
|
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110300 < GCC_VERSION ) )
|
||||||
# define VULKAN_HPP_CONSTEXPR_20 constexpr
|
# define VULKAN_HPP_CONSTEXPR_20 constexpr
|
||||||
# else
|
# else
|
||||||
# define VULKAN_HPP_CONSTEXPR_20
|
# define VULKAN_HPP_CONSTEXPR_20
|
||||||
|
@ -140,13 +140,16 @@ static_assert( VK_HEADER_VERSION == 12, "Wrong VK_HEADER_VERSION!" );
|
|||||||
# undef MemoryBarrier
|
# undef MemoryBarrier
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined( __GNUC__ )
|
||||||
|
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
|
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
|
||||||
# if defined( __clang__ )
|
# if defined( __clang__ )
|
||||||
# if __has_feature( cxx_unrestricted_unions )
|
# if __has_feature( cxx_unrestricted_unions )
|
||||||
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
||||||
# endif
|
# endif
|
||||||
# elif defined( __GNUC__ )
|
# elif defined( __GNUC__ )
|
||||||
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
|
|
||||||
# if 40600 <= GCC_VERSION
|
# if 40600 <= GCC_VERSION
|
||||||
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
|
||||||
# endif
|
# endif
|
||||||
@ -181,12 +184,12 @@ static_assert( VK_HEADER_VERSION == 12, "Wrong VK_HEADER_VERSION!" );
|
|||||||
|
|
||||||
#if defined( __cpp_constexpr )
|
#if defined( __cpp_constexpr )
|
||||||
# define VULKAN_HPP_CONSTEXPR constexpr
|
# define VULKAN_HPP_CONSTEXPR constexpr
|
||||||
# if __cpp_constexpr >= 201304
|
# if 201304 <= __cpp_constexpr
|
||||||
# define VULKAN_HPP_CONSTEXPR_14 constexpr
|
# define VULKAN_HPP_CONSTEXPR_14 constexpr
|
||||||
# else
|
# else
|
||||||
# define VULKAN_HPP_CONSTEXPR_14
|
# define VULKAN_HPP_CONSTEXPR_14
|
||||||
# endif
|
# endif
|
||||||
# if __cpp_constexpr >= 201907
|
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110300 < GCC_VERSION ) )
|
||||||
# define VULKAN_HPP_CONSTEXPR_20 constexpr
|
# define VULKAN_HPP_CONSTEXPR_20 constexpr
|
||||||
# else
|
# else
|
||||||
# define VULKAN_HPP_CONSTEXPR_20
|
# define VULKAN_HPP_CONSTEXPR_20
|
||||||
|
Loading…
Reference in New Issue
Block a user