Patchwork checkpatch: Fix bracing false positives on #if

login
register
mail settings
Submitter Blue Swirl
Date July 17, 2011, 8:48 a.m.
Message ID <CAAu8pHtWgi0AioXgejLxQnBkX6xovBDoz2YEJDy2SyV8T5WJ+w@mail.gmail.com>
Download mbox | patch
Permalink /patch/105007/
State New
Headers show

Comments

Blue Swirl - July 17, 2011, 8:48 a.m.
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(-)
Stefan Hajnoczi - July 18, 2011, 12:19 p.m.
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>

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;