[SERVER-66202] MONGO_LOGV2_DEFAULT_COMPONENT conventions lint check Created: 03/May/22 Updated: 29/Oct/23 Resolved: 06/May/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.0-rc0 |
| 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 | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Sprint: | Service Arch 2022-05-16 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
Enforce that MONGO_LOGV2_DEFAULT_COMPONENT definitions are hermetic, and affect only the file in which the definition appears. If a file defines the macro, it must undefine it before handing control to another file. 1) Headers that define it must undefine it. 2) It must not have a definition when an include is performed. This usually means the definition must be below the customary `#include` blocks. A sweep of the codebase described in |
| Comments |
| Comment by Billy Donahue [ 06/May/22 ] |
|
I only implemented rule #1 from the description. Headers that define it must undefine it. I think maybe violations of rule #2 are less harmful and it's harder to implement with Python+RE than #1. The risk it would allow is for #defines to appear after #includes in new files if we don't check against it. But my feeling is that after a little while, people will stop trying to do this, as it's an unusual thing to do in C++, and all other source files are setting a good example. If any find their way in, we can manually fix very easily. It shouldn't take more than 1 more round, perhaps a month or two down the road? |
| Comment by Githook User [ 06/May/22 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |