Merge pull request #579 from asuessenbach/deprecated

Use [[deprecated]] only if __has_cpp_attribute(deprecated) is true
This commit is contained in:
Andreas Süßenbach 2020-04-26 00:41:26 +02:00 committed by GitHub
commit b58aa05aeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 89 additions and 51 deletions

View File

@ -1811,7 +1811,7 @@ void VulkanHppGenerator::appendEnums( std::string & str ) const
{
str += R"(
template<ObjectType value>
struct [[deprecated("vk::cpp_type is deprecated. Use vk::CppType instead.")]] cpp_type
struct VULKAN_HPP_DEPRECATED("vk::cpp_type is deprecated. Use vk::CppType instead.") cpp_type
{};
)";
}
@ -3267,7 +3267,7 @@ ${commands}
static_assert( sizeof( ${className} ) == sizeof( Vk${className} ), "handle and wrapper have different size!" );
template <>
struct [[deprecated("vk::cpp_type is deprecated. Use vk::CppType instead.")]] cpp_type<ObjectType::e${className}>
struct VULKAN_HPP_DEPRECATED("vk::cpp_type is deprecated. Use vk::CppType instead.") cpp_type<ObjectType::e${className}>
{
using type = ${className};
};
@ -7612,6 +7612,15 @@ int main( int argc, char ** argv )
# endif
#endif
#ifdef __has_cpp_attribute // Check if __has_cpp_attribute is present
# if __has_cpp_attribute(deprecated) // Check for an attribute
# define VULKAN_HPP_DEPRECATED(msg) [[deprecated(msg)]]
# endif
#endif
#ifndef VULKAN_HPP_DEPRECATED
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if !defined(VULKAN_HPP_NAMESPACE)
#define VULKAN_HPP_NAMESPACE vk
#endif

View File

