drivers/include: fixing order of doxygen tags and header guards#21325
Merged
maribu merged 1 commit intoRIOT-OS:masterfrom Mar 28, 2025
Merged
drivers/include: fixing order of doxygen tags and header guards#21325maribu merged 1 commit intoRIOT-OS:masterfrom
maribu merged 1 commit intoRIOT-OS:masterfrom
Conversation
mguetschow
requested changes
Mar 25, 2025
Contributor
mguetschow
left a comment
There was a problem hiding this comment.
Found one problem while skimming over it. Also confirmed with
$ git diff --numstat HEAD~1 | grep -v 4 | grep -v 3
10 10 drivers/include/lm75.h258c517 to
d357f53
Compare
Contributor
Author
|
Force pushed a new commit and updated the python script. @mguetschow |
mguetschow
approved these changes
Mar 28, 2025
Contributor
mguetschow
left a comment
There was a problem hiding this comment.
LGTM, thanks a lot! I'd rather have a second high-level ACK from another maintainer though.
maribu
approved these changes
Mar 28, 2025
8 tasks
This was referenced May 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR only covers the headers in drivers.
Clang-format requires the header guard
#ifndef #define HEADER_GUARD_Hto be outside of the doxygen documentation, that means outside the@{ ... @}block. If this is not done, then clang-format will indent all preprocessor directives after the#ifndef.The problem is that the majority of RIOT's header files don't adhere to this order. They either have the header guard inside the doxygen block or the header guard starts correctly outside the doxygen block but the
#endifdirective is still inside the doxygen documentation.To fix this inconsistency, I have written a python script that recursively scans all header files in a directory and rearranges the parts, so that the correct order is established.
The fix was only applied to the headers in
drivers/include/, it can easily be applied to other parts of the code base.Testing procedure
Use my python script and change the path variable 'RIOT_PATH' in the script to whatever directory you want to recursively fix the header files.
The script can be found here
Issues/PRs references
This is based on the fix in #20905 addressed by @mguetschow but with the added benefit of keeping the blocks balanced.