kconfig: Warn if help text is blank
authorUlf Magnusson <ulfalizer@gmail.com>
Wed, 31 Jan 2018 09:34:30 +0000 (10:34 +0100)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 10 Feb 2019 20:56:06 +0000 (21:56 +0100)
Blank help texts are probably either a typo, a Kconfig misunderstanding,
or some kind of half-committing to adding a help text (in which case a
TODO comment would be clearer, if the help text really can't be added
right away).

Best to flag them, IMO.

Example warning:

drivers/mmc/host/Kconfig:877: warning: 'MMC_TOSHIBA_PCI' defined with blank help text

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/zconf.y

index 1aa9859726b365f732787d54d350d560c8a94f1a..02c8550147e5694a0b6773ae587f51bc18626bc1 100644 (file)
@@ -436,6 +436,12 @@ help: help_start T_HELPTEXT
                zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
                           current_entry->sym->name ?: "<choice>");
        }
                zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
                           current_entry->sym->name ?: "<choice>");
        }
+
+       /* Is the help text empty or all whitespace? */
+       if ($2[strspn($2, " \f\n\r\t\v")] == '\0')
+               zconfprint("warning: '%s' defined with blank help text",
+                          current_entry->sym->name ?: "<choice>");
+
        current_entry->help = $2;
 };
 
        current_entry->help = $2;
 };