[SERVER-29601] Add -Wshadow to compilation Created: 13/Jun/17 Updated: 02/Feb/24 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Eric Milkie | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Build
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Sprint: | Platforms 2017-07-10 | ||||
| Participants: | |||||
| Description |
|
-Wshadow is supported by both Clang and GCC, and seems like a reasonable warning to add. AFAIK there are only a few violations of this warning today – which should be easily fixable. This could be done as part of a larger effort to evaluate newly added warnings to recent versions of clang/gcc. |
| Comments |
| Comment by Githook User [ 11/Nov/22 ] |
|
Author: {'name': 'Juan Gu', 'email': 'juan.gu@mongodb.com', 'username': 'juangugit'}Message: SERVER-29601 Add -Wshadow to compilation - part1 |
| Comment by Andrew Morrow (Inactive) [ 05/May/21 ] |
|
It sounds like a perfect type of thing for a fixit day. Find all the instances somehow, make a spreadsheet, get 20 volunteers, everyone fixes 15. Done. |
| Comment by Billy Donahue [ 05/May/21 ] |
|
|
| Comment by Andrew Morrow (Inactive) [ 04/Nov/19 ] |
|
I'm adding this to the "coding style enforcement" epic because I think the way to approach this is to use clang-tidy and a fixit to address the existing shadowing issues, which would then allow us to turn on the flag. |
| Comment by Eric Milkie [ 12/Apr/19 ] |
|
Rather than making separate SERVER tickets for each of the shadow problems in our code that Coverity is flagging, I'm going to mark all of them "ignore" for now, so that we can see the more critical problems in the Coverity report. If in the future we decide we want to add this warning, we can revisit the list that Coverity has flagged. |
| Comment by Eric Milkie [ 04/Oct/17 ] |
|
A recommended list for other warnings we might consider turning on: |
| Comment by Ben Shteinfeld [ 22/Jun/17 ] |
|
There 293 violations of the `-Wshadow` compile flag in the codebase. Of these 18 are in src/third_party, the rest are in src/mongo. Per discussion with spencer.jackson and mira.carey@mongodb.com, these violations should have a suffix added to them using rtags. |