From: Simon Glass Date: Fri, 22 May 2020 22:32:40 +0000 (-0600) Subject: checkpatch.pl: Request if() instead #ifdef X-Git-Tag: v2020.10~178^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd5b0fad8f295c6e786f1528d09f03fa546289cd;p=platform%2Fkernel%2Fu-boot.git checkpatch.pl: Request if() instead #ifdef There is a lot of use of #ifdefs in U-Boot. In an effort reduce this, suggest using the compile-time construct. Signed-off-by: Simon Glass --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index cf620c8..17d4182 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2261,6 +2261,12 @@ sub u_boot_line { WARN("CMD_TEST", "Possible new command - make sure you add a test\n" . $herecurr); } + + # use if instead of #if + if ($line =~ /^\+#if.*CONFIG.*/) { + WARN("PREFER_IF", + "Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr); + } } sub process {