Skip to content

Commit dbb45dd

Browse files
JordanYatescfriedt
authored andcommitted
scripts: checkpatch.pl: relax Missing a blank line
Relax the `Missing a blank line after declarations` checkpatch error by loosening the requirements for a macro to be treated as one that declared a variable. Currently the regex matches the pattern `DECLARE` or `DEFINE`, as long as there are between 1 and 6 trailing `_FOO` components to the macro name (e.g. `DECLARE_MY_TYPE()`). Zephyr however contains many macros that don't have the trailing components but still resolve to variables (e.g. `ATOMIC_DEFINE`, `K_MUTEX_DEFINE, etc`). By changing `{1,6}` to `{0,6}`, we remove the requirement for the trailing `_FOO` component(s) while still allowing them. This stops checkpatch from erroring on patterns like this: ``` struct driver_data { uint16_t some_value; ATOMIC_DEFINE(some_atomic, 16); }; ``` Signed-off-by: Jordan Yates <[email protected]>
1 parent 31d16f3 commit dbb45dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/checkpatch.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ sub build_types {
863863
our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)};
864864

865865
our $declaration_macros = qr{(?x:
866-
(?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
866+
(?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){0,6}\s*\(|
867867
(?:$Storage\s+)?[HLP]?LIST_HEAD\s*\(|
868868
(?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(
869869
)};

0 commit comments

Comments
 (0)