The patch titled Subject: checkpatch: check for #if 0/#if 1 has been added to the -mm tree. Its filename is checkpatch-check-for-if-0-if-1.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/checkpatch-check-for-if-0-if-1.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-check-for-if-0-if-1.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Prakruthi Deepak Heragu <pheragu@xxxxxxxxxxxxxx> Subject: 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. Link: http://lkml.kernel.org/r/1532625218-24321-1-git-send-email-pheragu@xxxxxxxxxxxxxx Signed-off-by: Abhijeet Dharmapurikar <adharmap@xxxxxxxxxxxxxx> Signed-off-by: Prakruthi Deepak Heragu <pheragu@xxxxxxxxxxxxxx> Acked-by: Joe Perches <joe@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/checkpatch.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/scripts/checkpatch.pl~checkpatch-check-for-if-0-if-1 +++ a/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 _ Patches currently in -mm which might be from pheragu@xxxxxxxxxxxxxx are checkpatch-check-for-if-0-if-1.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html