tests: Add a guard around noexcept in vktestbinding.h
authorDave Houlton <daveh@lunarg.com>
Fri, 22 Dec 2017 20:55:53 +0000 (13:55 -0700)
committerMark Lobodzinski <mark@lunarg.com>
Fri, 4 May 2018 15:31:34 +0000 (09:31 -0600)
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

index ef9a000..96d8676 100644 (file)
 
 #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