diff options
| author | Dustin Graves <dustin@lunarg.com> | 2016-04-01 15:00:09 -0600 |
|---|---|---|
| committer | Dustin Graves <dustin@lunarg.com> | 2016-04-01 15:13:55 -0600 |
| commit | ede7c1f0cb59ac24441d4fe9bc149931c13d858b (patch) | |
| tree | 9200922b8afa31b6e8379e733b0cfe33ec436e27 | |
| parent | 2b7935ed36a3b7694ec5a0468058e9f26f1451de (diff) | |
| download | usermoji-ede7c1f0cb59ac24441d4fe9bc149931c13d858b.tar.xz | |
layers: Fix VS2013 build
Add macro to enable/disable noexcept based on compiler support.
Solution from:
http://stackoverflow.com/questions/18387640/how-to-deal-with-noexcept-in-visual-studio
Change-Id: Ic2d22c9247b902d6e13120b17fc0b8647f079f7f
| -rw-r--r-- | layers/core_validation.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/layers/core_validation.h b/layers/core_validation.h index f5935d4f..a7a2c053 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -28,6 +28,24 @@ * Author: Mark Lobodzinski <mark@lunarg.com> */ +// Check for noexcept support +#if defined(__clang__) +#if __has_feature(cxx_noexcept) +#define HAS_NOEXCEPT +#endif +#else +#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \ + defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 +#define HAS_NOEXCEPT +#endif +#endif + +#ifdef HAS_NOEXCEPT +#define NOEXCEPT noexcept +#else +#define NOEXCEPT +#endif + // Enable mem_tracker merged code #define MTMERGE 1 @@ -115,14 +133,14 @@ struct MT_OBJ_HANDLE_TYPE { VkDebugReportObjectTypeEXT type; }; -bool operator==(MT_OBJ_HANDLE_TYPE a, MT_OBJ_HANDLE_TYPE b) noexcept { +bool operator==(MT_OBJ_HANDLE_TYPE a, MT_OBJ_HANDLE_TYPE b) NOEXCEPT{ return a.handle == b.handle && a.type == b.type; } namespace std { template<> struct hash<MT_OBJ_HANDLE_TYPE> { - size_t operator()(MT_OBJ_HANDLE_TYPE obj) const noexcept { + size_t operator()(MT_OBJ_HANDLE_TYPE obj) const NOEXCEPT{ return hash<uint64_t>()(obj.handle) ^ hash<uint32_t>()(obj.type); } |
