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
diff --git a/tools/relocation_packer/src/debug.h b/tools/relocation_packer/src/debug.h
index 48be6c1..fdfb795 100644
--- a/tools/relocation_packer/src/debug.h
+++ b/tools/relocation_packer/src/debug.h
@@ -81,26 +81,29 @@
// 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)) \