Re: [PATCH 06/16] kconfig: refactor choice value calculation

From: kernel test robot
Date: Tue Jun 11 2024 - 23:07:38 EST


Hi Masahiro,

kernel test robot noticed the following build errors:

[auto build test ERROR on masahiroy-kbuild/kbuild]
[also build test ERROR on masahiroy-kbuild/for-next next-20240611]
[cannot apply to masahiroy-kbuild/fixes linus/master v6.10-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/kconfig-remove-unneeded-code-in-expr_compare_type/20240612-020202
base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kbuild
patch link: https://lore.kernel.org/r/20240611175536.3518179-7-masahiroy%40kernel.org
patch subject: [PATCH 06/16] kconfig: refactor choice value calculation
config: i386-buildonly-randconfig-002-20240612 (attached as .config)
compiler: gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240612/202406121008.8zFuX4VH-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406121008.8zFuX4VH-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

scripts/kconfig/symbol.c: In function 'sym_calc_value':
>> scripts/kconfig/symbol.c:448:3: error: a label can only be part of a statement and a declaration is not a statement
struct menu *choice_menu = sym_get_choice_menu(sym);
^~~~~~
make[3]: *** [scripts/Makefile.host:133: scripts/kconfig/symbol.o] Error 1 shuffle=1413228972
make[3]: Target 'oldconfig' not remade because of errors.
make[2]: *** [Makefile:695: oldconfig] Error 2 shuffle=1413228972
make[1]: *** [Makefile:240: __sub-make] Error 2 shuffle=1413228972
make[1]: Target 'oldconfig' not remade because of errors.
make: *** [Makefile:240: __sub-make] Error 2 shuffle=1413228972
make: Target 'oldconfig' not remade because of errors.
--
scripts/kconfig/symbol.c: In function 'sym_calc_value':
>> scripts/kconfig/symbol.c:448:3: error: a label can only be part of a statement and a declaration is not a statement
struct menu *choice_menu = sym_get_choice_menu(sym);
^~~~~~
make[3]: *** [scripts/Makefile.host:133: scripts/kconfig/symbol.o] Error 1 shuffle=1413228972
make[3]: Target 'olddefconfig' not remade because of errors.
make[2]: *** [Makefile:695: olddefconfig] Error 2 shuffle=1413228972
make[1]: *** [Makefile:240: __sub-make] Error 2 shuffle=1413228972
make[1]: Target 'olddefconfig' not remade because of errors.
make: *** [Makefile:240: __sub-make] Error 2 shuffle=1413228972
make: Target 'olddefconfig' not remade because of errors.


vim +448 scripts/kconfig/symbol.c

398
399 void sym_calc_value(struct symbol *sym)
400 {
401 struct symbol_value newval, oldval;
402 struct property *prop;
403
404 if (!sym)
405 return;
406
407 if (sym->flags & SYMBOL_VALID)
408 return;
409
410 sym->flags |= SYMBOL_VALID;
411
412 oldval = sym->curr;
413
414 newval.tri = no;
415
416 switch (sym->type) {
417 case S_INT:
418 newval.val = "0";
419 break;
420 case S_HEX:
421 newval.val = "0x0";
422 break;
423 case S_STRING:
424 newval.val = "";
425 break;
426 case S_BOOLEAN:
427 case S_TRISTATE:
428 newval.val = "n";
429 break;
430 default:
431 sym->curr.val = sym->name;
432 sym->curr.tri = no;
433 return;
434 }
435 sym->flags &= ~SYMBOL_WRITE;
436
437 sym_calc_visibility(sym);
438
439 if (sym->visible != no)
440 sym->flags |= SYMBOL_WRITE;
441
442 /* set default if recursively called */
443 sym->curr = newval;
444
445 switch (sym_get_type(sym)) {
446 case S_BOOLEAN:
447 case S_TRISTATE:
> 448 struct menu *choice_menu = sym_get_choice_menu(sym);
449
450 if (choice_menu) {
451 sym_calc_choice(choice_menu);
452 newval.tri = sym->curr.tri;
453 } else {
454 if (sym->visible != no) {
455 /* if the symbol is visible use the user value
456 * if available, otherwise try the default value
457 */
458 if (sym_has_value(sym)) {
459 newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
460 sym->visible);
461 goto calc_newval;
462 }
463 }
464 if (sym->rev_dep.tri != no)
465 sym->flags |= SYMBOL_WRITE;
466 if (!sym_is_choice(sym)) {
467 prop = sym_get_default_prop(sym);
468 if (prop) {
469 newval.tri = EXPR_AND(expr_calc_value(prop->expr),
470 prop->visible.tri);
471 if (newval.tri != no)
472 sym->flags |= SYMBOL_WRITE;
473 }
474 if (sym->implied.tri != no) {
475 sym->flags |= SYMBOL_WRITE;
476 newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
477 newval.tri = EXPR_AND(newval.tri,
478 sym->dir_dep.tri);
479 }
480 }
481 calc_newval:
482 if (sym->dir_dep.tri < sym->rev_dep.tri)
483 sym_warn_unmet_dep(sym);
484 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
485 }
486 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
487 newval.tri = yes;
488 break;
489 case S_STRING:
490 case S_HEX:
491 case S_INT:
492 if (sym->visible != no && sym_has_value(sym)) {
493 newval.val = sym->def[S_DEF_USER].val;
494 break;
495 }
496 prop = sym_get_default_prop(sym);
497 if (prop) {
498 struct symbol *ds = prop_get_symbol(prop);
499 if (ds) {
500 sym->flags |= SYMBOL_WRITE;
501 sym_calc_value(ds);
502 newval.val = ds->curr.val;
503 }
504 }
505 break;
506 default:
507 ;
508 }
509
510 sym->curr = newval;
511 sym_validate_range(sym);
512
513 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
514 sym_set_changed(sym);
515 if (modules_sym == sym) {
516 sym_set_all_changed();
517 modules_val = modules_sym->curr.tri;
518 }
519 }
520
521 if (sym_is_choice(sym))
522 sym->flags &= ~SYMBOL_WRITE;
523 }
524

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki