]> git.ipfire.org Git - thirdparty/linux.git/commit
kconfig: add optional warnings for changed input values
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Thu, 11 Jun 2026 06:00:00 +0000 (14:00 +0800)
committerNathan Chancellor <nathan@kernel.org>
Thu, 18 Jun 2026 18:46:32 +0000 (11:46 -0700)
commit645323a7f4e55bb3abb0cb003b6b9dc715c8dc21
tree163591ebab1b8a33a6efaf00393e96c3d566bb62
parent9a289cc425bf469642533e4afa01c90f08971d01
kconfig: add optional warnings for changed input values

When reading .config input, Kconfig stores user-provided values first
and then resolves the final value after applying dependencies, ranges,
and other constraints.

If the final value differs from the user input, Kconfig already tracks
that state internally, but it does not provide a focused diagnostic to
show which explicit inputs were adjusted. This is particularly confusing
for requested values that get forced down by unmet dependencies or
clamped by ranges.

Add an opt-in diagnostic controlled by KCONFIG_WARN_CHANGED_INPUT. Emit
the warnings from conf_write() and conf_write_defconfig() after value
resolution. Print the diagnostic to stderr directly, not through the
normal message callback, so it remains visible when conf is run with -s,
such as from make -s.

Keep the diagnostic out of the conf_message() formatting buffer so long
warning lists are not truncated, and mark processed symbols as written
before the SYMBOL_WRITE check so duplicate menu nodes cannot emit
duplicate warnings.

Document the new environment variable and add tests for olddefconfig,
savedefconfig, and the silent-conf path.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Tested-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260611060000.23858-1-pengpeng@iscas.ac.cn
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Documentation/kbuild/kconfig.rst
scripts/kconfig/confdata.c
scripts/kconfig/tests/conftest.py
scripts/kconfig/tests/warn_changed_input/Kconfig [new file with mode: 0644]
scripts/kconfig/tests/warn_changed_input/__init__.py [new file with mode: 0644]
scripts/kconfig/tests/warn_changed_input/config [new file with mode: 0644]
scripts/kconfig/tests/warn_changed_input/expected_config [new file with mode: 0644]
scripts/kconfig/tests/warn_changed_input/expected_defconfig [new file with mode: 0644]
scripts/kconfig/tests/warn_changed_input/expected_stderr [new file with mode: 0644]