On Thu, May 21, 2026 at 10:28:24AM +0800, Pengpeng Hou wrote: > 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's input, Kconfig already tracks > that state internally, but it does not provide any 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 and through the existing message callback path so the default > behavior stays unchanged and interactive frontends remain usable. > > Avoid the conf_message() formatting buffer for this diagnostic so long > warning lists are not truncated before reaching the callback, 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 both olddefconfig > and savedefconfig. > > Signed-off-by: Pengpeng Hou > --- > Changes since v1: https://lore.kernel.org/all/20260406233001.1-kconfig-warn-changed-input-pengpeng@iscas.ac.cn/ > - rename "found" to "changed_input_found" as suggested by Nicolas > - avoid the conf_message() 4096-byte formatting buffer so long warning > lists are not truncated before the callback sees them > - mark each processed symbol as SYMBOL_WRITTEN before checking > SYMBOL_WRITE to avoid duplicate warnings for duplicate menu nodes > - add duplicate-definition selftest coverage > - do not carry the Reviewed-by/Tested-by tags because v2 changes warning > emission and duplicate suppression > > Documentation/kbuild/kconfig.rst | 5 + > scripts/kconfig/confdata.c | 107 +++++++++++++++++- > .../kconfig/tests/warn_changed_input/Kconfig | 40 +++++++ > .../tests/warn_changed_input/__init__.py | 27 +++++ > .../kconfig/tests/warn_changed_input/config | 3 + > .../tests/warn_changed_input/expected_config | 6 + > .../warn_changed_input/expected_defconfig | 1 + > .../tests/warn_changed_input/expected_stdout | 4 + > 8 files changed, 189 insertions(+), 4 deletions(-) > create mode 100644 scripts/kconfig/tests/warn_changed_input/Kconfig > create mode 100644 scripts/kconfig/tests/warn_changed_input/__init__.py > create mode 100644 scripts/kconfig/tests/warn_changed_input/config > create mode 100644 scripts/kconfig/tests/warn_changed_input/expected_config > create mode 100644 scripts/kconfig/tests/warn_changed_input/expected_defconfig > create mode 100644 scripts/kconfig/tests/warn_changed_input/expected_stdout > Thanks a lot! Tested-by: Nicolas Schier Reviewed-by: Nicolas Schier