From 65d61d76a3c1ca808e17c94cea35dbb90d717997 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 17 Jun 2022 10:25:29 +0000 Subject: [PATCH] Log: Fix unused variable warnings when DAWN_DISABLE_LOGGING Bug: chromium:1337052 Change-Id: I86df0a26af345630905b4ee94c03bbac60504474 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94100 Reviewed-by: Ben Clayton Commit-Queue: Ben Clayton Kokoro: Kokoro Auto-Submit: Corentin Wallez --- src/dawn/common/Log.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dawn/common/Log.cpp b/src/dawn/common/Log.cpp index 5edc40e131..21197221d8 100644 --- a/src/dawn/common/Log.cpp +++ b/src/dawn/common/Log.cpp @@ -70,12 +70,14 @@ LogMessage::LogMessage(LogMessage&& other) = default; LogMessage& LogMessage::operator=(LogMessage&& other) = default; -LogMessage::~LogMessage() { #if defined(DAWN_DISABLE_LOGGING) +LogMessage::~LogMessage() { // Don't print logs to make fuzzing more efficient. Implemented as // an early return to avoid warnings about unused member variables. return; -#endif +} +#else // defined(DAWN_DISABLE_LOGGING) +LogMessage::~LogMessage() { std::string fullMessage = mStream.str(); // If this message has been moved, its stream is empty. @@ -99,6 +101,7 @@ LogMessage::~LogMessage() { fflush(outputStream); #endif // DAWN_PLATFORM_IS(ANDROID) } +#endif // defined(DAWN_DISABLE_LOGGING) LogMessage DebugLog() { return LogMessage(LogSeverity::Debug);