From 18d0e8c11df23709184e55d0fb22e06d057ae898 Mon Sep 17 00:00:00 2001 From: rnk Date: Thu, 5 May 2016 16:44:34 -0700 Subject: [PATCH] Re-land "Fix invalid using decl in bionic relocation_packer" This time with more namespace qualification. Tested manually by building clang_x64/android_relocation_packer locally, as the Android trybot analyze step does not think it needs to run for this change. Original description: > The code was essentially doing 'using Logger::INFO' in the global > namespace to make its 'LOG(INFO)' macros work. Unfortunately, C++ does > not allow you to use using decls on classes like this unless you are in > a derived class. GCC does not accept this code, and Clang was recently > updated (LLVM r268594) to reject it as well. > > This should fix the Chromium Android ASan build with TOT Clang: > https://build.chromium.org/p/chromium.fyi/builders/ClangToTAndroidASan/ TBR=thakis@chromium.org,sgurun@chromium.org BUG=609543 Review-Url: https://codereview.chromium.org/1952353005 Cr-Commit-Position: refs/heads/master@{#391952} (cherry picked from commit 5762af8ad13e62957493c3e4314a234ee57a4200) Change-Id: Ibc6f6023aef028c5029be128ac799dc67fc6683c --- tools/relocation_packer/src/debug.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/relocation_packer/src/debug.h b/tools/relocation_packer/src/debug.h index 48be6c19b..fdfb79550 100644 --- a/tools/relocation_packer/src/debug.h +++ b/tools/relocation_packer/src/debug.h @@ -81,26 +81,29 @@ class Logger { // Make logging severities visible globally. typedef relocation_packer::Logger::Severity LogSeverity; -using LogSeverity::INFO; -using LogSeverity::WARNING; -using LogSeverity::ERROR; -using LogSeverity::FATAL; // LOG(severity) prints a message with the given severity, and aborts if // severity is FATAL. LOG_IF(severity, predicate) does the same but only if // predicate is true. INT_MIN is guaranteed to be less than or equal to // any verbosity level. -#define LOG(severity) \ - (relocation_packer::Logger(severity, INT_MIN, true).GetStream()) -#define LOG_IF(severity, predicate) \ - (relocation_packer::Logger(severity, INT_MIN, (predicate)).GetStream()) +#define LOG(severity) \ + (relocation_packer::Logger(relocation_packer::Logger::severity, INT_MIN, \ + true) \ + .GetStream()) +#define LOG_IF(severity, predicate) \ + (relocation_packer::Logger(relocation_packer::Logger::severity, INT_MIN, \ + (predicate)) \ + .GetStream()) // VLOG(level) prints its message as INFO if level is less than or equal to // the current verbosity level. -#define VLOG(level) \ - (relocation_packer::Logger(INFO, (level), true).GetStream()) -#define VLOG_IF(level, predicate) \ - (relocation_packer::Logger(INFO, (level), (predicate)).GetStream()) +#define VLOG(level) \ + (relocation_packer::Logger(relocation_packer::Logger::INFO, (level), true) \ + .GetStream()) +#define VLOG_IF(level, predicate) \ + (relocation_packer::Logger(relocation_packer::Logger::INFO, (level), \ + (predicate)) \ + .GetStream()) // CHECK(predicate) fails with a FATAL log message if predicate is false. #define CHECK(predicate) (LOG_IF(FATAL, !(predicate)) \ -- 2.11.0