From c40a8273ef24b9fee066c60ef119fd2cd73a668f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 10 May 2024 09:50:20 +0200 Subject: [PATCH] src: avoid unused variable 'error' warning The variable is only used in DEBUG mode. Define it only in that case. PR-URL: https://github.com/nodejs/node/pull/52886 Reviewed-By: Moshe Atlow Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Benjamin Gruenbaum --- 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..9d36082db672ce 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 + // Consume 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 + // Consume 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 + // Consume the error anyway + USE(GetLastError()); +#endif // DEBUG } return nullptr; }