Re: [PATCH] Documentation: warn against using int, hex, string options as expressions in Kconfig
From: Nathan Chancellor
Date: Thu Jul 30 2026 - 20:25:52 EST
> I've been working on type checking Kconfig, and found some instances of
> dead code due to conditions that always evaluate to false.
>
> For example:
>
> config FOO
> int
>
> config BAR
> bool
> default 'y' if FOO
Drop this quoting of y for clarity?
> This 'if FOO' will always be false, regardless of FOO's value (even when
> FOO=1). The same goes for strings and hex.
Hmmm, it might be kind of nice to either:
1. Warn about this in Kconfig directly (if possible)
2. Support this usage in Kconfig how one would intuitively expect from
either C or Python where symbols with values of 0, 0x0, and '' would
be treated as false and every other value set as true.
> See also this related patch:
> https://lore.kernel.org/all/20260729210546.394392-1-julianbraha@xxxxxxxxx/
>
> Let's warn users against this usage.
That said, until either of those potentially happen, this patch seems
fine.
Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
--
Cheers,
Nathan