RIOT
RIOT copied to clipboard
CODING_CONVENTIONS.md: Add IWYU policy
Contribution description
This makes an implicit agreement that code should include the headers is uses, no more and no less, explicit.
It also recommends using tooling (such as clangd) and adding IWUY pragma comments to aid those tools in common cases they otherwise would provide false positives.
Testing procedure
Read the changed coding conventions and confirm that this is what we want to do.
Issues/PRs references
None
Murdock results
:heavy_check_mark: PASSED
e13ceeb765cdb42eb0cec9c3234386d2ff9d465e Update CODING_CONVENTIONS.md
| Success | Failures | Total | Runtime |
|---|---|---|---|
| 1 | 0 | 1 | 01m:00s |
Artifacts
Having that done is in no way a precondition to adopting this convention, but relevant to whether we can uphold the convention: Is it realistic to have this enforced by CI? (Otherwise I fear it will be a frequently missed point in both PRs and reviews).
I think this is only relevant for hardware abstraction APIs, e.g. periph drivers and IRQ APIs. So I don't really expect new offenders to merged at a rate faster than I can fix.
I don't think that adding the pragmas can be enforcement. But having the code IWYU clean could be enforced by the CI, which would indirectly enforce suppression of false positives. But getting there will be more work than a few minutes of spare in-betweeen on a Sunday afternoon...
I might tackle that in a few months. Sounds like a sensible thing to aim for.