mirror-linux/scripts/kconfig/tests
Nicolas Pitre 76df6815da
kconfig: Support conditional deps using "depends on X if Y"
Extend the "depends on" syntax to support conditional dependencies
using "depends on X if Y". While functionally equivalent to "depends
on X || (Y == n)", "depends on X if Y" is much more readable and
makes the kconfig language uniform in supporting the "if <expr>"
suffix.
This also improves readability for "optional" dependencies, which
are the subset of conditional dependencies where X is Y.
Previously such optional dependencies had to be expressed as
the counterintuitive "depends on X || !X", now this can be
represented as "depends on X if X".

The change is implemented by converting the "X if Y" syntax into the
"X || (Y == n)" syntax during "depends on" token processing.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
[Graham Roff: Rewrote commit message, updated patch, added tests]
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20251215-kconfig_conditional_deps-v3-1-59519af0a5df@qti.qualcomm.com
[nathan: Minor adjustments to spacing]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-01-06 14:57:15 -07:00
..
auto_submenu kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
choice kconfig: remove tristate choice support 2024-07-16 01:08:36 +09:00
choice_randomize kconfig: tests: add a test for randconfig with dependent choices 2024-03-21 02:39:55 +09:00
choice_randomize2 kconfig: tests: test dependency after shuffling choices 2024-03-21 02:40:39 +09:00
conditional_dep kconfig: Support conditional deps using "depends on X if Y" 2026-01-06 14:57:15 -07:00
err_recursive_dep kconfig: recursive checks drop file/lineno 2024-07-20 16:33:45 +09:00
err_recursive_inc kconfig: tests: fix recursive inclusion unit test 2019-06-05 02:33:10 +09:00
err_transitional kconfig: Add transitional symbol attribute for migration support 2025-09-24 14:23:35 -07:00
new_choice_with_dep kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
no_write_if_dep_unmet kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
preprocess kconfig: test: add Kconfig macro language tests 2018-05-29 03:31:19 +09:00
transitional kconfig: Avoid prompting for transitional symbols 2025-10-07 08:21:23 -07:00
conftest.py kconfig: Fix BrokenPipeError warnings in selftests 2025-09-24 14:23:35 -07:00
pytest.ini