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,9 +964,9 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch>
VULKAN_HPP_INLINE void Device::free( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
const VULKAN_HPP_NAMESPACE::AllocationCallbacks * pAllocator,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
VULKAN_HPP_INLINE void( Device::free )( VULKAN_HPP_NAMESPACE::DeviceMemory memory,
const VULKAN_HPP_NAMESPACE::AllocationCallbacks * pAllocator,
Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
d.vkFreeMemory(
@ -975,9 +975,9 @@ namespace VULKAN_HPP_NAMESPACE
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch>
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
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
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
d.vkFreeMemory( m_device,
@ -3862,10 +3862,10 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch>
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
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
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
return static_cast<Result>(
@ -3877,10 +3877,10 @@ 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,
ArrayProxy<const VULKAN_HPP_NAMESPACE::DescriptorSet> const & descriptorSets,
Dispatch const & d ) const
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
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
Result result = static_cast<Result>(
@ -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,10 +4433,10 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch>
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
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
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
d.vkFreeCommandBuffers( m_device,
@ -4447,9 +4447,9 @@ namespace VULKAN_HPP_NAMESPACE
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Dispatch>
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
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
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
d.vkFreeCommandBuffers( m_device,

View File

@ -7791,15 +7791,15 @@ 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,
const VULKAN_HPP_NAMESPACE::AllocationCallbacks * pAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
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,
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;
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;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -8993,16 +8993,16 @@ 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,
uint32_t descriptorSetCount,
const VULKAN_HPP_NAMESPACE::DescriptorSet * pDescriptorSets,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
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,
ArrayProxy<const VULKAN_HPP_NAMESPACE::DescriptorSet> const & descriptorSets,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
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*/
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
@ -9243,15 +9243,15 @@ 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,
uint32_t commandBufferCount,
const VULKAN_HPP_NAMESPACE::CommandBuffer * pCommandBuffers,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
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,
ArrayProxy<const VULKAN_HPP_NAMESPACE::CommandBuffer> const & commandBuffers,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
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*/
//=== VK_VERSION_1_1 ===