With the current clang-format rules, we have that multi-line macros that
contain empty lines (usual in driver definition macros) are formatted
with spaces only, no leading tabs. For example:
```c
#define MYDRIVER_DEFINE(i) \
struct mydriver_data data##i; \
\ /* starts with spaces */
struct mydriver_config config##i; \
...
```
This patch makes checkpatch ignore such cases, so that clang-format can
be used in tree while keeping checkpatch happy.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Some macros, e.g., FOR_EACH_FIXED_ARG, require a separator argument that
needs to be in parentheses, e.g., (||). This should not trigger a
checkpatch warning.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Checkpatch was checking for macro concats (##), however
we often use UTIL_CAT to allow for multiple macro expansion passes
to succeed.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
checkpatch requires a Makefile to be present at the top-level directory.
Remove this requirement.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This squashes and applies the Linux diffs to scripts/checkpatch.pl
between Linux commit 16fbf79b0f83bc75 ("Linux 5.6-rc7") and
9123e3a74ec7b93 ("Linux 5.9-rc1") except for commits identified below.
The last 1000 commits to Zephyr master were compared for checkpatch
output differences between the previous Zephyr version and this
version. One new diagnostic about function declarations with an empty
parameter-list was introduced (FUNCTION_WITHOUT_ARGS). The text of an
existing diagnostic was changed (DT_SPLIT_BINDING_PATCH). The text of
LONG_LINE diagnostics was enhanced to provide the actual line length.
Linux commit dfa05c28ca7ffc0a ("checkpatch: remove email address
comment from email address comparisons") was removed because
differences in the scripts resulted in false signed-off-by check
diagnostics when a full name included characters not in Basic Latin,
due to changes in how the author name was extracted. Earlier upstream
changes not integrated into Zephyr may be required.
Linux commit b95692f8b3000166 ("checkpatch: prefer fallthrough; over
fallthrough comments") was removed because Zephyr doesn't support the
upstream pseudo keyword.
Linux commit bdc48fa11e46f867 ("checkpatch/coding-style: deprecate
80-column warning") was edited to not actually change the 80-column
maximum line limit as this change has not been mooted for Zephyr.
Linux commit ced69da1db0b57bb ("checkpatch: fix CONST_STRUCT when
const_structs.checkpatch is missing") was edited to the CONST_STRUCT
file as that's not supported in Zephyr.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Now that we are standardizing C99 integer types we can revert the commit
that warned about C99 type usage.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit reverts the device tree binding vendor prefix check regular
expression change that was introduced by the following commit:
5b10fac97e
The changed regular expression fails to detect the correctly specified
vendor prefixes in the `vendor-prefixes.txt`.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
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 <peter.bigot@nordicsemi.no>
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 <peter.bigot@nordicsemi.no>
There is no code to handle __syscall_inline so it is better removing
it from doxygen and checkpatch.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
import linux-v5.1:Documentation/devicetree/bindings/vendor-prefixes.txt
Use vendor-prefixes.txt to check vendor prefixes
used in compatible strings and property names.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
This was never a long-term solution, more of a gross hack
to get test cases working until we could figure out a good
end-to-end solution for memory domains that generated
appropriate linker sections. Now that we have this with
the app shared memory feature, and have converted all tests
to remove it, delete this feature.
To date all userspace APIs have been tagged as 'experimental'
which sidesteps deprecation policies.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This is generating lots of false positives and we keep overriding them
manually, so downgrade and mark it as a warning.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This is pulled from commit a8c964eacb21288b2dbfa9d80cee5968a3b8fb21 of
the Linux kernel with local zephyr related modifications.
Fixes#4135.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
To define a system call, it's now sufficient to simply tag the inline
prototype with "__syscall" or "__syscall_inline" and include a special
generated header at the end of the header file.
The system call dispatch table and enumeration of system call IDs is now
automatically generated.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Remove MAINTAINERS in favor of CODEOWNERS file which is supported by
github. Also remove scripts using this file and change checkpatch to
reference CODEOWNERS instead.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Only in rare cases should we allow C99 types, so lets warn about it to
catch issues.
Change-Id: I2bacdd4ba98f88482e0b7acc0567ff1139e749bf
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Adjust the checkpatch script to recognize the volatile keyword as
forming part of a declaration. This prevents inappropriate checkpatch
gripes for patches such as:
https://gerrit.zephyrproject.org/r/#/c/10345/
Change-Id: Ia29a9002bb9ef15f747d29231d938ae12790724d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Update with commit 577f12c07e4edd54730dc559a9c7bc44d22bf7dc from
the Linux kernel.
Change-Id: Ie2cabbfea415d26ffacef340d9497342b496dc29
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This reverts commit 0c9152d42d.
This was not ready for merge yet.
Change-Id: I08f69e27929867606bc58cdeffed6540725069a1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Update with commit 577f12c07e4edd54730dc559a9c7bc44d22bf7dc from the Linux
kernel.
Change-Id: I6314dd41eb200c87cdcc6f212f13d3351128de0d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
checkpatch warns about kconfig lines that contains spaces
instead of tabs.
Change-Id: I60aa74072ce424f21db64a7df0804d7d4cbe315b
Jira: ZEP-427
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
when importing code from external sources, we do not want to fail
on checkpatch and want to run full sanity checks.
Using --exclude <dir> we should be able to exclude a list of well
defined locations in the tree that carry sources from other projects
with other styles.
Change-Id: I7d321e85eed6bc37d5c6879ae88e21d20028a433
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
There seems to be no way to configure it, so I've just removed the code.
Change-Id: I35341e8afc0bdfa8b953b833cfb0eecf05b81c16
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
generates lots of false postives, so make it warn only.
Change-Id: I0b2fedc564c29bff32f7c48702a9ad54a969650b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fix issue where a space is required after a comma:
-:245: ERROR:SPACING: space required after that ',' (ctx:VxB)
+ SECTION_PROLOGUE(_NOINIT_DMA_SECTION_NAME, (NOLOAD OPTIONAL),)
Now we will ignore such errors if the comma is followed by a ).
Change-Id: Ib38161cd11e650764c319ba373a1f7c1a6d80df6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Update to commit 6b10df4257367dd0ead49f88df473972c00a8b5c from the Linux
kernel, relevant changes since last update:
- checkpatch: fix a number of COMPLEX_MACRO false positives
- checkpatch: improve macros with flow control test
- checkpatch: warn when casting constants to c90 int or longer types
- checkpatch: improve the unnecessary initialisers tests
- checkpatch: improve tests for fixes:, long lines and stack dumps in commit log
Change-Id: Ic4f8d925cd7c076e18eb2f2841913be61239aac2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This allows the customary syntax for declaring named arguments,
such as:
asm ("mov %[out],%[in]" : [out] "=r" (x) : [in] "r" (y));
Since :[ is comple-error-inducingly invalid syntax in other cases,
this won't create unintentional leniency for normal uses of [
Originally from https://lkml.org/lkml/2010/11/16/145 by Dave Martin
Change-Id: Iead3fdb147ba2f6cbd108f19dd348bb72a7e6b6f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Lots of enhancements and bug fixes but primarily it fixes an issue
where checkpatch was reporting errors in lines that have not changed.
Change-Id: If141a294b92cbabd4ad8978a40168abb062aebfb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Zephyr does not have a MAINTAINERS files, so remove the comment
about checking the file when reporting false positives to avoid
confusion.
Change-Id: I915dba009902a68d5e621603d22b7df57d84a1b1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>