Expand `EMULATOR_LOG_##severity` in the first macro definition (2)

otherwise it expands to the macro value if defined.

I missed some things in the first change.

see go/aog/3449890

Bug: 389753396
Test: presubmit
Change-Id: I318bd8d0a33904647ab86b82313514a427d062fd
Signed-off-by: Roman Kiryanov <rkir@google.com>
GitOrigin-RevId: 3a38c4366abd88e4c126aa89b194e5fdd12e7a55
diff --git a/base/include/aemu/base/logging/Log.h b/base/include/aemu/base/logging/Log.h
index 6319fa8..4eedbe5 100644
--- a/base/include/aemu/base/logging/Log.h
+++ b/base/include/aemu/base/logging/Log.h
@@ -148,7 +148,7 @@
 // if the severity level is disabled.
 //
 // It's possible to do conditional logging with LOG_IF()
-#define LOG(severity) LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity), LOG_MESSAGE_STREAM_COMPACT(severity))
+#define LOG(severity) LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity), LOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // A variant of LOG() that only performs logging if a specific condition
 // is encountered. Note that |condition| is only evaluated if |severity|
@@ -161,16 +161,16 @@
 //            << "Fuel injection at optimal level";
 //
 #define LOG_IF(severity, condition) \
-    LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity) && (condition), LOG_MESSAGE_STREAM_COMPACT(severity))
+    LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity) && (condition), LOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // A variant of LOG() that avoids printing debug information such as file/line
 // information, for user-visible output.
-#define QLOG(severity) LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity), QLOG_MESSAGE_STREAM_COMPACT(severity))
+#define QLOG(severity) LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity), QLOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // A variant of LOG_IF() that avoids printing debug information such as
 // file/line information, for user-visible output.
 #define QLOG_IF(severity, condition) \
-    LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity) && (condition), QLOG_MESSAGE_STREAM_COMPACT(severity))
+    LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity) && (condition), QLOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // A variant of LOG() that integrates with the utils/debug.h verbose tags,
 // enabling statements to only appear on the console if the "-debug-<tag>"
@@ -182,20 +182,20 @@
 // as a command line parameter.
 //
 // When logging is enabled, VLOG statements are logged at the INFO severity.
-#define VLOG(tag) LOG_LAZY_EVAL(VERBOSE_CHECK(tag), LOG_MESSAGE_STREAM_COMPACT(INFO))
+#define VLOG(tag) LOG_LAZY_EVAL(VERBOSE_CHECK_IMPL(VERBOSE_##tag), LOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_INFO))
 
 // A variant of LOG() that also appends the string message corresponding
 // to the current value of 'errno' just before the macro is called. This
 // also preserves the value of 'errno' so it can be tested after the
 // macro call (i.e. any error during log output does not interfere).
-#define PLOG(severity) LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity), PLOG_MESSAGE_STREAM_COMPACT(severity))
+#define PLOG(severity) LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity), PLOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // A variant of LOG_IF() that also appends the string message corresponding
 // to the current value of 'errno' just before the macro is called. This
 // also preserves the value of 'errno' so it can be tested after the
 // macro call (i.e. any error during log output does not interfere).
 #define PLOG_IF(severity, condition) \
