From 16fabd50462a49c120d8c2ac3a25828a409c5b83 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Fri, 12 Jan 2018 07:47:47 +0100 Subject: [PATCH] kconfig: Warn if there is more than one help text Avoids mistakes like in the following real-world example, where only the final help string ("Say Y...") was used. This particular example was fixed in commit 561b29e4ec8d ("media: fix media Kconfig help syntax issues"). config DVB_NETUP_UNIDVB ... select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT ---help--- Support for NetUP PCI express Universal DVB card. help Say Y when you want to support NetUP Dual Universal DVB card ... This now prints the following warning: drivers/media/pci/netup_unidvb:13: warning: 'DVB_NETUP_UNIDVB' defined with more than one help text -- only the last one will be used Also free() any extra help strings. Signed-off-by: Ulf Magnusson Signed-off-by: Masahiro Yamada Signed-off-by: Christian Lamparter --- config/zconf.y | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/zconf.y b/config/zconf.y index f2b9744..4dad8e5 100644 --- a/config/zconf.y +++ b/config/zconf.y @@ -431,6 +431,11 @@ help_start: T_HELP T_EOL help: help_start T_HELPTEXT { + if (current_entry->help) { + free(current_entry->help); + zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used", + current_entry->sym->name ?: ""); + } current_entry->help = $2; }; -- 2.31.1