-
Notifications
You must be signed in to change notification settings - Fork 238
Fix -Wshadow warnings
#1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix -Wshadow warnings
#1433
Conversation
| HYPRE_MEMORY_HOST); | ||
| } | ||
|
|
||
| HYPRE_Int i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to stay in, but with a new name like li. It's inside an outer loop that is already using i. In general, this simple renaming approach is the most reliable way to make these changes. I'll try to look for other potential issues like this, but you might want to take a second look as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching! This one was a real bug! Fixed
| } | ||
| if (grid_relax_type) | ||
| { | ||
| HYPRE_Int num_levels = hypre_ParAMGDataNumLevels(amg_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one might need to stay in as well. I would have to look at the logic here to be sure, but num_levels is initialized at the top of the routine so it's value may be needed outside of this if section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked this one and the current change is fine. We're in the destructor, so num_levels cannot change in that function. We can rely on the value initialized at the beginning
|
Hi @victorapm . I will wait until you take another look through your changes before looking through this some more. We want to be careful not to potentially change the behavior of the code. It is a good idea to test for this stuff, though. Thanks! |
Cleans the code for the build:
cmake -B build -S src -DCMAKE_C_FLAGS=-WshadowResolving
-Wshadowwarnings is important to: