Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: warn about leading whitespace for menu prompts

Kconfig does its own indentation of menu prompts, so warn about and ignore
leading whitespace. Remove also a few unnecessary newlines after other
warning prints.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

authored by

Roman Zippel and committed by
Sam Ravnborg
f001f7f8 b65a47e1

+10 -6
+10 -6
scripts/kconfig/menu.c
··· 114 114 sym->type = type; 115 115 return; 116 116 } 117 - menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", 117 + menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'", 118 118 sym->name ? sym->name : "<choice>", 119 119 sym_type_name(sym->type), sym_type_name(type)); 120 120 } ··· 124 124 struct property *prop = prop_alloc(type, current_entry->sym); 125 125 126 126 prop->menu = current_entry; 127 - prop->text = prompt; 128 127 prop->expr = expr; 129 128 prop->visible.expr = menu_check_dep(dep); 130 129 131 130 if (prompt) { 131 + if (isspace(*prompt)) { 132 + prop_warn(prop, "leading whitespace ignored"); 133 + while (isspace(*prompt)) 134 + prompt++; 135 + } 132 136 if (current_entry->prompt) 133 - menu_warn(current_entry, "prompt redefined\n"); 137 + prop_warn(prop, "prompt redefined"); 134 138 current_entry->prompt = prop; 135 139 } 140 + prop->text = prompt; 136 141 137 142 return prop; 138 143 } ··· 348 343 349 344 if (sym && !(sym->flags & SYMBOL_WARNED)) { 350 345 if (sym->type == S_UNKNOWN) 351 - menu_warn(parent, "config symbol defined " 352 - "without type\n"); 346 + menu_warn(parent, "config symbol defined without type"); 353 347 354 348 if (sym_is_choice(sym) && !parent->prompt) 355 - menu_warn(parent, "choice must have a prompt\n"); 349 + menu_warn(parent, "choice must have a prompt"); 356 350 357 351 /* Check properties connected to this symbol */ 358 352 sym_check_prop(sym);