Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
src: avoid unused variable 'error' warning
The variable is only used in DEBUG mode. Define it only in that case.
  • Loading branch information
targos committed May 8, 2024
commit d99e53cc0175996d488b2941d71a95999cadb3d1
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
// "eat" the error anyway
Comment thread
targos marked this conversation as resolved.
Outdated
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
// "eat" 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
// "eat" the error anyway
USE(GetLastError());
#endif // DEBUG
}
return nullptr;
}
Expand Down