]> git.baikalelectronics.ru Git - kernel.git/commit
kconfig: fix relational operators for bool and tristate symbols
authorNicolas Pitre <nicolas.pitre@linaro.org>
Fri, 17 Nov 2017 01:06:39 +0000 (20:06 -0500)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 5 Jan 2018 17:31:23 +0000 (02:31 +0900)
commitc910ebf87df493640d0c4b55aa481dce928f7c4d
treebc3011bb806742c6b1f2f4d8b13692aebb51a844
parentd2333bd682ef5d0d13514fcd7963301b14cde338
kconfig: fix relational operators for bool and tristate symbols

Since commit dabb2b90c17b ("kconfig: allow use of relations other than
(in)equality") it is possible to use relational operators in Kconfig
statements. However, those operators give unexpected results when
applied to bool/tristate values:

(n < y) = y (correct)
(m < y) = y (correct)
(n < m) = n (wrong)

This happens because relational operators process bool and tristate
symbols as strings and m sorts before n. It makes little sense to do a
lexicographical compare on bool and tristate values though.

Documentation/kbuild/kconfig-language.txt states that expression can have
a value of 'n', 'm' or 'y' (or 0, 1, 2 respectively for calculations).
Let's make it so for relational comparisons with bool/tristate
expressions as well and document them. If at least one symbol is an
actual string then the lexicographical compare works just as before.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Documentation/kbuild/kconfig-language.txt
scripts/kconfig/expr.c