Skip to content
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

.clang-format: Add default clang-format configuration #20865

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maribu
Copy link
Member

@maribu maribu commented Sep 17, 2024

Contribution description

This adds a clang-format configuration based on the Linux Kernel configuration and modified to better match RIOT's coding convention.

Testing procedure

Automatic formatting using clang-format should now match RIOT's coding convention relatively closely. Aligning bitmasks is still a pain point, though. I think this is not yet possible to configure, but something that we don't have too often. E.g. the following would still not work

/* good */
   FOO_REG = FOO_REG_VAL1
           | FOO_REG_VAL2
           | FOO_REG_VAL3;

/* bad (but sadly currently generated by clang-format) */
   FOO_REG = FOO_REG_VAL1 |
       FOO_REG_VAL2 | FOO_REG_VAL3;

Issues/PRs references

None

This adds a clang-format configuration based on the Linux Kernel
configuration and modified to better match RIOT's coding convention.
@maribu maribu added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: tools Area: Supplementary tools labels Sep 17, 2024
@github-actions github-actions bot removed the Area: tools Area: Supplementary tools label Sep 17, 2024
@maribu
Copy link
Member Author

maribu commented Sep 17, 2024

Would be interesting to know whether this would result (except for bitmasks) in correctly formatted code when using VS code.

@riot-ci
Copy link

riot-ci commented Sep 17, 2024

Murdock results

✔️ PASSED

325c3a4 fixup! .clang-format: Add default clang-format configuration

Success Failures Total Runtime
10197 0 10197 17m:30s

Artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants