linux/scripts/kconfig
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
..
icons kconfig: move XPM icons to separate files 2025-12-19 13:34:33 -07:00
lxdialog kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c 2025-08-06 10:23:36 +09:00
tests kconfig: Error out on duplicated kconfig inclusion 2026-02-27 09:26:58 +01:00
.gitignore
Makefile kconfig: move XPM icons to separate files 2025-12-19 13:34:33 -07:00
conf.c kconfig: rename menu_get_parent_menu() to menu_get_menu_or_parent_menu() 2025-06-30 12:52:58 +09:00
confdata.c kconfig: use memcmp instead of deprecated bcmp 2025-06-18 10:11:15 +09:00
expr.c kconfig: clear expr::val_is_valid when allocated 2024-10-01 17:05:30 +09:00
expr.h kconfig: Add transitional symbol attribute for migration support 2025-09-24 14:23:35 -07:00
gconf-cfg.sh kconfig: gconf: migrate to GTK 3 2025-07-26 15:31:29 +09:00
gconf.c kconfig: move XPM icons to separate files 2025-12-19 13:34:33 -07:00
gconf.ui kconfig: gconf: replace GtkImageMenuItem with GtkMenuItem 2025-07-26 19:55:37 +09:00
internal.h kconfig: cache expression values 2024-09-20 09:21:53 +09:00
lexer.l kconfig: Error out on duplicated kconfig inclusion 2026-02-27 09:26:58 +01:00
lkc.h kconfig: Error out on duplicated kconfig inclusion 2026-02-27 09:26:58 +01:00
lkc_proto.h kconfig: add sym_get_prompt_menu() helper function 2024-11-06 08:46:34 +09:00
mconf-cfg.sh
mconf.c kconfig/mconf: Initialize the default locale at startup 2025-11-01 00:21:23 -04:00
menu.c kconfig: Support conditional deps using "depends on X if Y" 2026-01-06 14:57:15 -07:00
merge_config.sh scripts: kconfig: merge_config.sh: warn on duplicate input files 2026-01-22 15:58:45 -07:00
mnconf-common.c
mnconf-common.h
nconf-cfg.sh kconfig: fix static linking of nconf 2026-01-14 14:23:20 +01:00
nconf.c kconfig/nconf: Initialize the default locale at startup 2025-11-01 00:23:22 -04:00
nconf.gui.c kconfig: nconf: Format and print 'line' without a temporary copy 2025-08-18 10:46:19 -07:00
nconf.h
parser.y kconfig: Support conditional deps using "depends on X if Y" 2026-01-06 14:57:15 -07:00
preprocess.c kbuild: split x*alloc() functions in kconfig to scripts/include/xalloc.h 2024-09-01 20:34:48 +09:00
preprocess.h
qconf-cfg.sh
qconf.cc kconfig: move XPM icons to separate files 2025-12-19 13:34:33 -07:00
qconf.h kconfig: qconf: confine {begin,end}Group to constructor and destructor 2025-07-26 15:31:30 +09:00
streamline_config.pl streamline_config.pl: remove superfluous exclamation mark 2026-02-02 21:54:20 -07:00
symbol.c kconfig: Avoid prompting for transitional symbols 2025-10-07 08:21:23 -07:00
util.c kconfig: Error out on duplicated kconfig inclusion 2026-02-27 09:26:58 +01:00