Re: [PATCH v3 3/3] kconfig: Print reverse dependencies in groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux