summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAbhijeet Dharmapurikar <adharmap@codeaurora.org>2009-10-01 12:01:44 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:51:36 -0700
commit5867d1e2ad36928eba642ac1c7c695cbc13ef9cc (patch)
treef878a453f804a83021c3f42596171e0063290317 /scripts/checkpatch.pl
parent38c7200e095dfef98a61d970baad8dbde5fe3cba (diff)
checkpatch: check for #if 0/#if 1
Warn if #if 1 or #if 0 is present. Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> (cherry picked from commit a81f92c9abe442ad5b00e8df31172f145a14af3f) Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b3c22808c3b..1486354b13fa 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4896,9 +4896,16 @@ 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",
+ "if this code is redundant consider removing it\n"
+ . $herecurr);
+ }
+
+# warn about #if 1
+ if ($line =~ /^.\s*\#\s*if\s+1\b/) {
+ WARN("IF_1",
+ "if this code is required consider removing"
+ . " #if 1\n" . $herecurr);
}
# check for needless "if (<foo>) fn(<foo>)" uses