From b3e1b52252e7b1a807504d9bbdf88a58d6325d0b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 1 Dec 2015 11:06:05 +0100 Subject: Adapt new/delete exception specs for MSVC ...where plain operator new/delete are reportedly predefined (cf. ) without any exception specs, then redeclared in C:/PROGRA~2/MICROS~1.0/VC/include/new with exception specs that are ignored by MSVC (so it presumably doesn't even complain about the mismatching redeclarations, just effectively ignores them); and array operator new/delete are declared in C:/PROGRA~2/MICROS~1.0/VC/include/crtdbg.h without any exception specs. clang-cl would warn about those inconsistencies. Change-Id: I4dd15e4cfcedc3de5e8617b43769b5371cafa71f --- sal/cpprt/operators_new_delete.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sal/cpprt/operators_new_delete.cxx b/sal/cpprt/operators_new_delete.cxx index 13491bd3889f..8cf69ff07196 100644 --- a/sal/cpprt/operators_new_delete.cxx +++ b/sal/cpprt/operators_new_delete.cxx @@ -145,7 +145,10 @@ static void deallocate (void * p, AllocatorTraits const & rTraits) // T * p = new T; delete p; -void* SAL_CALL operator new (std::size_t n) throw (std::bad_alloc) +void* SAL_CALL operator new (std::size_t n) +#if !defined _MSC_VER + throw (std::bad_alloc) +#endif { return allocate (n, ScalarTraits()); } @@ -188,7 +191,10 @@ void* SAL_CALL operator new[] (std::size_t n) throw (std::bad_alloc) return allocate (n, VectorTraits()); } -void SAL_CALL operator delete[] (void * p) throw () +void SAL_CALL operator delete[] (void * p) +#if !defined _MSC_VER + throw () +#endif { deallocate (p, VectorTraits()); } -- cgit