It seems to be a common idiom to include braces on conditionals in all contexts including return. Allow this exception to the return is not a function checks. Reported by Kay Sievers.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -127,6 +127,7 @@ our $Lval = qr{$Ident(?:$Member)*}; · 126 unmodified lines | ||
| 127 | 127 | |
| 128 | 128 | our $Constant = qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*}; |
| 129 | 129 | our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; |
| 130 | +our $Compare = qr{<=|>=|==|!=|<|>}; | |
| 130 | 131 | our $Operators = qr{ |
| 131 | 132 | <=|>=|==|!=| |
| 132 | 133 | =>|->|<<|>>|<|>|!|~| |
| @@ -1983,9 +1984,9 @@ sub process { · 1850 unmodified lines | ||
| 1983 | 1984 | my $spacing = $1; |
| 1984 | 1985 | my $value = $2; |
| 1985 | 1986 | |
| 1986 | − # Flatten any parentheses and braces | |
| 1987 | + # Flatten any parentheses | |
| 1987 | 1988 | $value =~ s/\)\(/\) \(/g; |
| 1988 | − while ($value =~ s/\([^\(\)]*\)/1/) { | |
| 1989 | + while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) { | |
| 1989 | 1990 | } |
| 1990 | 1991 | |
| 1991 | 1992 | if ($value =~ /^(?:$Ident|-?$Constant)$/) { |