8000 Fix variable initialization due to jump bypassing it · matplotlib/matplotlib@c321d80 · GitHub
[go: up one dir, main page]

Skip to content

Commit c321d80

Browse files
committed
Fix variable initialization due to jump bypassing it
This fixes the following error in mingw gcc toolchain. Also clang also have same error. src/_tkagg.cpp:274:26: note: crosses initialization of 'bool tk_ok' 274 | bool tcl_ok = false, tk_ok = false; 8000 | ^~~~~ src/_tkagg.cpp:274:10: note: crosses initialization of 'bool tcl_ok' 274 | bool tcl_ok = false, tk_ok = false; | ^~~~~~ According to C++ standard (6.7.3): It is possible to transfer into a block, but not in a way that bypasses declarations with initialization. A program that jumps from a point where a variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has scalar type...
1 parent 3699ff3 commit c321d80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/_tkagg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ void load_tkinter_funcs(void)
259259
HANDLE process = GetCurrentProcess(); // Pseudo-handle, doesn't need closing.
260260
HMODULE* modules = NULL;
261261
DWORD size;
262+
bool tcl_ok = false, tk_ok = false;
262263
if (!EnumProcessModules(process, NULL, 0, &size)) {
263264
PyErr_SetFromWindowsErr(0);
264265
goto exit;
@@ -271,7 +272,6 @@ void load_tkinter_funcs(void)
271272
PyErr_SetFromWindowsErr(0);
272273
goto exit;
273274
}
274-
bool tcl_ok = false, tk_ok = false;
275275
for (unsigned i = 0; i < size / sizeof(HMODULE); ++i) {
276276
if (!tcl_ok) {
277277
tcl_ok = load_tcl(modules[i]);

0 commit comments

Comments
 (0)
0