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

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: turn defaults and additional prompt for choice members into error

menu_finalize() warns default properties for choice members and prompts
outside the choice block. These should be hard errors.

While I was here, I moved the checks to slim down menu_finalize().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+40 -10
-10
scripts/kconfig/menu.c
··· 507 507 menu->sym && !sym_is_choice_value(menu->sym)) { 508 508 current_entry = menu; 509 509 menu->sym->flags |= SYMBOL_CHOICEVAL; 510 - for (prop = menu->sym->prop; prop; prop = prop->next) { 511 - if (prop->type == P_DEFAULT) 512 - prop_warn(prop, "defaults for choice " 513 - "values not supported"); 514 - if (prop->menu == menu) 515 - continue; 516 - if (prop->type == P_PROMPT && 517 - prop->menu->parent->sym != sym) 518 - prop_warn(prop, "choice value used outside its choice group"); 519 - } 520 510 /* Non-tristate choice values of tristate choices must 521 511 * depend on the choice being set to Y. The choice 522 512 * values' dependencies were propagated to their
+40
scripts/kconfig/parser.y
··· 476 476 477 477 %% 478 478 479 + /** 480 + * choice_check_sanity - check sanity of a choice member 481 + * 482 + * @menu: menu of the choice member 483 + * 484 + * Return: -1 if an error is found, 0 otherwise. 485 + */ 486 + static int choice_check_sanity(struct menu *menu) 487 + { 488 + struct property *prop; 489 + int ret = 0; 490 + 491 + for (prop = menu->sym->prop; prop; prop = prop->next) { 492 + if (prop->type == P_DEFAULT) { 493 + fprintf(stderr, "%s:%d: error: %s", 494 + prop->filename, prop->lineno, 495 + "defaults for choice values not supported\n"); 496 + ret = -1; 497 + } 498 + 499 + if (prop->menu != menu && prop->type == P_PROMPT && 500 + prop->menu->parent != menu->parent) { 501 + fprintf(stderr, "%s:%d: error: %s", 502 + prop->filename, prop->lineno, 503 + "choice value has a prompt outside its choice group\n"); 504 + ret = -1; 505 + } 506 + } 507 + 508 + return ret; 509 + } 510 + 479 511 void conf_parse(const char *name) 480 512 { 481 513 struct menu *menu; ··· 555 523 menu_finalize(); 556 524 557 525 menu_for_each_entry(menu) { 526 + struct menu *child; 527 + 558 528 if (menu->sym && sym_check_deps(menu->sym)) 559 529 yynerrs++; 530 + 531 + if (menu->sym && sym_is_choice(menu->sym)) { 532 + menu_for_each_sub_entry(child, menu) 533 + if (child->sym && choice_check_sanity(child)) 534 + yynerrs++; 535 + } 560 536 } 561 537 562 538 if (yynerrs)