Fix variable initialization due to jump bypassing it#23051
Fix variable initialization due to jump bypassing it#23051anntzer merged 1 commit intomatplotlib:mainfrom Biswa96:fix-error-mingw
Conversation
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;
| ^~~~~
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...
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
|
Thank you! This fix is also included in #22999 [edit correct PR number] |
|
Should I close this? |
|
Given that #22999 is failing with error message "command did not succeed", it might be a while before that goes in. |
QuLogic
left a comment
There was a problem hiding this comment.
I'm not sure there's actually a problem here, but if it fixes a warning, then LGTM.
|
Thanks for the fix, hoping to see you around again. |
|
@meeseeksbot please backport to v3.5.x |
|
meeseeksdev backport to v3.5.x |
|
thank you @QuLogic . |
…051-on-v3.5.x Backport PR #23051 on branch v3.5.x (Fix variable initialization due to jump bypassing it)
PR Summary
This fixes the following error in mingw gcc toolchain. Also clang
also have same error.
According to C++ standard (6.7.3):
PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).