From cff6fb97afe497647749ae6e9d82e010b0138089 Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Thu, 10 Feb 2022 12:49:41 -0800 Subject: [PATCH] Fix "expression result unused" warning This macro was expecting that parenthesis used in the macro would be removed during macro expansion, when they are not removed. The result was a function call like this: ```cpp AZ_Assert(g_SymGetSearchPath != 0, ("Can not load %s function!","SymGetSearchPath")); ``` The parenthesis cause the contents of the parenthsis to be evaluated first, and the result is an expression using the comma operator. The comma operator evaluates the left expression, discards the result, then evaluates the right expression, and returns that. So the above dropping the message, and just leaving: ```cpp AZ_Assert(g_SymGetSearchPath != 0, "SymGetSearchPath"); ``` Signed-off-by: Chris Burel --- .../Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp index 90362a3ce8..688db347da 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp @@ -140,7 +140,7 @@ namespace AZ { SymRegisterCallback64_t g_SymRegisterCallback64; HMODULE g_dbgHelpDll; -#define LOAD_FUNCTION(A) { g_##A = (A##_t)GetProcAddress(g_dbgHelpDll, #A); AZ_Assert(g_##A != 0, ("Can not load %s function!",#A)); } +#define LOAD_FUNCTION(A) { g_##A = (A##_t)GetProcAddress(g_dbgHelpDll, #A); AZ_Assert(g_##A != 0, "Can not load %s function!",#A); } using namespace AZ::Debug;