From 7bb0007897a2cf3446f14e68f3beb720f46a7bd7 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 11 Jan 2012 01:24:36 +0000 Subject: 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 --- .../android/WebCoreSupport/ChromiumIncludes.h | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h') 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 + // 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 -- cgit v1.1