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>
This commit is contained in:
Abhijeet Dharmapurikar 2009-10-01 12:01:44 -07:00 committed by Stepan Moskovchenko
parent 7596d57aa8
commit 2b7a4e2acd
1 changed files with 10 additions and 3 deletions

View File

@ -4456,9 +4456,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