linux/scripts/kconfig/tests
Nicolas Schier 102d712ded
kconfig: Error out on duplicated kconfig inclusion
Let kconfig exit with error on duplicated Kconfig file inclusion.

Repeated inclusion of Kbuild files are considered bad-practise with
regard to maintenance; and Kconfig language is rich enough that there
should be no need for that.

If repeated inclusion of Kconfig files is detected, error out with
messages like:

    Kconfig.inc1:4: error: repeated inclusion of Kconfig.inc3
    Kconfig.inc2:3: note: location of first inclusion of Kconfig.inc3

While commit f094f8a1b2 ("kconfig: allow multiple inclusion of the
same file") introduced detection of recursive inclusions of Kconfig
files, it explicitly allowed repeated inclusions, unfortunately w/o
reasoning.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Closes: https://lore.kernel.org/all/CAHk-=wj03hLzK2D=+OYmjgcmGM+XYymp8GyaEs=C0=rXG2nb7w@mail.gmail.com/
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20260220-kconfig-error-out-on-duplicated-inclusion-v1-1-be78aa241a53@kernel.org
Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-02-27 09:26:58 +01: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_repeated_inc kconfig: Error out on duplicated kconfig inclusion 2026-02-27 09:26:58 +01: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