public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: linux-kernel@vger.kernel.org
Cc: Michal Marek <mmarek@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kbuild@vger.kernel.org
Subject: [PATCH] kconfig: print each first level disjunction block from a new line
Date: Thu, 21 Mar 2013 12:10:44 +0400	[thread overview]
Message-ID: <20130321081043.21073.38947.stgit@zurg> (raw)

This patch improves readability of complicated expressions.

before:
   Selected by: A && AA && AAA || B && BB && (BBB || BBBB) || C && CC && CCC

after:
   Selected by: A && AA && AAA
 || B && BB && (BBB || BBBB)
 || C && CC && CCC

Modules' config options usually comes first in these blocks.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
---
 scripts/kconfig/expr.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index d662652..e47eb28 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1087,9 +1087,15 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
 		fn(data, e->right.sym, e->right.sym->name);
 		break;
 	case E_OR:
-		expr_print(e->left.expr, fn, data, E_OR);
-		fn(data, NULL, " || ");
-		expr_print(e->right.expr, fn, data, E_OR);
+		if (prevtoken == E_NONE) {
+			expr_print(e->left.expr, fn, data, E_NONE);
+			fn(data, NULL, "\n|| ");
+			expr_print(e->right.expr, fn, data, E_NONE);
+		} else {
+			expr_print(e->left.expr, fn, data, E_OR);
+			fn(data, NULL, " || ");
+			expr_print(e->right.expr, fn, data, E_OR);
+		}
 		break;
 	case E_AND:
 		expr_print(e->left.expr, fn, data, E_AND);


                 reply	other threads:[~2013-03-21  8:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130321081043.21073.38947.stgit@zurg \
    --to=khlebnikov@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox