lkml.org 
[lkml]   [2018]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] checkpatch: check for #if 0/#if 1
From
Date
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@codeaurora.org>
> Signed-off-by: Prakruthi Deepak Heragu <pheragu@codeaurora.org>

Andrew, can you please move the misplaced periods below
to the appropriate positions?

Otherwise:

Acked-by: Joe Perches <joe@perches.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

\
 
 \ /
  Last update: 2018-07-26 23:32    [W:0.847 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site