Use [[deprecated]] only if __has_cpp_attribute(deprecated) is true

This commit is contained in:
asuessenbach
2020-04-26 00:10:16 +02:00
parent c7c375eb98
commit 5953d65c16
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