Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c40a827

Browse filesBrowse files
committed
src: avoid unused variable 'error' warning
The variable is only used in DEBUG mode. Define it only in that case. PR-URL: #52886 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 8ce23dc commit c40a827
Copy full SHA for c40a827

File tree

Expand file treeCollapse file tree

1 file changed

+15
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-6
lines changed
Open diff view settings
Collapse file

‎src/debug_utils.cc‎

Copy file name to clipboardExpand all lines: src/debug_utils.cc
+15-6Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,13 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext {
182182
return NameAndDisplacement(pSymbol->Name, dwDisplacement);
183183
} else {
184184
// SymFromAddr failed
185-
const DWORD error = GetLastError(); // "eat" the error anyway
186185
#ifdef DEBUG
186+
const DWORD error = GetLastError();
187187
fprintf(stderr, "SymFromAddr returned error : %lu\n", error);
188-
#endif
188+
#else
189+
// Consume the error anyway
190+
USE(GetLastError());
191+
#endif // DEBUG
189192
}
190193
// End MSDN code
191194

@@ -217,10 +220,13 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext {
217220
sym.line = line.LineNumber;
218221
} else {
219222
// SymGetLineFromAddr64 failed
220-
const DWORD error = GetLastError(); // "eat" the error anyway
221223
#ifdef DEBUG
224+
const DWORD error = GetLastError();
222225
fprintf(stderr, "SymGetLineFromAddr64 returned error : %lu\n", error);
223-
#endif
226+
#else
227+
// Consume the error anyway
228+
USE(GetLastError());
229+
#endif // DEBUG
224230
}
225231
// End MSDN code
226232

@@ -240,10 +246,13 @@ class Win32SymbolDebuggingContext final : public NativeSymbolDebuggingContext {
240246
return szUndName;
241247
} else {
242248
// UnDecorateSymbolName failed
243-
const DWORD error = GetLastError(); // "eat" the error anyway
244249
#ifdef DEBUG
250+
const DWORD error = GetLastError();
245251
fprintf(stderr, "UnDecorateSymbolName returned error %lu\n", error);
246-
#endif
252+
#else
253+
// Consume the error anyway
254+
USE(GetLastError());
255+
#endif // DEBUG
247256
}
248257
return nullptr;
249258
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.