summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf/Assertions.h
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/wtf/Assertions.h')
-rw-r--r--JavaScriptCore/wtf/Assertions.h49
1 files changed, 39 insertions, 10 deletions
diff --git a/JavaScriptCore/wtf/Assertions.h b/JavaScriptCore/wtf/Assertions.h
index 0e02af5..3f3af72 100644
--- a/JavaScriptCore/wtf/Assertions.h
+++ b/JavaScriptCore/wtf/Assertions.h
@@ -44,9 +44,9 @@
#include "Platform.h"
-#if COMPILER(MSVC)
#include <stddef.h>
-#else
+
+#if !COMPILER(MSVC)
#include <inttypes.h>
#endif
@@ -55,13 +55,19 @@
#include <e32debug.h>
#endif
+#if PLATFORM(BREWMP)
+#include <AEEError.h>
+#include <AEEdbg.h>
+#endif
+
#ifdef NDEBUG
+/* Disable ASSERT* macros in release mode. */
#define ASSERTIONS_DISABLED_DEFAULT 1
#else
#define ASSERTIONS_DISABLED_DEFAULT 0
#endif
-#if COMPILER(MSVC7) || COMPILER(WINSCW)
+#if COMPILER(MSVC7_OR_LOWER) || COMPILER(WINSCW)
#define HAVE_VARIADIC_MACRO 0
#else
#define HAVE_VARIADIC_MACRO 1
@@ -148,14 +154,26 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
}
#endif
-/* CRASH -- gets us into the debugger or the crash reporter -- signals are ignored by the crash reporter so we must do better */
+/* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter.
+
+ Use CRASH() in response to known, unrecoverable errors like out-of-memory.
+ Macro is enabled in both debug and release mode.
+ To test for unknown errors and verify assumptions, use ASSERT instead, to avoid impacting performance in release builds.
+ Signals are ignored by the crash reporter on OS X so we must do better.
+*/
#ifndef CRASH
#if OS(SYMBIAN)
#define CRASH() do { \
__DEBUGGER(); \
User::Panic(_L("Webkit CRASH"),0); \
} while(false)
+#elif PLATFORM(BREWMP)
+#define CRASH() do { \
+ dbg_Message("WebKit CRASH", DBG_MSG_LEVEL_FATAL, __FILE__, __LINE__); \
+ *(int *)(uintptr_t)0xbbadbeef = 0; \
+ ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
+} while(false)
#else
#define CRASH() do { \
*(int *)(uintptr_t)0xbbadbeef = 0; \
@@ -164,7 +182,11 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
#endif
#endif
-/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED */
+/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED
+
+ These macros are compiled out of release builds.
+ Expressions inside them are evaluated in debug builds only.
+*/
#if OS(WINCE) && !PLATFORM(TORCHMOBILE)
/* FIXME: We include this here only to avoid a conflict with the ASSERT macro. */
@@ -191,7 +213,14 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
#define ASSERT(assertion) ((void)0)
#define ASSERT_NOT_REACHED() ((void)0)
+
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void assertUnused(T& x) { (void)x; }
+#define ASSERT_UNUSED(variable, assertion) (assertUnused(variable))
+#else
#define ASSERT_UNUSED(variable, assertion) ((void)variable)
+#endif
#else
@@ -213,7 +242,7 @@ while (0)
/* ASSERT_WITH_MESSAGE */
-#if COMPILER(MSVC7)
+#if COMPILER(MSVC7_OR_LOWER)
#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
#elif COMPILER(WINSCW)
#define ASSERT_WITH_MESSAGE(assertion, arg...) ((void)0)
@@ -253,7 +282,7 @@ while (0)
/* FATAL */
-#if COMPILER(MSVC7)
+#if COMPILER(MSVC7_OR_LOWER)
#define FATAL() ((void)0)
#elif COMPILER(WINSCW)
#define FATAL(arg...) ((void)0)
@@ -268,7 +297,7 @@ while (0)
/* LOG_ERROR */
-#if COMPILER(MSVC7)
+#if COMPILER(MSVC7_OR_LOWER)
#define LOG_ERROR() ((void)0)
#elif COMPILER(WINSCW)
#define LOG_ERROR(arg...) ((void)0)
@@ -280,7 +309,7 @@ while (0)
/* LOG */
-#if COMPILER(MSVC7)
+#if COMPILER(MSVC7_OR_LOWER)
#define LOG() ((void)0)
#elif COMPILER(WINSCW)
#define LOG(arg...) ((void)0)
@@ -294,7 +323,7 @@ while (0)
/* LOG_VERBOSE */
-#if COMPILER(MSVC7)
+#if COMPILER(MSVC7_OR_LOWER)
#define LOG_VERBOSE(channel) ((void)0)
#elif COMPILER(WINSCW)
#define LOG_VERBOSE(channel, arg...) ((void)0)