@ -171,6 +171,15 @@ static_assert( VK_HEADER_VERSION == 137, "Wrong VK_HEADER_VERSION!" );
# endif
#endif
#ifdef __has_cpp_attribute // Check if __has_cpp_attribute is present
# if __has_cpp_attribute( deprecated ) // Check for an attribute
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
# endif
#endif
#ifndef VULKAN_HPP_DEPRECATED
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
@ -7464,7 +7473,8 @@ namespace VULKAN_HPP_NAMESPACE
}
template <ObjectType value>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type{};
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type
{};
enum class PeerMemoryFeatureFlagBits : VkPeerMemoryFeatureFlags
{
@ -16748,7 +16758,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( SurfaceKHR ) == sizeof( VkSurfaceKHR ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eSurfaceKHR>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eSurfaceKHR>
{
using type = SurfaceKHR;
};
@ -16833,8 +16844,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDebugReportCallbackEXT>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDebugReportCallbackEXT>
{
using type = DebugReportCallbackEXT;
};
@ -16919,8 +16930,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDebugUtilsMessengerEXT>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDebugUtilsMessengerEXT>
{
using type = DebugUtilsMessengerEXT;
};
@ -17000,7 +17011,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( DisplayKHR ) == sizeof( VkDisplayKHR ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDisplayKHR>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDisplayKHR>
{
using type = DisplayKHR;
};
@ -17081,7 +17093,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( SwapchainKHR ) == sizeof( VkSwapchainKHR ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eSwapchainKHR>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eSwapchainKHR>
{
using type = SwapchainKHR;
};
@ -17160,7 +17173,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Semaphore ) == sizeof( VkSemaphore ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eSemaphore>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eSemaphore>
{
using type = Semaphore;
};
@ -17239,7 +17253,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Fence ) == sizeof( VkFence ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eFence>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eFence>
{
using type = Fence;
};
@ -17327,8 +17341,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::ePerformanceConfigurationINTEL>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::ePerformanceConfigurationINTEL>
{
using type = PerformanceConfigurationINTEL;
};
@ -17407,7 +17421,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( QueryPool ) == sizeof( VkQueryPool ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eQueryPool>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eQueryPool>
{
using type = QueryPool;
};
@ -17486,7 +17501,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Buffer ) == sizeof( VkBuffer ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eBuffer>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eBuffer>
{
using type = Buffer;
};
@ -17567,7 +17582,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( PipelineLayout ) == sizeof( VkPipelineLayout ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::ePipelineLayout>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::ePipelineLayout>
{
using type = PipelineLayout;
};
@ -17648,7 +17664,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( DescriptorSet ) == sizeof( VkDescriptorSet ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDescriptorSet>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDescriptorSet>
{
using type = DescriptorSet;
};
@ -17727,7 +17744,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Pipeline ) == sizeof( VkPipeline ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::ePipeline>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::ePipeline>
{
using type = Pipeline;
};
@ -17806,7 +17823,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( ImageView ) == sizeof( VkImageView ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eImageView>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eImageView>
{
using type = ImageView;
};
@ -17885,7 +17903,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Image ) == sizeof( VkImage ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eImage>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eImage>
{
using type = Image;
};
@ -17971,8 +17989,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eAccelerationStructureKHR>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eAccelerationStructureKHR>
{
using type = AccelerationStructureKHR;
};
@ -18059,8 +18077,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDescriptorUpdateTemplate>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDescriptorUpdateTemplate>
{
using type = DescriptorUpdateTemplate;
};
@ -18140,7 +18158,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Event ) == sizeof( VkEvent ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eEvent>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eEvent>
{
using type = Event;
};
@ -19345,7 +19363,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( CommandBuffer ) == sizeof( VkCommandBuffer ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eCommandBuffer>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eCommandBuffer>
{
using type = CommandBuffer;
};
@ -19426,7 +19445,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( DeviceMemory ) == sizeof( VkDeviceMemory ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDeviceMemory>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDeviceMemory>
{
using type = DeviceMemory;
};
@ -19506,7 +19526,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( BufferView ) == sizeof( VkBufferView ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eBufferView>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eBufferView>
{
using type = BufferView;
};
@ -19587,7 +19608,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( CommandPool ) == sizeof( VkCommandPool ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eCommandPool>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eCommandPool>
{
using type = CommandPool;
};
@ -19668,7 +19690,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( PipelineCache ) == sizeof( VkPipelineCache ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::ePipelineCache>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::ePipelineCache>
{
using type = PipelineCache;
};
@ -19753,8 +19776,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [
[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDeferredOperationKHR>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDeferredOperationKHR>
{
using type = DeferredOperationKHR;
};
@ -19836,7 +19859,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( DescriptorPool ) == sizeof( VkDescriptorPool ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDescriptorPool>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDescriptorPool>
{
using type = DescriptorPool;
};
@ -19920,8 +19944,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [
[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDescriptorSetLayout>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDescriptorSetLayout>
{
using type = DescriptorSetLayout;
};
@ -20002,7 +20026,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Framebuffer ) == sizeof( VkFramebuffer ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eFramebuffer>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eFramebuffer>
{
using type = Framebuffer;
};
@ -20088,8 +20113,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eIndirectCommandsLayoutNV>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eIndirectCommandsLayoutNV>
{
using type = IndirectCommandsLayoutNV;
};
@ -20169,7 +20194,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( RenderPass ) == sizeof( VkRenderPass ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eRenderPass>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eRenderPass>
{
using type = RenderPass;
};
@ -20248,7 +20274,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Sampler ) == sizeof( VkSampler ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eSampler>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eSampler>
{
using type = Sampler;
};
@ -20333,8 +20359,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [[deprecated(
"vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eSamplerYcbcrConversion>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eSamplerYcbcrConversion>
{
using type = SamplerYcbcrConversion;
};
@ -20416,7 +20442,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( ShaderModule ) == sizeof( VkShaderModule ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eShaderModule>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eShaderModule>
{
using type = ShaderModule;
};
@ -20500,8 +20527,8 @@ namespace VULKAN_HPP_NAMESPACE
"handle and wrapper have different size!" );
template <>
struct [
[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eValidationCacheEXT>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eValidationCacheEXT>
{
using type = ValidationCacheEXT;
};
@ -20668,7 +20695,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Queue ) == sizeof( VkQueue ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eQueue>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eQueue>
{
using type = Queue;
};
@ -24234,7 +24261,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Device ) == sizeof( VkDevice ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDevice>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDevice>
{
using type = Device;
};
@ -24315,7 +24342,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( DisplayModeKHR ) == sizeof( VkDisplayModeKHR ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eDisplayModeKHR>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eDisplayModeKHR>
{
using type = DisplayModeKHR;
};
@ -25364,7 +25392,8 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( PhysicalDevice ) == sizeof( VkPhysicalDevice ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::ePhysicalDevice>
struct VULKAN_HPP_DEPRECATED(
"vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::ePhysicalDevice>
{
using type = PhysicalDevice;
};
@ -25957,7 +25986,7 @@ namespace VULKAN_HPP_NAMESPACE
static_assert( sizeof( Instance ) == sizeof( VkInstance ), "handle and wrapper have different size!" );
template <>
struct [[deprecated( "vk::cpp_type is deprecated. Use vk::CppType instead." )]] cpp_type<ObjectType::eInstance>
struct VULKAN_HPP_DEPRECATED( "vk::cpp_type is deprecated. Use vk::CppType instead." ) cpp_type<ObjectType::eInstance>
{
using type = Instance;
};