From 5d80bf4f75f838867d3186de315225ec8265eae2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 6 Jul 2017 22:22:23 +0300 Subject: Fix different issues in debug_new.cpp --- src/debug/debug_new.cpp | 23 +++++++++++++++++------ src/debug/fast_mutex.h | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src/debug') diff --git a/src/debug/debug_new.cpp b/src/debug/debug_new.cpp index 0daa66fe1..594796570 100644 --- a/src/debug/debug_new.cpp +++ b/src/debug/debug_new.cpp @@ -34,6 +34,14 @@ * @date 2016-10-14 */ +#include "localconsts.h" + +PRAGMACLANG6GCC(GCC diagnostic push) +PRAGMACLANG6GCC(GCC diagnostic ignored "-Wold-style-cast") + +PRAGMA45(GCC diagnostic push) +PRAGMA45(GCC diagnostic ignored "-Wcast-qual") + #include // std::bad_alloc/nothrow_t #include // assert #include // fprintf/stderr @@ -199,9 +207,9 @@ * * Value of the padding bytes at the end of a memory block. */ -#ifndef _DEBUG_NEW_TAILCHECK_CHAR -#define _DEBUG_NEW_TAILCHECK_CHAR 0xCC -#endif +//#ifndef _DEBUG_NEW_TAILCHECK_CHAR +//#define _DEBUG_NEW_TAILCHECK_CHAR 0xCC +//#endif /** * @def _DEBUG_NEW_USE_ADDR2LINE @@ -1036,7 +1044,7 @@ void* operator new[](size_t size, const char* file, int line) * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) */ -void* operator new(size_t size) throw(std::bad_alloc) +void* operator new(size_t size) { return operator new(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); } @@ -1049,7 +1057,7 @@ void* operator new(size_t size) throw(std::bad_alloc) * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) */ -void* operator new[](size_t size) throw(std::bad_alloc) +void* operator new[](size_t size) { return operator new[](size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); } @@ -1183,4 +1191,7 @@ void operator delete[](void* ptr, const std::nothrow_t&) _NOEXCEPT // This is to make Doxygen happy #undef _DEBUG_NEW_REMEMBER_STACK_TRACE -#define _DEBUG_NEW_REMEMBER_STACK_TRACE 0 +//#define _DEBUG_NEW_REMEMBER_STACK_TRACE 0 + +PRAGMA45(GCC diagnostic pop) +PRAGMACLANG6GCC(GCC diagnostic pop) diff --git a/src/debug/fast_mutex.h b/src/debug/fast_mutex.h index bd9fc37d3..39b5fcdc2 100644 --- a/src/debug/fast_mutex.h +++ b/src/debug/fast_mutex.h @@ -237,7 +237,7 @@ NVWA_NAMESPACE_BEGIN : _M_locked(false) # endif { - ::pthread_mutex_init(&_M_mtx_impl, NULL); + ::pthread_mutex_init(&_M_mtx_impl, _NULLPTR); # if _FAST_MUTEX_CHECK_INITIALIZATION _M_initialized = true; # endif -- cgit v1.2.3-60-g2f50