All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Petr Vorel <petr.vorel@gmail.com>, Paul Bolle <pebolle@tiscali.nl>
Cc: linux-kbuild@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH 1/1] [RFC] kconfig: menuconfig make "Selected by:" readable
Date: Mon, 26 Oct 2015 21:21:41 +0100	[thread overview]
Message-ID: <562E8B55.1030607@suse.cz> (raw)
In-Reply-To: <1442257543-6194-2-git-send-email-petr.vorel@gmail.com>

Dne 14.9.2015 v 21:05 Petr Vorel napsal(a):
> From: Paul Bolle <pebolle@tiscali.nl>
> 
> rev_dep expressions can get rather unwieldy, especially if a symbol is
> selected by more than a handful of other symbols. Ie, it's possible to
> have near endless expressions like:
>    A && B && !C || D || F && (G || H) || [...]
> 
> Chop these expressions into actually readable chunks:
>    - A && B && !C
>    - D
>    - F && (G || H)
>    - [...]
> 
> Ie, transform the top level "||" tokens into newlines and prepend each
> line with a minus. This makes the "Selected by:" blurb much easier to
> read.
> ---
> Today I found myself wondering why a certain Kconfig was selected.
> Currently menuconfig's help is of no use in complicated cases. Please
> look at the help of USB or CRYPTO to see what I mean.
> 
> This is a _hack_ to show what might be a better way to do this. It
> parses a stringified version of the reverse dependency, and not the
> actual reverse dependecy expression. But that was easier to cobble
> together.
> 
> One cool improvement would be to change to minus in front of the
> subexpressions to Y or M for those that actually set the symbol. Anyhow,
> other suggestions and feedback is welcome.
> 
> Not-yet-signed-off-by: Paul Bolle <pebolle@tiscali.nl>
> Tested-by: Petr Vorel <petr.vorel@gmail.com>
> Cc: Paul Bolle <pebolle@tiscali.nl>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: Petr Vorel <petr.vorel@gmail.com>
> ---
>  scripts/kconfig/menu.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 81 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index b05cc3d..a8b37a2 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -613,6 +613,86 @@ static struct property *get_symbol_prop(struct symbol *sym)
>  }
>  
>  /*
> + * Assuming we're just past an opening parenthesis in a NUL terminated string,
> + * find it's closing parenthesis and return its postion. Die otherwise.
> + */
> +static const char *matching_paren(const char *s)
> +{
> +	int lvl = 1;
> +
> +	while (1) {
> +		if (*s == '(')
> +			lvl++;
> +		else if (*s == ')')
> +			lvl--;
> +		if (lvl == 0)
> +			break;
> +		if (*s == '\0')
> +			/* huh? */
> +			exit(1);

assert/abort?

BTW, the whole splitting can be done in a singe loop a-la

while (c = s++) {
	if (c == '(')
		lvl++;
	else if (c == ')')
		lvl--;
	else if (c == '|' && lvl == 0)
		/* insert newline and indent */
	/* output c */
}

No need to seek back and forth in the string.


> -		expr_gstr_print(sym->rev_dep.expr, r);
> -		str_append(r, "\n");
> +		rev_dep_gstr_print(sym->rev_dep.expr, r);

... and a cleaner fix would be to patch the printer, instead of
generating a string representation and converting it.

Michal


  parent reply	other threads:[~2015-10-26 20:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 19:05 [PATCH 0/1] [RFC] kconfig: menuconfig make "Selected by:" readable Petr Vorel
2015-09-14 19:05 ` [PATCH 1/1] " Petr Vorel
2015-09-18 20:32   ` Paul Bolle
2015-10-26 20:21   ` Michal Marek [this message]
2015-10-28  8:26     ` Paul Bolle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562E8B55.1030607@suse.cz \
    --to=mmarek@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=petr.vorel@gmail.com \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.