Re: [PATCH] Documentation: warn against using int, hex, string options as expressions in Kconfig

Nathan Chancellor <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel
Message-ID <178545753473.3004192.2499981065379649802.b4-review@b4>
> 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/[email protected]/
> 
> Let's warn users against this usage.

That said, until either of those potentially happen, this patch seems
fine.

Reviewed-by: Nathan Chancellor <[email protected]>

-- 
Cheers,
Nathan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.