[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4a8c5a82369787869ec52667397e61b6f619b08f.camel@perches.com>
Date: Thu, 26 Jul 2018 14:31:10 -0700
From: Joe Perches <joe@...ches.com>
To: Prakruthi Deepak Heragu <pheragu@...eaurora.org>,
apw@...onical.com, Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, ckadabi@...eaurora.org,
tsoni@...eaurora.org, bryanh@...eaurora.org,
Abhijeet Dharmapurikar <adharmap@...eaurora.org>
Subject: Re: [PATCH v2] checkpatch: check for #if 0/#if 1
On Thu, 2018-07-26 at 10:13 -0700, Prakruthi Deepak Heragu wrote:
> The #if 0 or #if 1 is used to toggle features. Warn if #if 0 or #if 1
> is present and suggest that they can be removed.
>
> Signed-off-by: Abhijeet Dharmapurikar <adharmap@...eaurora.org>
> Signed-off-by: Prakruthi Deepak Heragu <pheragu@...eaurora.org>
Andrew, can you please move the misplaced periods below
to the appropriate positions?
Otherwise:
Acked-by: Joe Perches <joe@...ches.com>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5383,9 +5383,14 @@ sub process {
>
> # warn about #if 0
> if ($line =~ /^.\s*\#\s*if\s+0\b/) {
> - CHK("REDUNDANT_CODE",
> - "if this code is redundant consider removing it\n" .
> - $herecurr);
> + WARN("IF_0",
> + "Consider removing the code enclosed by this #if 0 and its #endif\n". $herecurr);
This should have a space before the . and only one space after.
> + }
> +
> +# warn about #if 1
> + if ($line =~ /^.\s*\#\s*if\s+1\b/) {
> + WARN("IF_1",
> + "Consider removing the #if 1 and its #endif\n". $herecurr);
here too
> }
>
> # check for needless "if (<foo>) fn(<foo>)" uses
Powered by blists - more mailing lists