[PATCH] checkpatch.pl: Reword IS_ENABLED() warning

Simon Glass sjg at chromium.org
Tue Aug 2 14:41:47 CEST 2022


On Tue, 2 Aug 2022 at 06:33, Tom Rini <trini at konsulko.com> wrote:
>
> While there are good reasons to use 'if (IS_ENABLED(CONFIG_...))' for
> runtime tests, there's equally good reasons to use '#ifdef CONFIG_...'
> for build time tests.  Reword this message to hopefully avoid confusion.
>
> Cc: Simon Glass <sjg at chromium.org>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>


> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index fe13e265a3fe..2d737bdb991b 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2621,7 +2621,7 @@ sub u_boot_line {
>         # use if instead of #if
>         if ($realfile =~ /\.c$/ && $line =~ /^\+#if.*CONFIG.*/) {
>                 WARN("PREFER_IF",
> -                    "Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr);
> +                    "Possible runtime #ifdef, see if using 'if (IS_ENABLED(CONFIG...))' instead is possible\n" . $herecurr);
>         }
>
>         # prefer strl(cpy|cat) over strn(cpy|cat)
> --
> 2.25.1
>


More information about the U-Boot mailing list