Skip to content

Commit

Permalink
src: avoid unused variable 'error' warning
Browse files Browse the repository at this point in the history
The variable is only used in DEBUG mode. Define it only in that case.

PR-URL: #52886
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
targos authored and marco-ippolito committed Jun 17, 2024
1 parent 1ff8f31 commit 2dcbf18
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/debug_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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;
}
Expand Down

0 comments on commit 2dcbf18

Please sign in to comment.