1 commit ab0cc6067d5a00182e89fbec82b942eb3d803204
2 Author: Patrick Georgi <pgeorgi@google.com>
3 Date: Fri Nov 22 22:08:15 2019 +0100
5 util/kconfig: Allow emitting false booleans into kconfig output
7 This is controlled by an environment variable so the same tool is
8 useful in different contexts.
10 Change-Id: I9e62b05e45709f1539e455e2eed37308609be15e
11 Signed-off-by: Patrick Georgi <pgeorgi@google.com>
13 Index: kconfig/confdata.c
14 ===================================================================
15 --- kconfig.orig/confdata.c
16 +++ kconfig/confdata.c
17 @@ -731,7 +731,12 @@ static void print_symbol_for_dotconfig(F
19 static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
21 - __print_symbol(fp, sym, OUTPUT_N_NONE, false);
22 + int print_negatives = getenv("KCONFIG_NEGATIVES") != NULL;
23 + enum output_n out = OUTPUT_N_NONE;
24 + if (print_negatives) {
27 + __print_symbol(fp, sym, out, false);
30 void print_symbol_for_listconfig(struct symbol *sym)
31 @@ -756,6 +761,10 @@ static void print_symbol_for_c(FILE *fp,
35 + if (getenv("KCONFIG_NEGATIVES") != NULL) {
41 sym_suffix = "_MODULE";
42 @@ -767,6 +776,12 @@ static void print_symbol_for_c(FILE *fp,
44 if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X'))
48 + if (val[0] == '\0') {
54 escaped = escape_string_value(val);
55 @@ -1183,8 +1198,9 @@ static int __conf_write_autoconf(const c
57 conf_write_heading(file, comment_style);
59 + int print_negatives = getenv("KCONFIG_NEGATIVES") != NULL;
60 for_all_symbols(i, sym)
61 - if ((sym->flags & SYMBOL_WRITE) && sym->name)
62 + if (((sym->flags & SYMBOL_WRITE) || (print_negatives && sym->type != S_STRING)) && sym->name)
63 print_symbol(file, sym);