Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1435)

Unified Diff: Source/wtf/Assertions.h

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed config.gni. Minor cleanups. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/wtf/Assertions.h
diff --git a/Source/wtf/Assertions.h b/Source/wtf/Assertions.h
index 612b389fe7bb53594268a44a09871cdc456fdd8d..224978bfaf89cbe56db9cef4edd6200ceb7b5b7a 100644
--- a/Source/wtf/Assertions.h
+++ b/Source/wtf/Assertions.h
@@ -43,40 +43,39 @@
#include "wtf/Compiler.h"
#include "wtf/WTFExport.h"
+// Users must test "#if ENABLE(ASSERT)", which helps ensure that code
+// testing this macro has included this header.
+#ifndef ENABLE_ASSERT
#ifdef NDEBUG
-/* Disable ASSERT* macros in release mode. */
-#define ASSERTIONS_DISABLED_DEFAULT 1
+/* Disable ASSERT* macros in release mode by default. */
+#define ENABLE_ASSERT 0
#else
-#define ASSERTIONS_DISABLED_DEFAULT 0
+#define ENABLE_ASSERT 1
+#endif /* NDEBUG */
#endif
#ifndef BACKTRACE_DISABLED
-#define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT
-#endif
-
-#ifndef ASSERT_ENABLED
-// Notice the not below:
-#define ASSERT_ENABLED !ASSERTIONS_DISABLED_DEFAULT
+#define BACKTRACE_DISABLED !ENABLE(ASSERT)
#endif
#ifndef ASSERT_MSG_DISABLED
-#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#define ASSERT_MSG_DISABLED !ENABLE(ASSERT)
#endif
#ifndef ASSERT_ARG_DISABLED
-#define ASSERT_ARG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#define ASSERT_ARG_DISABLED !ENABLE(ASSERT)
#endif
#ifndef FATAL_DISABLED
-#define FATAL_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#define FATAL_DISABLED !ENABLE(ASSERT)
#endif
#ifndef ERROR_DISABLED
-#define ERROR_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#define ERROR_DISABLED !ENABLE(ASSERT)
#endif
#ifndef LOG_DISABLED
-#define LOG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#define LOG_DISABLED !ENABLE(ASSERT)
#endif
/* WTF logging functions can process %@ in the format string to log a NSObject* but the printf format attribute
@@ -196,7 +195,7 @@ using WTF::FrameToNameScope;
#undef ASSERT
#endif
-#if ASSERT_ENABLED
+#if ENABLE(ASSERT)
#define ASSERT(assertion) \
(!(assertion) ? \
@@ -255,10 +254,12 @@ using WTF::FrameToNameScope;
#endif
-#if defined(ADDRESS_SANITIZER) || ASSERT_ENABLED
-#define SECURITY_ASSERT_ENABLED 1
+/* Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure
+ * that code testing this macro has included this header. */
+#if defined(ADDRESS_SANITIZER) || ENABLE(ASSERT)
+#define ENABLE_SECURITY_ASSERT 1
#else
-#define SECURITY_ASSERT_ENABLED 0
+#define ENABLE_SECURITY_ASSERT 0
#endif
/* ASSERT_WITH_MESSAGE */
@@ -369,7 +370,7 @@ static inline void UNREACHABLE_FOR_PLATFORM()
http://code.google.com/p/chromium/issues/entry?template=Security%20Bug
*/
-#if ASSERT_ENABLED
+#if ENABLE(ASSERT)
#define RELEASE_ASSERT(assertion) ASSERT(assertion)
#define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertion, __VA_ARGS__)
#define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED()

Powered by Google App Engine
This is Rietveld 408576698