Skip to content

Commit fd1b57a

Browse files
Andy Whitcrofttorvalds
authored andcommitted
checkpatch: high precedence operators do not require additional parentheses in #defines
With any very high precedence operator it is not necessary to enforce additional parentheses around simple negated expressions. This prevents us requesting further perentheses around the following: #define PMEM_IS_FREE(id, index) !(pmem[id].bitmap[index].allocated) For now add logical and bitwise not and unary minus. Signed-off-by: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e45bab8 commit fd1b57a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/checkpatch.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2916,7 +2916,7 @@ sub process {
29162916
if ($dstat ne '' &&
29172917
$dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(),
29182918
$dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo();
2919-
$dstat !~ /^(?:$Ident|-?$Constant)$/ && # 10 // foo()
2919+
$dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo
29202920
$dstat !~ /^'X'$/ && # character constants
29212921
$dstat !~ /$exceptions/ &&
29222922
$dstat !~ /^\.$Ident\s*=/ && # .foo =

0 commit comments

Comments
 (0)