| 283 | } |
| 284 | |
| 285 | void menu_finalize(struct menu *parent) |
| 286 | { |
| 287 | struct menu *menu, *last_menu; |
| 288 | struct symbol *sym; |
| 289 | struct property *prop; |
| 290 | struct expr *parentdep, *basedep, *dep, *dep2, **ep; |
| 291 | |
| 292 | sym = parent->sym; |
| 293 | if (parent->list) { |
| 294 | /* |
| 295 | * This menu node has children. We (recursively) process them |
| 296 | * and propagate parent dependencies before moving on. |
| 297 | */ |
| 298 | |
| 299 | if (sym && sym_is_choice(sym)) { |
| 300 | if (sym->type == S_UNKNOWN) { |
| 301 | /* find the first choice value to find out choice type */ |
| 302 | current_entry = parent; |
| 303 | for (menu = parent->list; menu; menu = menu->next) { |
| 304 | if (menu->sym && menu->sym->type != S_UNKNOWN) { |
| 305 | menu_set_type(menu->sym->type); |
| 306 | break; |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | /* set the type of the remaining choice values */ |
| 311 | for (menu = parent->list; menu; menu = menu->next) { |
| 312 | current_entry = menu; |
| 313 | if (menu->sym && menu->sym->type == S_UNKNOWN) |
| 314 | menu_set_type(sym->type); |
| 315 | } |
| 316 | |
| 317 | /* |
| 318 | * Use the choice itself as the parent dependency of |
| 319 | * the contained items. This turns the mode of the |
| 320 | * choice into an upper bound on the visibility of the |
| 321 | * choice value symbols. |
| 322 | */ |
| 323 | parentdep = expr_alloc_symbol(sym); |
| 324 | } else { |
| 325 | /* Menu node for 'menu', 'if' */ |
| 326 | parentdep = parent->dep; |
| 327 | } |
| 328 | |
| 329 | /* For each child menu node... */ |
| 330 | for (menu = parent->list; menu; menu = menu->next) { |
| 331 | /* |
| 332 | * Propagate parent dependencies to the child menu |
| 333 | * node, also rewriting and simplifying expressions |
| 334 | */ |
| 335 | basedep = rewrite_m(menu->dep); |
| 336 | basedep = expr_transform(basedep); |
| 337 | basedep = expr_alloc_and(expr_copy(parentdep), basedep); |
| 338 | basedep = expr_eliminate_dups(basedep); |
| 339 | menu->dep = basedep; |
| 340 | |
| 341 | if (menu->sym) |
| 342 | /* |
no test coverage detected