Skip to contentSkip to conversation

checkpatch: Fix bracing false positives on #else

PATCH Applied Jan Kiszka 2 participants 2 messages Jan 21, 2011 Checkpatch

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 checkpatch: Fix bracing false positives on #else

---
 scripts/checkpatch.pl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/checkpatch.pl +2 -1
index 55ef439..4fa06c0 100755
@@ -2536,7 +2536,8 @@ sub process {
 			}
 		}
 		if (!defined $suppress_ifbraces{$linenr - 1} &&
-					$line =~ /\b(if|while|for|else)\b/) {
+					$line =~ /\b(if|while|for|else)\b/ &&
+					$line !~ /\#\s*else/) {
 			my $allowed = 0;
 
 			# Check the pre-context.
Signature · 1 line
1.7.1
Applied
#1 lore raw

Thanks, applied.

Quoted 22 lines · Jan Kiszka

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

 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/checkpatch.pl +0 -0
index 55ef439..4fa06c0 100755
@@ -2536,7 +2536,8 @@ sub process {
                        }
                }

               if (!defined $suppress_ifbraces{$linenr - 1} &&

-                                       $line =~ /\b(if|while|for|else)\b/) {
+                                       $line =~ /\b(if|while|for|else)\b/ &&

+                                       $line !~ /\#\s*else/) { my $allowed = 0;

                       # Check the pre-context.
--
1.7.1