From fd051d36f78dad0f25370acadfe8f6f6ed8cd2fa Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 22 Dec 2017 13:55:53 -0700 Subject: [PATCH] tests: Add a guard around noexcept in vktestbinding.h VS2013 does not provide 'noexcept'. Layers had multiple occurences of a NOEXCEPT macro to protect the VS2013 build. This commit consolidates that macro to a single location in vk_sdk_platform.h, which is also visible to the layer tests via test_common.h. Updates the vktestbinding.h occurences of 'noexcept' to use the NOEXCEPT macro. Change-Id: I38bf8c08cda6fe75de78dff69050a913b47f91b1 --- include/vulkan/vk_sdk_platform.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/include/vulkan/vk_sdk_platform.h b/include/vulkan/vk_sdk_platform.h index ef9a000..96d8676 100644 --- a/include/vulkan/vk_sdk_platform.h +++ b/include/vulkan/vk_sdk_platform.h @@ -43,4 +43,27 @@ #endif // _WIN32 -#endif // VK_SDK_PLATFORM_H +// Check for noexcept support using clang, with fallback to Windows or GCC version numbers +#ifndef NOEXCEPT +#if defined(__clang__) +#if __has_feature(cxx_noexcept) +#define HAS_NOEXCEPT +#endif +#else +#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 +#define HAS_NOEXCEPT +#else +#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS +#define HAS_NOEXCEPT +#endif +#endif +#endif + +#ifdef HAS_NOEXCEPT +#define NOEXCEPT noexcept +#else +#define NOEXCEPT +#endif +#endif + +#endif // VK_SDK_PLATFORM_H