Skip to contentSkip to conversation

checkpatch: fix braces {} handling

PATCH Applied Pavel Borzenkov 2 participants 2 messages Aug 26, 2011 – Aug 27, 2011 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: fix braces {} handling

checkpatch.pl doesn't report warning for if/else statements with missing 'else' braces:

if (something) {
    foo;
} else
    bar;

The patch has been tested using the last 100 commits.

---
 scripts/checkpatch.pl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/checkpatch.pl +1 -1
index 3498425..0eba357 100755
@@ -2532,7 +2532,7 @@ sub process {
 						$allowed = 1;
 					}
 				}
-				if (!$seen) {
+				if ($seen != ($#chunks + 1)) {
 					WARN("braces {} are necessary for all arms of this statement\n" . $herectx);
 				}
 			}
Signature · 1 line
1.7.0.4
Applied
#1 lore raw

Thanks, applied.

Quoted 33 lines · Pavel Borzenkov

checkpatch.pl doesn't report warning for if/else statements with missing 'else' braces:

if (something) {
   foo;
} else
   bar;

The patch has been tested using the last 100 commits.

---
 scripts/checkpatch.pl |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/checkpatch.pl +1 -2
index 3498425..0eba357 100755
@@ -2532,7 +2532,7 @@ sub process {
                                                $allowed = 1;
                                        }
                                }
-                               if (!$seen) {
+                               if ($seen != ($#chunks + 1)) {
                                        WARN("braces {} are necessary for all arms of this statement\n" . $herectx);
                                }
                        }
--

1.7.0.4