Skip to content

Commit

Permalink
kconfig: Warn if there is more than one help text
Browse files Browse the repository at this point in the history
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 561b29e ("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 <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
ulfalizer authored and masahir0y committed Jan 21, 2018
1 parent b92d804 commit 6479f32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/kconfig/zconf.y
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?: "<choice>");
}
current_entry->help = $2;
};

Expand Down

0 comments on commit 6479f32

Please sign in to comment.