[PATCH] kconfig: restore prompt dependencies in help text

From: Arvind Sankar
Date: Thu Jan 02 2020 - 18:14:09 EST


Commit bcdedcc1afd6 ("menuconfig: print more info for symbol without
prompts") moved some code from get_prompt_str to get_symbol_str so that
dependency information for symbols without prompts could be shown.

This code would be better copied rather than moved, as the change had
the side-effect of not showing any extra dependencies that the prompt
might have over the symbol.

Put back a copy of the dependency printing code in get_prompt_str.

The following is an example for NAMESPACES:

Before:
Symbol: NAMESPACES [=y]
Type : bool
Prompt: Namespaces support
Location:
(2) -> General setup
Defined at init/Kconfig:1064
Depends on: MULTIUSER [=y]

After:
Symbol: NAMESPACES [=y]
Type : bool
Prompt: Namespaces support
Editable if: MULTIUSER [=y] && EXPERT [=y]
Location:
(2) -> General setup
Defined at init/Kconfig:1064
Depends on: MULTIUSER [=y]

Fixes: bcdedcc1afd6 ("menuconfig: print more info for symbol without prompts")
Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
---
scripts/kconfig/menu.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index d9d16469859a..6fbbe41302dc 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -706,6 +706,12 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
struct jump_key *jump = NULL;

str_printf(r, "Prompt: %s\n", prop->text);
+ if (!expr_is_yes(prop->visible.expr)) {
+ str_append(r, " Editable if: ");
+ expr_gstr_print(prop->visible.expr, r);
+ str_append(r, "\n");
+ }
+
menu = prop->menu->parent;
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
bool accessible = menu_is_visible(menu);
--
2.24.1