[SERVER-43010] remove DEV and MONGO_DEV `if`-macros Created: 23/Aug/19 Updated: 29/Oct/23 Resolved: 23/Aug/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 4.3.1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Dev Tools 2019-08-26 |
| Participants: |
| Description |
|
These macros read like statement attributes but are really flow control. They have the potential to "falsely" bind to following else statements, and clang-format can't see through it. The hidden if condition can't combine with other conditions using && and ||, so it ends up in some cases making code a little worse. `DEV` is too broad a namespace. Indeed we touch third-party source using it as an enum value. It could be confused with "DEVice". It isn't clear that DEVelopment build maps 1:1 to a "debug" build. Meaning is unclear. As an alternative, we can inline it where it appears, writing `if (kDebugBuild)` and we will have more conventional code. The sugar of the DEV macro isn't valuable enough to justify its risks. `mongo::kDebugBuild` is a conventional constexpr bool variable. |
| Comments |
| Comment by Githook User [ 23/Aug/19 ] |
|
Author: {'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}Message: |
| Comment by Githook User [ 23/Aug/19 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |
| Comment by Billy Donahue [ 23/Aug/19 ] |
| Comment by Andrew Morrow (Inactive) [ 23/Aug/19 ] |
|
Yeah, these macros have never carried their weight, in my opinion. It looks like there are less than 40 of them, so it should be a trivial fixup? |