public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Eugeniu Rosca <roscaeugeniu@gmail.com>
To: Ulf Magnusson <ulfalizer@gmail.com>
Cc: Eugeniu Rosca <roscaeugeniu@gmail.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Petr Vorel <petr.vorel@gmail.com>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Paul Bolle <pebolle@tiscali.nl>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Eugeniu Rosca <erosca@de.adit-jv.com>
Subject: Re: [PATCH v3 3/3] kconfig: Print reverse dependencies in groups
Date: Sun, 18 Feb 2018 22:05:15 +0100	[thread overview]
Message-ID: <20180218210515.GA13612@example.com> (raw)
In-Reply-To: <CAFkk2KQ9FZOBULCRVR=8DJs7sPGfkp5Uv5COCGvUAsoVstPqTg@mail.gmail.com>

Hi Ulf,

Sometimes having so many options (all of them being equally clean,
simple and elegant) can make the choice really hard :D

Below is the interdiff between v3 and v4. Hopefully other people will
also like this series and we will see it in in some weeks. Thank you
very much for your support.

diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 48b99371d276..95dc058a236f 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1180,13 +1180,19 @@ struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
 }
 
 static void
-expr_print_newline(struct expr *e,
-		   void (*fn)(void *, struct symbol *, const char *),
-		   void *data,
-		   int prevtoken)
+expr_print_revdep(struct expr *e,
+		  void (*fn)(void *, struct symbol *, const char *),
+		  void *data,
+		  int prevtoken,
+		  enum print_type type)
 {
-	fn(data, NULL, "\n  - ");
-	expr_print(e, fn, data, prevtoken);
+	if (type == PRINT_REVDEP_ALL				  ||
+	    type == PRINT_REVDEP_YES && expr_calc_value(e) == yes ||
+	    type == PRINT_REVDEP_MOD && expr_calc_value(e) == mod ||
+	    type == PRINT_REVDEP_NO  && expr_calc_value(e) == no) {
+		fn(data, NULL, "\n  - ");
+		expr_print(e, fn, data, prevtoken);
+	}
 }
 
 static void
@@ -1211,21 +1217,10 @@ __expr_print(struct expr *e,
 				fn(data, e->left.sym, e->left.sym->name);
 				break;
 			case PRINT_REVDEP_ALL:
-				expr_print_newline(e, fn, data, E_OR);
-				break;
 			case PRINT_REVDEP_YES:
-				if (expr_calc_value(e) == yes)
-					expr_print_newline(e, fn, data, E_OR);
-				break;
 			case PRINT_REVDEP_MOD:
-				if (expr_calc_value(e) == mod)
-					expr_print_newline(e, fn, data, E_OR);
-				break;
 			case PRINT_REVDEP_NO:
-				if (expr_calc_value(e) == no)
-					expr_print_newline(e, fn, data, E_OR);
-				break;
-			default:
+				expr_print_revdep(e, fn, data, E_OR, type);
 				break;
 			}
 		else
@@ -1283,21 +1278,10 @@ __expr_print(struct expr *e,
 			expr_print(e->right.expr, fn, data, E_AND);
 			break;
 		case PRINT_REVDEP_ALL:
-			expr_print_newline(e, fn, data, E_OR);
-			break;
 		case PRINT_REVDEP_YES:
-			if (expr_calc_value(e) == yes)
-				expr_print_newline(e, fn, data, E_OR);
-			break;
 		case PRINT_REVDEP_MOD:
-			if (expr_calc_value(e) == mod)
-				expr_print_newline(e, fn, data, E_OR);
-			break;
 		case PRINT_REVDEP_NO:
-			if (expr_calc_value(e) == no)
-				expr_print_newline(e, fn, data, E_OR);
-			break;
-		default:
+			expr_print_revdep(e, fn, data, E_OR, type);
 			break;
 		}
 		break;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index d13ffa69d65b..029da77fe1b0 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -797,19 +797,19 @@ void get_revdep_by_type(struct expr *e, char *s, struct gstr *r)
 
 	if (expr_revdep_contains(e, yes)) {
 		str_append(r, s);
-		str_append(r, _(" [y]:"));
+		str_append(r, " [y]:");
 		expr_gstr_print_revdep(e, r, PRINT_REVDEP_YES);
 		str_append(r, "\n");
 	}
 	if (expr_revdep_contains(e, mod)) {
 		str_append(r, s);
-		str_append(r, _(" [m]:"));
+		str_append(r, " [m]:");
 		expr_gstr_print_revdep(e, r, PRINT_REVDEP_MOD);
 		str_append(r, "\n");
 	}
 	if (expr_revdep_contains(e, no)) {
 		str_append(r, s);
-		str_append(r, _(" [n]:"));
+		str_append(r, " [n]:");
 		expr_gstr_print_revdep(e, r, PRINT_REVDEP_NO);
 		str_append(r, "\n");
 	}


Best regards,
Eugeniu.

      reply	other threads:[~2018-02-18 21:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17  2:05 [PATCH v3 0/3] Print reverse dependencies in groups Eugeniu Rosca
2018-02-17  2:05 ` [PATCH v3 1/3] kconfig: Print reverse dependencies on new line consistently Eugeniu Rosca
2018-02-17 16:39   ` Ulf Magnusson
2018-02-17  2:05 ` [PATCH v3 2/3] kconfig: Prepare for printing reverse dependencies in groups Eugeniu Rosca
2018-02-17 16:44   ` Ulf Magnusson
2018-02-17  2:05 ` [PATCH v3 3/3] kconfig: Print " Eugeniu Rosca
2018-02-17 16:55   ` Ulf Magnusson
2018-02-18 11:07     ` Eugeniu Rosca
2018-02-18 13:02       ` Ulf Magnusson
2018-02-18 13:19         ` Ulf Magnusson
2018-02-18 13:35           ` Ulf Magnusson
2018-02-18 13:40             ` Ulf Magnusson
2018-02-18 21:05               ` Eugeniu Rosca [this message]

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=20180218210515.GA13612@example.com \
    --to=roscaeugeniu@gmail.com \
    --cc=erosca@de.adit-jv.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=pebolle@tiscali.nl \
    --cc=petr.vorel@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=ulfalizer@gmail.com \
    --cc=yamada.masahiro@socionext.com \
    /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