From fd1b57ac73f169a5ba7a9569989aad40184f6340 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Fri, 23 Mar 2012 15:02:18 -0700 Subject: [PATCH] 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 Cc: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 01a65988a057..ec58d3152e71 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2916,7 +2916,7 @@ sub process { if ($dstat ne '' && $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); - $dstat !~ /^(?:$Ident|-?$Constant)$/ && # 10 // foo() + $dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo $dstat !~ /^'X'$/ && # character constants $dstat !~ /$exceptions/ && $dstat !~ /^\.$Ident\s*=/ && # .foo = -- 2.20.1