8000 drivers/include: fixing order of doxygen tags and header guards by KSKNico · Pull Request #21325 · RIOT-OS/RIOT · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

8000
Merged
merged 1 commit into from
Mar 28, 2025

Conversation

KSKNico
Copy link
Contributor
@KSKNico KSKNico commented Mar 25, 2025

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.

@github-actions github-actions bot added Area: drivers Area: Device drivers Area: LoRa Area: LoRa radio support Area: SAUL Area: Sensor/Actuator Uber Layer labels Mar 25, 2025
Copy link
Contributor
@mguetschow mguetschow left a 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

@mguetschow mguetschow added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 25, 2025
@riot-ci
Copy link
riot-ci commented Mar 25, 2025

Murdock results

✔️ PASSED

d357f53 drivers/include: applied the script to the driver headers

Success Failures Total Runtime
1 0 1 01m:50s

Artifacts

@KSKNico KSKNico force-pushed the clang-format-header-fix branch from 258c517 to d357f53 Compare March 28, 2025 16:10
@KSKNico
Copy link
Contributor Author
KSKNico commented Mar 28, 2025

Force pushed a new commit and updated the python script. @mguetschow

@mguetschow mguetschow marked this pull request as ready for review March 28, 2025 16:28
Copy link
Contributor
@mguetschow mguetschow left a 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.

@maribu maribu added this pull request to the merge queue Mar 28, 2025
Merged via the queue into RIOT-OS:master with commit 48162bd Mar 28, 2025
27 checks passed
@KSKNico KSKNico changed the title treewide: fixing order of doxygen tags and header guards drivers: fixing order of doxygen tags and header guards Mar 28, 2025
@KSKNico KSKNico changed the title drivers: fixing order of doxygen tags and header guards drivers/include: fixing order of doxygen tags and header guards Mar 31, 2025
@mguetschow mguetschow added this to the Release 2025.04 milestone Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Area: LoRa Area: LoRa radio support Area: SAUL Area: Sensor/Actuator Uber Layer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0