Fix the implicit-exception-spec-mismatch warning
authorJan Vorlicek <janvorli@microsoft.com>
Mon, 25 May 2015 11:05:52 +0000 (13:05 +0200)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 26 May 2015 12:37:51 +0000 (14:37 +0200)
Fix the warning. Since VC++ until VS2015 doesn't support the noexcept keyword,
define a NOEXCEPT macro as empty for VC++ older than VS2015 and as noexcept for others.

CMakeLists.txt
src/inc/utilcode.h
src/utilcode/clrhost_nodependencies.cpp

index 4c0ca81..e40abcd 100644 (file)
@@ -279,7 +279,6 @@ add_compile_options(-Werror)
 
 # Disabled warnings
 add_compile_options(-Wno-unused-private-field)
-add_compile_options(-Wno-implicit-exception-spec-mismatch)
 # A derived class defines a virtual method with the same name as its base
 # class, but different set of parameters.
 add_compile_options(-Wno-overloaded-virtual)
index 9fa52ab..bcb8713 100644 (file)
@@ -189,6 +189,12 @@ typedef LPSTR   LPUTF8;
 #define sizeofmember(c,m) (sizeof(((c*)0)->m))
 #endif
 
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define NOEXCEPT
+#else
+#define NOEXCEPT noexcept
+#endif
+
 //=--------------------------------------------------------------------------=
 // Prefast helpers.
 //
@@ -506,10 +512,10 @@ _Ret_bytecap_(_Size) void * __cdecl
 operator new[](size_t n);
 
 void __cdecl
-operator delete(void *p);
+operator delete(void *p) NOEXCEPT;
 
 void __cdecl
-operator delete[](void *p);
+operator delete[](void *p) NOEXCEPT;
 
 #ifdef _DEBUG_IMPL
 HRESULT _OutOfMemory(LPCSTR szFile, int iLine);
index 63f0f63..33f270e 100644 (file)
@@ -471,7 +471,7 @@ void * __cdecl operator new[](size_t n, const NoThrow&)
 __attribute__((visibility("hidden")))
 #endif
 void __cdecl
-operator delete(void *p)
+operator delete(void *p) NOEXCEPT
 {
     STATIC_CONTRACT_NOTHROW;
     STATIC_CONTRACT_GC_NOTRIGGER;
@@ -487,7 +487,7 @@ operator delete(void *p)
 __attribute__((visibility("hidden")))
 #endif
 void __cdecl
-operator delete[](void *p)
+operator delete[](void *p) NOEXCEPT
 {
     STATIC_CONTRACT_NOTHROW;
     STATIC_CONTRACT_GC_NOTRIGGER;