Re: [PATCH] Documentation: warn against using int, hex, string options as expressions in Kconfig
From: Arnd Bergmann
Date: Fri Jul 31 2026 - 06:35:44 EST
On Fri, Jul 31, 2026, at 11:43, Julian Braha wrote:
> On 7/31/26 01:25, Nathan Chancellor wrote:
>>> 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.
>
> Agreed, an interpreter change for this is on my roadmap. Though I was
> also considering to make this error out.
>
> Would be good to get some more feedback from others on which approach is
> preferred (Jani, Arnd?)
I'm fine with either of the two approaches, both seem better than
to document the current behavior just to change that again later.
If it's going to cause a hard error, we have to be sure to fix
all existing instances first, otherwise a warning would be better.
Arnd