Page MenuHome

Fix variable shadow warnings
Needs ReviewPublic

Authored by Jacques Lucke (JacquesLucke) on Jul 8 2021, 5:36 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

I went over P2228 in D11788 and fixed many of the warnings (without looking at how the code could be cleaned up further).
I did not change stuff in extern/.

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Jul 8 2021, 5:36 PM
Jacques Lucke (JacquesLucke) created this revision.

Can't say like the look of this, it is quite the eyesore with the underscores, @Campbell Barton (campbellbarton) thoughts?

While I would like to see the shadow warn on for all platforms so we can write higher quality code, this diff feels like a step in the opposite direction

Personally I'd think the best way forward here would be:

  1. See if we can get msvc/gcc/clang to agree on what gets flagged and what doesn't
  2. See if we can get it to ignore /extern
  3. Add a temporary CMake Flag to enable the excessive warnings about shadows, off by default
  4. Implement proper fixes our selves or work with the community to get patches (this is all pretty low hanging fruit, great way for a new dev to get started)
  5. Once all issues are fixed, remove cmake option, enable the warnings by default

Unless we figure out 1+2 the rest is irrelevant though...

I'm fine with going over the patch again to actually clean up the changes. In this first pass I just wanted to find most cases and fix the warning. Didn't feel like doing the second pass day though.

Even though I don't like the prefix underscore either, I actually find it less confusing than duplicate variable names.

(Wouldn't mind if someone from the community does the rest of the cleanup of course.)