Skip to content

Commit

Permalink
checkpatch: update $declaration_macros, add uninitialized_var
Browse files Browse the repository at this point in the history
Using uninitialized_var reports a false positive for "Missing blank line
after declarations".

Fix it by adding uninitialized_var to the $declaration_macros exceptions
list.

Move the macro list after $Type is declared.

Add optional prefixes to DECLARE_<FOO> and DEFINE_<BAR>
macro declarations to allow forms like:
	MLX4_DECLARE_DOORBELL_LOCK

Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Dotan Barak <dotanb@mellanox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Aug 7, 2014
1 parent ece9659 commit f842230
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,6 @@ sub hash_show_words {
$mode_perms_search .= $entry->[0];
}

our $declaration_macros = qr{(?x:
(?:$Storage\s+)?(?:DECLARE|DEFINE)_[A-Z]+\s*\(|
(?:$Storage\s+)?LIST_HEAD\s*\(
)};

our $allowed_asm_includes = qr{(?x:
irq|
memory
Expand Down Expand Up @@ -490,6 +485,12 @@ sub build_types {
our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*};
our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)};

our $declaration_macros = qr{(?x:
(?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,2}\s*\(|
(?:$Storage\s+)?LIST_HEAD\s*\(|
(?:$Storage\s+)?${Type}\s+uninitialized_var\s*\(
)};

sub deparenthesize {
my ($string) = @_;
return "" if (!defined($string));
Expand Down

0 comments on commit f842230

Please sign in to comment.