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
Fix shadowing warning #12960
Fix shadowing warning #12960
Conversation
Do need import this flag? I personally like the style |
Do we really export any warnings flags if |
I also like it but for the constructor but there are still many places where there is a real shadowing. Sometimes we declare the same variables multiple times in the same function with different scopes and we often uses the same name for an input parameter and a member variable and that's a lot more confusing. |
No we don't. I am so used to turn it on that I didn't pay attention. I guess we don't need this PR but it is still useful. I found a bug in
and there was another place in |
I would be in favor of adding a less restrictive version. I would think that |
Also, it seems that |
With
which we do. |
But you get a warning with |
For the real bugs you found, would you be willing to extract that part of the patch at least and submit separately? I don't have a strong feeling one way or the other about the rest, but the bugs you found we should fix :-) |
@bangerth Yes, of course. That was my plan :) |
With #12940, we correctly import Kokkos flags including
-Wshadow
. We have a lot of these warnings and this PR fixes some of them. The majority of the shadowing happens in constructors with code likebut I also found a few places where we declare and recompute the same variable several times. Given the extremely large number of warnings I didn't try to be clever when changing the name of the variable. If the shadowing happens in the constructor, I added an
_
in the name of the variable. If the shadowing happens in another function then I tried to find a good name for the new variable.