Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e63245d4 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Bryan Huntsman
Browse files

checkpatch: check for #if 0/#if 1



Warn if #if 1 or #if 0 is present.

Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit a81f92c9abe442ad5b00e8df31172f145a14af3f)
Signed-off-by: default avatarStepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>

Change-Id: I91eeb530c08815324af69df8c12f7ece3fd0378c
parent 67b8d5c7
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -5380,9 +5380,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