summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLéo Lam <leolino.lam@gmail.com>2018-04-16 20:38:22 +0200
committerGitHub <noreply@github.com>2018-04-16 20:38:22 +0200
commitdfd6a228a69021ca88daaee2de457871f77f8c77 (patch)
tree84b80da36c2c5e4ae30ff5d5a2d8c0894e21c72e /Source
parentd13fc1d2e9f71888b117bc9e4fee7acf885feb18 (diff)
parentb0dc823472dcc159c2020bab088dd2c891b36375 (diff)
Merge pull request #6654 from lioncash/log
Common/Logging/Log: Wrap GENERIC_LOG macro's body in do { } while (0)
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/Logging/Log.h13
-rw-r--r--Source/Core/VideoBackends/Vulkan/VulkanContext.cpp8
2 files changed, 11 insertions, 10 deletions
diff --git a/Source/Core/Common/Logging/Log.h b/Source/Core/Common/Logging/Log.h
index c2dd70937e..7e7b295a52 100644
--- a/Source/Core/Common/Logging/Log.h
+++ b/Source/Core/Common/Logging/Log.h
@@ -91,33 +91,34 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char*
// Let the compiler optimize this out
#define GENERIC_LOG(t, v, ...) \
+ do \
{ \
if (v <= MAX_LOGLEVEL) \
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
- }
+ } while (0)
#define ERROR_LOG(t, ...) \
do \
{ \
- GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) \
+ GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__); \
} while (0)
#define WARN_LOG(t, ...) \
do \
{ \
- GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) \
+ GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__); \
} while (0)
#define NOTICE_LOG(t, ...) \
do \
{ \
- GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) \
+ GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__); \
} while (0)
#define INFO_LOG(t, ...) \
do \
{ \
- GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) \
+ GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__); \
} while (0)
#define DEBUG_LOG(t, ...) \
do \
{ \
- GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) \
+ GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__); \
} while (0)
diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
index 9a96aa9e2e..57bdcdfce9 100644
--- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
@@ -616,13 +616,13 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT
std::string log_message =
StringFromFormat("Vulkan debug report: (%s) %s", pLayerPrefix ? pLayerPrefix : "", pMessage);
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
- GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LERROR, "%s", log_message.c_str())
+ GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LERROR, "%s", log_message.c_str());
else if (flags & (VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT))
- GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LWARNING, "%s", log_message.c_str())
+ GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LWARNING, "%s", log_message.c_str());
else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT)
- GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LINFO, "%s", log_message.c_str())
+ GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LINFO, "%s", log_message.c_str());
else
- GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LDEBUG, "%s", log_message.c_str())
+ GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LDEBUG, "%s", log_message.c_str());
return VK_FALSE;
}