-
Notifications
You must be signed in to change notification settings - Fork 2.1k
drivers/include: fixing order of doxygen tags and header guards #21325
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.h
258c517
to
d357f53
Compare
Force pushed a new commit and updated the python script. @mguetschow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot! I'd rather have a second high-level ACK from another maintainer though.
Contribution description
This PR only covers the headers in drivers.
Clang-format requires the header guard
#ifndef #define HEADER_GUARD_H
to 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
#endif
directive 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.