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

updates to checkpatch and clang-format configuration #23823

Merged
merged 3 commits into from
May 2, 2020

Conversation

pabigot
Copy link
Collaborator

@pabigot pabigot commented Mar 26, 2020

Basic cleanup preparatory to addressing #21392 (comment), specifically to update checkpatch to be closer to current Linux, and verifying .clang-format is consistent with Zephyr needs.

FWIW, our .clang-format and LInux differ only in the ForEachMacros list. clang-format transforms those to add a space after the macro name, which gets diagnosed as a style error by checkpatch. The Linux clang-format also makes changes that are rejected by Linux checkpatch (ForEachMacros and other whitespace diagnostics). So it's not clear that clang-format is actually used by Linux.

@pabigot pabigot requested a review from nashif March 26, 2020 17:10
@zephyrbot
Copy link
Collaborator

zephyrbot commented Mar 26, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

pabigot added 3 commits March 26, 2020 14:10
This takes the linux diffs between
a8c964eacb21288b2dbfa9d80cee5968a3b8fb21 and
16fbf79b0f83bc752cee8589279f1ebfe57b3b6e and applies them to the
Zephyr copy.  Three changes did not apply cleanly:

* linux added a comment to the line that enables C99 comments;
  Zephyr disallows them.
* linux uses vendor-prefixes.yaml; zephyr uses the older .txt file
* manual addition of colon in a check before BRACKET_SPACE error

Signed-off-by: Peter Bigot <[email protected]>
Linux uses for_each in macros that produce loops; Zephyr uses
FOR_EACH.  Update the corresponding checks to match Zephyr's spelling.

Signed-off-by: Peter Bigot <[email protected]>
Correct the shell fragment to use the spelling Zephyr uses, and re-run
it to update the list.

Signed-off-by: Peter Bigot <[email protected]>
@chrta
Copy link
Collaborator

chrta commented Mar 27, 2020

@pabigot What version of clang-format should be used? I am asking because of lines like this:

#FixNamespaceComments: false # Unknown to clang-format-4.0

@pabigot
Copy link
Collaborator Author

pabigot commented Mar 27, 2020

@chrta I have no idea. Those lines are unchanged from the current Linux configuration. It appears 11 is latest; my OS distribution gave me 9.

Since it doesn't seem like Linux actually uses this (since it creates code that doesn't pass checkpatch) I don't think it's useful, and I'm not planning to try to create a configuration that matches Zephyr style, but since it's already in tree it seemed worth getting it updated.

@nashif nashif merged commit 1ec9d2a into zephyrproject-rtos:master May 2, 2020
@stephanosio
Copy link
Member

stephanosio commented May 4, 2020

This patch introduced a SPDX license identifier-related noise, unless we are now enforcing Linux-style license identifier placement (i.e. in the first line):

-:22: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#22: FILE: drivers/interrupt_controller/intc_gicv3.c:1:
+/*

-:25: WARNING:SPDX_LICENSE_TAG: Misplaced SPDX-License-Identifier tag - use line 1 instead
#25: FILE: drivers/interrupt_controller/intc_gicv3.c:4:
+ * SPDX-License-Identifier: Apache-2.0

ADD: #24921 provides a fix.
Fix #24930 merged

@pabigot pabigot deleted the nordic/20200326a branch May 4, 2020 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants