diff mbox

checkpatch: Fix bracing false positives on #if

Message ID CAAu8pHtWgi0AioXgejLxQnBkX6xovBDoz2YEJDy2SyV8T5WJ+w@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl July 17, 2011, 8:48 a.m. UTC
789f88d0b21fedfd4251d56bb7a9fbfbda7a4ac7 only fixed #else,
fix also #if.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 scripts/checkpatch.pl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Stefan Hajnoczi July 18, 2011, 12:19 p.m. UTC | #1
On Sun, Jul 17, 2011 at 9:48 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
> 789f88d0b21fedfd4251d56bb7a9fbfbda7a4ac7 only fixed #else,
> fix also #if.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
>  scripts/checkpatch.pl |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 075b614..9bc867f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2537,6 +2537,7 @@ sub process {
>                }
>                if (!defined $suppress_ifbraces{$linenr - 1} &&
>                                        $line =~ /\b(if|while|for|else)\b/ &&
> +                                       $line !~ /\#\s*if/ &&
>                                        $line !~ /\#\s*else/) {
>                        my $allowed = 0;
>
> --
> 1.6.2.4

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
diff mbox

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 075b614..9bc867f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2537,6 +2537,7 @@  sub process {
 		}
 		if (!defined $suppress_ifbraces{$linenr - 1} &&
 					$line =~ /\b(if|while|for|else)\b/ &&
+					$line !~ /\#\s*if/ &&
 					$line !~ /\#\s*else/) {
 			my $allowed = 0;