Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114775
b: refs/heads/master
c: 170d3a2
h: refs/heads/master
i:
  114773: 9bf8dbd
  114771: 6114881
  114767: a8c81e7
v: v3
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Oct 16, 2008
1 parent a2baaef commit 724a97e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6a84062821738426ed4f58f4d584ecb7feb3dee
refs/heads/master: 170d3a22688f06fda42e353bbccd0f3df89f3d94
27 changes: 24 additions & 3 deletions trunk/scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@ sub process {

# suppression flags
my %suppress_ifbraces;
my %suppress_whiletrailers;

# Pre-scan the patch sanitizing the lines.
# Pre-scan the patch looking for any __setup documentation.
Expand Down Expand Up @@ -1156,6 +1157,7 @@ sub process {
$prev_values = 'E';

%suppress_ifbraces = ();
%suppress_whiletrailers = ();
next;

# track the line number as we move through the hunk, note that
Expand Down Expand Up @@ -1301,9 +1303,9 @@ sub process {
}

# Check for potential 'bare' types
my ($stat, $cond, $line_nr_next, $remain_next);
my ($stat, $cond, $line_nr_next, $remain_next, $off_next);
if ($realcnt && $line =~ /.\s*\S/) {
($stat, $cond, $line_nr_next, $remain_next) =
($stat, $cond, $line_nr_next, $remain_next, $off_next) =
ctx_statement_block($linenr, $realcnt, 0);
$stat =~ s/\n./\n /g;
$cond =~ s/\n./\n /g;
Expand Down Expand Up @@ -1952,7 +1954,26 @@ sub process {

# Check for illegal assignment in if conditional -- and check for trailing
# statements after the conditional.
if ($line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
if ($line =~ /do\s*(?!{)/) {
my ($stat_next) = ctx_statement_block($line_nr_next,
$remain_next, $off_next);
$stat_next =~ s/\n./\n /g;
##print "stat<$stat> stat_next<$stat_next>\n";

if ($stat_next =~ /^\s*while\b/) {
# If the statement carries leading newlines,
# then count those as offsets.
my ($whitespace) =
($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
my $offset =
statement_rawlines($whitespace) - 1;

$suppress_whiletrailers{$line_nr_next +
$offset} = 1;
}
}
if (!defined $suppress_whiletrailers{$linenr} &&
$line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
my ($s, $c) = ($stat, $cond);

if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
Expand Down

0 comments on commit 724a97e

Please sign in to comment.