Enclose "free" in parenthesis to prevent interference with MSVC's debug free

This commit is contained in:
asuessenbach 2022-02-10 09:49:24 +01:00
parent 20e2594743
commit 1b12dd8cbb
4 changed files with 64 additions and 49 deletions

View File

@ -3136,6 +3136,20 @@ std::string VulkanHppGenerator::generateCommandDefinitions( std::string const &
destroyCommandString.replace( pos, commandName.length(), shortenedName );
pos = destroyCommandString.find( commandName, pos );
}
// special handling for "free", to prevent interfering with MSVC debug free!
if ( shortenedName == "free" )
{
std::string toEncloseString = stripPrefix( handle, "Vk" ) + "::free";
std::string enclosedString = "( " + toEncloseString + " )";
pos = destroyCommandString.find( toEncloseString );
while ( pos != std::string::npos )
{
destroyCommandString.replace( pos, toEncloseString.length(), enclosedString );
pos = destroyCommandString.find( toEncloseString, pos + enclosedString.length() );
}
}
// we need to remove the default argument for the first argument, to prevent ambiguities!
assert( 1 < commandIt->second.params.size() );
pos = destroyCommandString.find( commandIt->second.params[1].name ); // skip the standard version of the function
@ -6031,7 +6045,8 @@ std::string VulkanHppGenerator::generateDestroyCommand( std::string const & name
}
else if ( name.substr( 2, 4 ) == "Free" )
{
shortenedName = "free";
// enclose "free" in parenthesis to prevent interference with MSVC debug free
shortenedName = "( free )";
}
else
{
@ -16470,7 +16485,7 @@ int main( int argc, char ** argv )
void destroy( T t ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch );
( m_owner.free )( t, m_allocationCallbacks, *m_dispatch );
}
private:
@ -16570,7 +16585,7 @@ int main( int argc, char ** argv )
template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT
{
m_owner.free( m_pool, t, *m_dispatch );
( m_owner.free )( m_pool, t, *m_dispatch );
}
private:

View File

@ -5971,7 +5971,7 @@ namespace VULKAN_HPP_NAMESPACE
void destroy( T t ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch );
( m_owner.free )( t, m_allocationCallbacks, *m_dispatch );
}
private:
@ -6037,7 +6037,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T>
void destroy( T t ) VULKAN_HPP_NOEXCEPT
{
m_owner.free( m_pool, t, *m_dispatch );
( m_owner.free )( m_pool, t, *m_dispatch );
}
private:

View File

@ -964,7 +964,7 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch>
VULKAN_HPP_INLINE void Device::free( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
VULKAN_HPP_INLINE void( Device::free )( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
const VULKAN_HPP_NAMESPACE::AllocationCallbacks * pAllocator,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
{
@ -975,7 +975,7 @@ namespace VULKAN_HPP_NAMESPACE
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch>
VULKAN_HPP_INLINE void Device::free( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
VULKAN_HPP_INLINE void( Device::free )( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
Optional<const VULKAN_HPP_NAMESPACE::AllocationCallbacks> allocator,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
{
@ -3862,7 +3862,7 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch>
VULKAN_HPP_INLINE Result Device::free( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
VULKAN_HPP_INLINE Result( Device::free )( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
uint32_t descriptorSetCount,
const VULKAN_HPP_NAMESPACE::DescriptorSet * pDescriptorSets,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
@ -3877,8 +3877,8 @@ namespace VULKAN_HPP_NAMESPACE
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch>
VULKAN_HPP_INLINE typename ResultValueType<void>::type
Device::free( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
VULKAN_HPP_INLINE typename ResultValueType<void>::type( Device::free )(
VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
ArrayProxy<const VULKAN_HPP_NAMESPACE::DescriptorSet> const & descriptorSets,
Dispatch const & d ) const
{
@ -3888,7 +3888,7 @@ namespace VULKAN_HPP_NAMESPACE
static_cast<VkDescriptorPool>( descriptorPool ),
descriptorSets.size(),
reinterpret_cast<const VkDescriptorSet *>( descriptorSets.data() ) ) );
return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING "::Device::free" );
return createResultValue( result, VULKAN_HPP_NAMESPACE_STRING "::( Device::free )" );
}
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -4433,7 +4433,7 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch>
VULKAN_HPP_INLINE void Device::free( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
VULKAN_HPP_INLINE void( Device::free )( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
uint32_t commandBufferCount,
const VULKAN_HPP_NAMESPACE::CommandBuffer * pCommandBuffers,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
@ -4447,7 +4447,7 @@ namespace VULKAN_HPP_NAMESPACE
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch>
VULKAN_HPP_INLINE void Device::free( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
VULKAN_HPP_INLINE void( Device::free )( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
ArrayProxy<const VULKAN_HPP_NAMESPACE::CommandBuffer> const & commandBuffers,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
{

View File

@ -7791,12 +7791,12 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void free( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
void( free )( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
const VULKAN_HPP_NAMESPACE::AllocationCallbacks * pAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void free( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
void( free )( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
Optional<const VULKAN_HPP_NAMESPACE::AllocationCallbacks> allocator
VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
@ -8993,14 +8993,14 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
Result free( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
Result( free )( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
uint32_t descriptorSetCount,
const VULKAN_HPP_NAMESPACE::DescriptorSet * pDescriptorSets,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
typename ResultValueType<void>::type
free( VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
typename ResultValueType<void>::type( free )(
VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool,
ArrayProxy<const VULKAN_HPP_NAMESPACE::DescriptorSet> const & descriptorSets,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -9243,13 +9243,13 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void free( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
void( free )( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
uint32_t commandBufferCount,
const VULKAN_HPP_NAMESPACE::CommandBuffer * pCommandBuffers,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
void free( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
void( free )( VULKAN_HPP_NAMESPACE::CommandPool commandPool,
ArrayProxy<const VULKAN_HPP_NAMESPACE::CommandBuffer> const & commandBuffers,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/