summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2012-01-11 01:24:36 +0000
committerSteve Block <steveblock@google.com>2012-01-11 01:30:28 +0000
commit7bb0007897a2cf3446f14e68f3beb720f46a7bd7 (patch)
tree757123507faf28414dba9cd465a10ce9e5a410fa /Source
parent506b8bf34a2526eff1ac9fedaa29494a39206888 (diff)
downloadexternal_webkit-7bb0007897a2cf3446f14e68f3beb720f46a7bd7.zip
external_webkit-7bb0007897a2cf3446f14e68f3beb720f46a7bd7.tar.gz
external_webkit-7bb0007897a2cf3446f14e68f3beb720f46a7bd7.tar.bz2
Avoid LOG_ASSERT conflicts between the framework and Chromium in AOSP
AOSP defines LOG_ASSERT as well as ALOG_ASSERT, and the former conflicts with Chromium's LOG_ASSERT. We need to work arund this until LOG_ASSERT is removed from the framework in AOSP. Change-Id: I8357486bfd17ea9deb402d07485e8834571f6a22
Diffstat (limited to 'Source')
-rw-r--r--Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h
index 171434b..6d9feb6 100644
--- a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h
+++ b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h
@@ -31,6 +31,11 @@
#include "config.h"
+// Include log.h before any Chromium headers to make sure we pick up
+// ALOG_ASSERT and LOG_ASSERT (if present).
+// TODO: Remove this once LOG_ASSERT is removed from the framework in AOSP.
+#include <cutils/log.h>
+
// Undefine LOG before including chrome code, and if it was defined attempt to
// set the macro to the Android logging macro (which is the only one that
// actually logs).
@@ -40,6 +45,16 @@
#undef LOG
#endif
+// In AOSP, the framework still uses LOG_ASSERT (as well as ALOG_ASSERT), which
+// conflicts with Chromium's LOG_ASSERT. So if defined, we undefine LOG_ASSERT
+// before including Chromium code, then afterwards define it back to the
+// framework macro.
+// TODO: Remove this once LOG_ASSERT is removed from the framework in AOSP.
+#ifdef LOG_ASSERT
+#define LOG_ASSERT_WAS_DEFINED
+#undef LOG_ASSERT
+#endif
+
// Chromium won't build without NDEBUG set, so we set it for all source files
// that use Chromium code. This means that if NDEBUG was previously unset, we
// have to redefine ASSERT() to a no-op, as this is enabled in debug builds.
@@ -110,4 +125,12 @@
#define LOG(priority, tag, ...) LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
#endif
+// If LOG_ASSERT was defined, restore it to the framework macro.
+// TODO: Remove this once LOG_ASSERT is removed from the framework in AOSP.
+#ifdef LOG_ASSERT_WAS_DEFINED
+#undef LOG_ASSERT
+// Copied from log.h.
+#define LOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__)
+#endif
+
#endif