checkpatch: fix multi-statement macro checks for while blocks.
[sfrench/cifs-2.6.git] / scripts / checkpatch.pl
index 5424134e201d226ff279da30bb78a9c954096a09..8a5f0367a2f1995fb8f6f4ebcfa00a9d92ba7fab 100755 (executable)
@@ -5351,9 +5351,9 @@ sub process {
                        $dstat =~ s/\s*$//s;
 
                        # Flatten any parentheses and braces
-                       while ($dstat =~ s/\([^\(\)]*\)/1/ ||
-                              $dstat =~ s/\{[^\{\}]*\}/1/ ||
-                              $dstat =~ s/.\[[^\[\]]*\]/1/)
+                       while ($dstat =~ s/\([^\(\)]*\)/1u/ ||
+                              $dstat =~ s/\{[^\{\}]*\}/1u/ ||
+                              $dstat =~ s/.\[[^\[\]]*\]/1u/)
                        {
                        }
 
@@ -5394,6 +5394,7 @@ sub process {
                            $dstat !~ /^\.$Ident\s*=/ &&                                # .foo =
                            $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ &&          # stringification #foo
                            $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ &&       # do {...} while (...); // do {...} while (...)
+                           $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ &&           # while (...) {...}
                            $dstat !~ /^for\s*$Constant$/ &&                            # for (...)
                            $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&   # for (...) bar()
                            $dstat !~ /^do\s*{/ &&                                      # do {...