diff options
| author | Simon Glass <[email protected]> | 2020-05-22 16:32:40 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2020-06-04 18:10:02 -0400 |
| commit | dd5b0fad8f295c6e786f1528d09f03fa546289cd (patch) | |
| tree | 2ee30e0f18ab5a085dd9dd65a0ecc9cf92066e7f /scripts/checkpatch.pl | |
| parent | 58978114d93d5010d15c8be792f9e444da5fb250 (diff) | |
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 <[email protected]>
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index cf620c8614a..17d41825c5e 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 { |