-    LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity) && (condition), PLOG_MESSAGE_STREAM_COMPACT(severity))
+    LOG_LAZY_EVAL(LOG_IS_ON_IMPL(EMULATOR_LOG_##severity) && (condition), PLOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // Evaluate |condition|, and if it fails, log a fatal message.
 // This is a better version of assert(), in the future, this will
@@ -271,7 +271,7 @@
 // DLOG_IF() is like DLOG() for debug builds, and doesn't do anything for
 // release one. See DLOG() comments.
 #define DLOG_IF(severity, condition) \
-    LOG_LAZY_EVAL(DLOG_IS_ON(EMULATOR_LOG_##severity) && (condition), LOG_MESSAGE_STREAM_COMPACT(severity))
+    LOG_LAZY_EVAL(DLOG_IS_ON(EMULATOR_LOG_##severity) && (condition), LOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // DCHECK(condition) is used to perform CHECK() in debug builds, or if
 // the program called setDcheckLevel(true) previously. Note that it is
@@ -289,7 +289,7 @@
 // DPLOG_IF() tests whether |condition| is true before calling
 // DPLOG(severity)
 #define DPLOG_IF(severity, condition) \
-    LOG_LAZY_EVAL(DLOG_IS_ON(EMULATOR_LOG_##severity) && (condition), PLOG_MESSAGE_STREAM_COMPACT(severity))
+    LOG_LAZY_EVAL(DLOG_IS_ON(EMULATOR_LOG_##severity) && (condition), PLOG_MESSAGE_STREAM_COMPACT_IMPL(EMULATOR_LOG_##severity))
 
 // Convenience class used hold a formatted string for logging reasons.
 // Usage example:
@@ -404,20 +404,11 @@
     LogStream* mStream;
 };
 
-// Helper macros to avoid too much typing. This creates a new LogMessage
-// instance with the appropriate file source path, file source line and
-// severity.
-#define LOG_MESSAGE_COMPACT(severity) \
-    ::android::base::LogMessage(__FILE__, __LINE__, LOG_SEVERITY_FROM(severity))
+#define LOG_MESSAGE_STREAM_COMPACT_IMPL(severity) \
+    ::android::base::LogMessage(__FILE__, __LINE__, severity).stream()
 
-#define LOG_MESSAGE_STREAM_COMPACT(severity) LOG_MESSAGE_COMPACT(severity).stream()
-
-// A variant of LogMessage for outputting user-visible messages to the console,
-// without debug information.
-#define QLOG_MESSAGE_COMPACT(severity) \
-    ::android::base::LogMessage(__FILE__, __LINE__, LOG_SEVERITY_FROM(severity), true)
-
-#define QLOG_MESSAGE_STREAM_COMPACT(severity) QLOG_MESSAGE_COMPACT(severity).stream()
+#define QLOG_MESSAGE_STREAM_COMPACT_IMPL(severity) \
+    ::android::base::LogMessage(__FILE__, __LINE__, severity, true).stream()
 
 // A variant of LogMessage that saves the errno value on creation,
 // then restores it on destruction, as well as append a strerror()
@@ -439,11 +430,8 @@
     int mErrno;
 };
 
-// Helper macros to avoid too much typing.
-#define PLOG_MESSAGE_COMPACT(severity) \
-    ::android::base::ErrnoLogMessage(__FILE__, __LINE__, LOG_SEVERITY_FROM(severity), errno)
-
-#define PLOG_MESSAGE_STREAM_COMPACT(severity) PLOG_MESSAGE_COMPACT(severity).stream()
+#define PLOG_MESSAGE_STREAM_COMPACT_IMPL(severity) \
+    ::android::base::ErrnoLogMessage(__FILE__, __LINE__, severity, errno).stream()
 
 namespace testing {
 
diff --git a/base/include/aemu/base/logging/LogTags.h b/base/include/aemu/base/logging/LogTags.h
index c870ef7..42c5797 100644
--- a/base/include/aemu/base/logging/LogTags.h
+++ b/base/include/aemu/base/logging/LogTags.h
@@ -26,22 +26,29 @@
 } VerboseTag;
 #undef _VERBOSE_TAG
 
-#define VERBOSE_ENABLE(tag) verbose_enable((int64_t)VERBOSE_##tag)
-#define VERBOSE_DISABLE(tag) verbose_disable(int64_t) VERBOSE_##tag)
-#define VERBOSE_CHECK(tag) verbose_check((int64_t)VERBOSE_##tag)
+#define VERBOSE_ENABLE_IMPL(tag) verbose_enable((int64_t)tag)
+#define VERBOSE_ENABLE(tag) VERBOSE_ENABLE_IMPL(VERBOSE_##tag)
+#define VERBOSE_DISABLE_IMPL(tag) verbose_disable((int64_t)tag)
+#define VERBOSE_DISABLE(tag) VERBOSE_DISABLE_IMPL(VERBOSE_##tag)
+#define VERBOSE_CHECK_IMPL(tag) verbose_check((int64_t)tag)
+#define VERBOSE_CHECK(tag) VERBOSE_CHECK_IMPL(VERBOSE_##tag)
 #define VERBOSE_CHECK_ANY() verbose_check_any();
 
-#define VERBOSE_PRINT(tag, ...) \
-    if (VERBOSE_CHECK(tag)) {   \
+#define VERBOSE_PRINT_IMPL(tag, ...) \
+    if (VERBOSE_CHECK_IMPL(tag)) {   \
         dprint(__VA_ARGS__);  \
     }
 
-#define VERBOSE_INFO(tag, ...) \
-    if (VERBOSE_CHECK(tag)) {  \
+#define VERBOSE_PRINT(tag, ...) VERBOSE_PRINT_IMPL(VERBOSE_##tag, __VA_ARGS__)
+
+#define VERBOSE_INFO_IMPL(tag, ...) \
+    if (VERBOSE_CHECK_IMPL(tag)) {  \
         dinfo(__VA_ARGS__);  \
     }
 
-#define VERBOSE_DPRINT(tag, ...) VERBOSE_PRINT(tag, __VA_ARGS__)
+#define VERBOSE_INFO(tag, ...) VERBOSE_INFO_IMPL(VERBOSE_##tag, __VA_ARGS__)
+
+#define VERBOSE_DPRINT(tag, ...) VERBOSE_PRINT_IMPL(VERBOSE_##tag, __VA_ARGS__)
 
 #ifdef __cplusplus
 }