From d99e53cc0175996d488b2941d71a95999cadb3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 8 May 2024 09:38:57 +0200 Subject: [PATCH 1/2] src: avoid unused variable 'error' warning The variable is only used in DEBUG mode. Define it only in that case. --- src/debug_utils.cc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/debug_utils.cc b/src/debug_utils.cc index 82e6587016ed3a..b742b0df4d9c17 100644 --- a/src/debug_utils.cc +++ b/src/debug_utils.cc @@ -182,10 +182,13 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext { return NameAndDisplacement(pSymbol->Name, dwDisplacement); } else { // SymFromAddr failed - const DWORD error = GetLastError(); // "eat" the error anyway #ifdef DEBUG + const DWORD error = GetLastError(); fprintf(stderr, "SymFromAddr returned error : %lu\n", error); -#endif +#else + // "eat" the error anyway + USE(GetLastError()); +#endif // DEBUG } // End MSDN code @@ -217,10 +220,13 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext { sym.line = line.LineNumber; } else { // SymGetLineFromAddr64 failed - const DWORD error = GetLastError(); // "eat" the error anyway #ifdef DEBUG + const DWORD error = GetLastError(); fprintf(stderr, "SymGetLineFromAddr64 returned error : %lu\n", error); -#endif +#else + // "eat" the error anyway + USE(GetLastError()); +#endif // DEBUG } // End MSDN code @@ -240,10 +246,13 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext { return szUndName; } else { // UnDecorateSymbolName failed - const DWORD error = GetLastError(); // "eat" the error anyway #ifdef DEBUG + const DWORD error = GetLastError(); fprintf(stderr, "UnDecorateSymbolName returned error %lu\n", error); -#endif +#else + // "eat" the error anyway + USE(GetLastError()); +#endif // DEBUG } return nullptr; } From f32fb3627e578dde674ad046ab472c84b7951cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 8 May 2024 13:23:29 +0200 Subject: [PATCH 2/2] fixup --- src/debug_utils.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debug_utils.cc b/src/debug_utils.cc index b742b0df4d9c17..9d36082db672ce 100644 --- a/src/debug_utils.cc +++ b/src/debug_utils.cc @@ -186,7 +186,7 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext { const DWORD error = GetLastError(); fprintf(stderr, "SymFromAddr returned error : %lu\n", error); #else - // "eat" the error anyway + // Consume the error anyway USE(GetLastError()); #endif // DEBUG } @@ -224,7 +224,7 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext { const DWORD error = GetLastError(); fprintf(stderr, "SymGetLineFromAddr64 returned error : %lu\n", error); #else - // "eat" the error anyway + // Consume the error anyway USE(GetLastError()); #endif // DEBUG } @@ -250,7 +250,7 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext { const DWORD error = GetLastError(); fprintf(stderr, "UnDecorateSymbolName returned error %lu\n", error); #else - // "eat" the error anyway + // Consume the error anyway USE(GetLastError()); #endif // DEBUG }