-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Include guard rules (if mandated) should be documented and handled by software #80781
Comments
Just fyi, I found this old PR #9990 (comment) that points to this document about naming the guards https://google.github.io/styleguide/cppguide.html#The__define_Guard |
Right, but the full comment on the link:
Which, even with that said, isn't what happens: many times the include guard is of the form
Which hasn't happened, and is the reason I've raised this ticket. |
And sometimes we end up with no include guards at all (see #81196) . |
Related to #83117 |
Process WG on 2024-12-11 decided this didn't need discussion by the Process WG. Please submit a specific proposal with language you would like added to the coding guidelines. |
Is your enhancement proposal related to a problem? Please describe.
At review-time, a disproportionate amount of time is spent by contributors and reviewers discussing include guards. There are a number of problems with this:
The guidelines defer to the Linux kernel coding style, which does not define or enforce the style. Contributors can't know this expectation in advance of doing their work. This is a problem because it is demotivating for Contributors, and a problem for the project because it slows development down.
This in itself would not be a problem if (1) was in effect, but there's also no way for a Contributor to look at prior-art and determine what they've done is wrong.
Describe the solution you'd like
Perhaps the easiest solution. Unless there's a technical reason that the Contributor's choice of include guard is a problem, leave it alone.
Allow Contributors to know what they're expected to do before they invest their own time and effort in the codebase. They may decide, based on this, whether they want to contribute at all.
Contributors may not be willing or able to run the client-side hooks, so check this.
Are existing files going to remain incosistent, or will they be fixed in a treewide tidy up, or as-and-when they are touched?
Describe alternatives you've considered
Continue the status-quo, (existing codebase remains inconsistent, add-hoc review-time requests to change files occur).
Additional context
A good example of the self-inconsistent codebase can be seen in a single directory:
which presents ~8 different conventions.
The text was updated successfully, but these errors were encountered: