diff options
author | Prakruthi Deepak Heragu <pheragu@codeaurora.org> | 2018-08-22 06:57:57 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 19:52:48 +0200 |
commit | 60f890105547f7a48ea1d67c5ae69966c7245b23 (patch) | |
tree | 2c5ac8940118dbe13a4ccd2ae2f0eb6706188e3b /scripts/checkpatch.pl | |
parent | checkpatch: fix krealloc reuse test (diff) | |
download | linux-60f890105547f7a48ea1d67c5ae69966c7245b23.tar.xz linux-60f890105547f7a48ea1d67c5ae69966c7245b23.zip |
checkpatch: check for #if 0/#if 1
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.
[akpm@linux-foundation.org: fix spacing around periods, per Joe\
Link: http://lkml.kernel.org/r/1532625218-24321-1-git-send-email-pheragu@codeaurora.org
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Prakruthi Deepak Heragu <pheragu@codeaurora.org>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rwxr-xr-x | scripts/checkpatch.pl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d43a446941ce..b5eade941f4a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5422,9 +5422,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); + } + +# 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); } # check for needless "if (<foo>) fn(<foo>)" uses |