summaryrefslogtreecommitdiff
path: root/lib/common/Box.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/Box.h')
-rw-r--r--lib/common/Box.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/common/Box.h b/lib/common/Box.h
index 158fab7b..91b4967b 100644
--- a/lib/common/Box.h
+++ b/lib/common/Box.h
@@ -17,6 +17,11 @@
#include "BoxPlatform.h"
+<<<<<<< HEAD
+=======
+#include <memory>
+
+>>>>>>> 0.12
// uncomment this line to enable full memory leak finding on all
// malloc-ed blocks (at least, ones used by the STL)
//#define MEMLEAKFINDER_FULL_MALLOC_MONITORING
@@ -38,7 +43,10 @@
#include "Logging.h"
#ifndef BOX_RELEASE_BUILD
+<<<<<<< HEAD
+=======
+>>>>>>> 0.12
extern bool AssertFailuresToSyslog;
#define ASSERT_FAILS_TO_SYSLOG_ON {AssertFailuresToSyslog = true;}
void BoxDebugAssertFailed(const char *cond, const char *file, int line);
@@ -69,7 +77,10 @@
// Exception names
#define EXCEPTION_CODENAMES_EXTENDED
+<<<<<<< HEAD
+=======
+>>>>>>> 0.12
#else
#define ASSERT_FAILS_TO_SYSLOG_ON
#define ASSERT(cond)
@@ -80,9 +91,26 @@
// Box Backup builds release get extra information for exception logging
#define EXCEPTION_CODENAMES_EXTENDED
#define EXCEPTION_CODENAMES_EXTENDED_WITH_DESCRIPTION
+<<<<<<< HEAD
#endif
+=======
+#endif
+
+#if defined DEBUG_LEAKS
+ #ifdef PLATFORM_DISABLE_MEM_LEAK_TESTING
+ #error Compiling with DEBUG_LEAKS enabled, but not supported on this platform
+ #else
+ #define BOX_MEMORY_LEAK_TESTING
+ #endif
+#elif defined BOX_RELEASE_BUILD
+ #ifndef PLATFORM_DISABLE_MEM_LEAK_TESTING
+ #define BOX_MEMORY_LEAK_TESTING
+ #endif
+#endif // DEBUG_LEAKS || BOX_RELEASE_BUILD
+
+>>>>>>> 0.12
#ifdef BOX_MEMORY_LEAK_TESTING
// Memory leak testing
#include "MemLeakFinder.h"
@@ -103,8 +131,23 @@
#define THROW_EXCEPTION(type, subtype) \
{ \
+<<<<<<< HEAD
if(!HideExceptionMessageGuard::ExceptionsHidden()) \
{ \
+=======
+ if((!HideExceptionMessageGuard::ExceptionsHidden() \
+ && !HideSpecificExceptionGuard::IsHidden( \
+ type::ExceptionType, type::subtype)) \
+ || Logging::Guard::IsGuardingFrom(Log::EVERYTHING)) \
+ { \
+ std::auto_ptr<Logging::Guard> guard; \
+ \
+ if(Logging::Guard::IsGuardingFrom(Log::EVERYTHING)) \
+ { \
+ guard.reset(new Logging::Guard(Log::EVERYTHING)); \
+ } \
+ \
+>>>>>>> 0.12
OPTIONAL_DO_BACKTRACE \
BOX_WARNING("Exception thrown: " \
#type "(" #subtype ") " \
@@ -117,12 +160,32 @@
{ \
std::ostringstream _box_throw_line; \
_box_throw_line << message; \
+<<<<<<< HEAD
if(!HideExceptionMessageGuard::ExceptionsHidden()) \
{ \
OPTIONAL_DO_BACKTRACE \
BOX_WARNING("Exception thrown: " \
#type "(" #subtype ") (" << message << \
") at " __FILE__ "(" << __LINE__ << ")") \
+=======
+ if((!HideExceptionMessageGuard::ExceptionsHidden() \
+ && !HideSpecificExceptionGuard::IsHidden( \
+ type::ExceptionType, type::subtype)) \
+ || Logging::Guard::IsGuardingFrom(Log::EVERYTHING)) \
+ { \
+ std::auto_ptr<Logging::Guard> guard; \
+ \
+ if(Logging::Guard::IsGuardingFrom(Log::EVERYTHING)) \
+ { \
+ guard.reset(new Logging::Guard(Log::EVERYTHING)); \
+ } \
+ \
+ OPTIONAL_DO_BACKTRACE \
+ BOX_WARNING("Exception thrown: " \
+ #type "(" #subtype ") (" << \
+ _box_throw_line.str() << \
+ ") at " __FILE__ ":" << __LINE__) \
+>>>>>>> 0.12
} \
throw type(type::subtype, _box_throw_line.str()); \
}