Change function throwResultException from static to anonymous namespace

This commit is contained in:
asuessenbach 2021-10-25 15:44:42 +02:00
parent 14bfefb209
commit c5218f5a82
2 changed files with 40 additions and 34 deletions

View File

@ -779,12 +779,15 @@ std::string VulkanHppGenerator::generateThrowResultException() const
cases.pop_back(); // remove last newline cases.pop_back(); // remove last newline
const std::string throwTemplate = R"( const std::string throwTemplate = R"(
[[noreturn]] static void throwResultException( Result result, char const * message ) namespace
{ {
switch ( result ) [[noreturn]] void throwResultException( Result result, char const * message )
{ {
switch ( result )
{
${cases} ${cases}
default: throw SystemError( make_error_code( result ) ); default: throw SystemError( make_error_code( result ) );
}
} }
} }
)"; )";

View File

@ -6297,42 +6297,45 @@ namespace VULKAN_HPP_NAMESPACE
}; };
# endif /*VK_USE_PLATFORM_WIN32_KHR*/ # endif /*VK_USE_PLATFORM_WIN32_KHR*/
[[noreturn]] static void throwResultException( Result result, char const * message ) namespace
{ {
switch ( result ) [[noreturn]] void throwResultException( Result result, char const * message )
{ {
case Result::eErrorOutOfHostMemory: throw OutOfHostMemoryError( message ); switch ( result )
case Result::eErrorOutOfDeviceMemory: throw OutOfDeviceMemoryError( message ); {
case Result::eErrorInitializationFailed: throw InitializationFailedError( message ); case Result::eErrorOutOfHostMemory: throw OutOfHostMemoryError( message );
case Result::eErrorDeviceLost: throw DeviceLostError( message ); case Result::eErrorOutOfDeviceMemory: throw OutOfDeviceMemoryError( message );
case Result::eErrorMemoryMapFailed: throw MemoryMapFailedError( message ); case Result::eErrorInitializationFailed: throw InitializationFailedError( message );
case Result::eErrorLayerNotPresent: throw LayerNotPresentError( message ); case Result::eErrorDeviceLost: throw DeviceLostError( message );
case Result::eErrorExtensionNotPresent: throw ExtensionNotPresentError( message ); case Result::eErrorMemoryMapFailed: throw MemoryMapFailedError( message );
case Result::eErrorFeatureNotPresent: throw FeatureNotPresentError( message ); case Result::eErrorLayerNotPresent: throw LayerNotPresentError( message );
case Result::eErrorIncompatibleDriver: throw IncompatibleDriverError( message ); case Result::eErrorExtensionNotPresent: throw ExtensionNotPresentError( message );
case Result::eErrorTooManyObjects: throw TooManyObjectsError( message ); case Result::eErrorFeatureNotPresent: throw FeatureNotPresentError( message );
case Result::eErrorFormatNotSupported: throw FormatNotSupportedError( message ); case Result::eErrorIncompatibleDriver: throw IncompatibleDriverError( message );
case Result::eErrorFragmentedPool: throw FragmentedPoolError( message ); case Result::eErrorTooManyObjects: throw TooManyObjectsError( message );
case Result::eErrorUnknown: throw UnknownError( message ); case Result::eErrorFormatNotSupported: throw FormatNotSupportedError( message );
case Result::eErrorOutOfPoolMemory: throw OutOfPoolMemoryError( message ); case Result::eErrorFragmentedPool: throw FragmentedPoolError( message );
case Result::eErrorInvalidExternalHandle: throw InvalidExternalHandleError( message ); case Result::eErrorUnknown: throw UnknownError( message );
case Result::eErrorFragmentation: throw FragmentationError( message ); case Result::eErrorOutOfPoolMemory: throw OutOfPoolMemoryError( message );
case Result::eErrorInvalidOpaqueCaptureAddress: throw InvalidOpaqueCaptureAddressError( message ); case Result::eErrorInvalidExternalHandle: throw InvalidExternalHandleError( message );
case Result::eErrorSurfaceLostKHR: throw SurfaceLostKHRError( message ); case Result::eErrorFragmentation: throw FragmentationError( message );
case Result::eErrorNativeWindowInUseKHR: throw NativeWindowInUseKHRError( message ); case Result::eErrorInvalidOpaqueCaptureAddress: throw InvalidOpaqueCaptureAddressError( message );
case Result::eErrorOutOfDateKHR: throw OutOfDateKHRError( message ); case Result::eErrorSurfaceLostKHR: throw SurfaceLostKHRError( message );
case Result::eErrorIncompatibleDisplayKHR: throw IncompatibleDisplayKHRError( message ); case Result::eErrorNativeWindowInUseKHR: throw NativeWindowInUseKHRError( message );
case Result::eErrorValidationFailedEXT: throw ValidationFailedEXTError( message ); case Result::eErrorOutOfDateKHR: throw OutOfDateKHRError( message );
case Result::eErrorInvalidShaderNV: throw InvalidShaderNVError( message ); case Result::eErrorIncompatibleDisplayKHR: throw IncompatibleDisplayKHRError( message );
case Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT: case Result::eErrorValidationFailedEXT: throw ValidationFailedEXTError( message );
throw InvalidDrmFormatModifierPlaneLayoutEXTError( message ); case Result::eErrorInvalidShaderNV: throw InvalidShaderNVError( message );
case Result::eErrorNotPermittedEXT: throw NotPermittedEXTError( message ); case Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT:
throw InvalidDrmFormatModifierPlaneLayoutEXTError( message );
case Result::eErrorNotPermittedEXT: throw NotPermittedEXTError( message );
# if defined( VK_USE_PLATFORM_WIN32_KHR ) # if defined( VK_USE_PLATFORM_WIN32_KHR )
case Result::eErrorFullScreenExclusiveModeLostEXT: throw FullScreenExclusiveModeLostEXTError( message ); case Result::eErrorFullScreenExclusiveModeLostEXT: throw FullScreenExclusiveModeLostEXTError( message );
# endif /*VK_USE_PLATFORM_WIN32_KHR*/ # endif /*VK_USE_PLATFORM_WIN32_KHR*/
default: throw SystemError( make_error_code( result ) ); default: throw SystemError( make_error_code( result ) );
}
} }
} } // namespace
#endif #endif
template <typename T> template <typename T>