-
Notifications
You must be signed in to change notification settings - Fork 7.4k
WIP: update clang-format for Zephyr #27058
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
git-clang-format is intended to support checking conformance of changes. I'll be evaluating this over the next couple months. |
Do you know if there is ubuntu package or pre-built binary for the clang-format v12? |
Probably not, since 12 is the next release of the entire system. I did something like the following.
|
d3b4c00
to
9dfd9bb
Compare
A large number of options are disabled because they are marked as unknown to older versions of clang-format. We're going to need clang-format-12 to meet the style guide, so enable them. Signed-off-by: Peter Bigot <[email protected]>
NamespaceIndentation has been removed upstream as it impedes readability, and only one built-in style (WebKit) selects it. Signed-off-by: Peter Bigot <[email protected]>
Identified FOR_EACH macros are an exception to the requirement that there be a space between a control keyword and its parenthesized control expressions. Signed-off-by: Peter Bigot <[email protected]>
More have been added. Signed-off-by: Peter A. Bigot <[email protected]>
9dfd9bb
to
45fc68e
Compare
It is available in the llvm apt repo now, e.g. for focal via Edit: I commited the changes after running clang-format-12 on the current master, see lemonbeat@0d578b6 |
Unchanged file from zephyrproject-rtos#27058 rebased on current master find . -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format-12 -style=file -i
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
I have no plans to do more with this, so whoever wants to take it on is free to do so. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
The goal of #21392 to be able to reduce arguments about style by establishing a baseline policy: if the file content is left unmodified by clang-format, the style is acceptable. Released versions of clang-format lack a configuration option required by Zephyr's style.
clang-format-12 (expected for release this fall) eliminates this gap by adding an option for
SpaceBeforeParens
that does not introduce a space inFOR_EACH
control macro expressions like:This branch updates the in-tree
.clang-format
, which tracks the Linux one, to:SpaceBeforeParens: ControlStatementsExceptForEachMacros
If you are interested in evaluating clang-format as an alternative to uncrustify please try the version in this branch, and propose changes to the configuration, so when clang-12 is released we're able to make progress on #21392.