From 5867d1e2ad36928eba642ac1c7c695cbc13ef9cc Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Thu, 1 Oct 2009 12:01:44 -0700 Subject: checkpatch: check for #if 0/#if 1 Warn if #if 1 or #if 0 is present. Signed-off-by: Abhijeet Dharmapurikar (cherry picked from commit a81f92c9abe442ad5b00e8df31172f145a14af3f) Signed-off-by: Stepan Moskovchenko --- scripts/checkpatch.pl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'scripts') 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 () fn()" uses -- cgit v1.2.3