diff options
author | Stefan Reinauer <reinauer@chromium.org> | 2015-08-20 11:19:34 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-09-30 06:58:57 +0000 |
commit | 57a31317a26ff5f55638c4f3dd8d06b8a69b78f2 (patch) | |
tree | c8ac4862f908bf51f2bab03b80f6c34e8e0874f9 /util | |
parent | 588ad7b5db26a88dad36e2dbecf5a4242d8410be (diff) |
kconfig: Allow KCONFIG_STRICT outside of confdata.c
To catch dependency errors in symbol.c (such as the ones
fixed by I51b4ee326f082c6a656a813ee5772e9c34f5c343) we need
to check for global kconfig warnings before saving config
files.
This patch will produce errors for wrong dependencies and
add catching of errors to conf, nconf and mconf. Sorry,
gconf users, you will have to wait.
Change-Id: Idf7ee406ce3869941af319219aea16fab826df84
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/11291
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/kconfig/conf.c | 10 | ||||
-rw-r--r-- | util/kconfig/confdata.c | 6 | ||||
-rw-r--r-- | util/kconfig/lkc.h | 3 | ||||
-rw-r--r-- | util/kconfig/mconf.c | 8 | ||||
-rw-r--r-- | util/kconfig/nconf.c | 11 | ||||
-rw-r--r-- | util/kconfig/symbol.c | 1 |
6 files changed, 34 insertions, 5 deletions
diff --git a/util/kconfig/conf.c b/util/kconfig/conf.c index fef75fc756..c421773114 100644 --- a/util/kconfig/conf.c +++ b/util/kconfig/conf.c @@ -17,6 +17,8 @@ #include "lkc.h" +int kconfig_warnings = 0; + static void conf(struct menu *menu); static void check_conf(struct menu *menu); static void xfgets(char *str, int size, FILE *in); @@ -493,6 +495,7 @@ int main(int ac, char **av) const char *progname = av[0]; int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; + char *env; struct stat tmpstat; setlocale(LC_ALL, ""); @@ -681,6 +684,13 @@ int main(int ac, char **av) break; } + env = getenv("KCONFIG_STRICT"); + if (env && *env && kconfig_warnings) { + fprintf(stderr, _("\n*** ERROR: %d warnings encountered, and " + "warnings are errors.\n\n"), kconfig_warnings); + exit(1); + } + if (sync_kconfig) { /* silentoldconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. diff --git a/util/kconfig/confdata.c b/util/kconfig/confdata.c index 5804b29faa..a39a716f79 100644 --- a/util/kconfig/confdata.c +++ b/util/kconfig/confdata.c @@ -404,11 +404,7 @@ setsym: if (modules_sym) sym_calc_value(modules_sym); - name = getenv("KCONFIG_STRICT"); - if (name && *name && conf_warnings) { - fprintf(stderr, "\nERROR: %d warnings encountered, and warnings are errors.\n\n", conf_warnings); - return 1; - } + kconfig_warnings += conf_warnings; return 0; } diff --git a/util/kconfig/lkc.h b/util/kconfig/lkc.h index 590ed80cec..a7600bd7cb 100644 --- a/util/kconfig/lkc.h +++ b/util/kconfig/lkc.h @@ -82,6 +82,9 @@ void zconf_nextfiles(const char *name); int zconf_lineno(void); const char *zconf_curname(void); +/* conf.c */ +extern int kconfig_warnings; + /* confdata.c */ const char *conf_get_configname(void); const char *conf_get_autoconfig_name(void); diff --git a/util/kconfig/mconf.c b/util/kconfig/mconf.c index 1d651c1382..b4a08440af 100644 --- a/util/kconfig/mconf.c +++ b/util/kconfig/mconf.c @@ -952,6 +952,7 @@ static void conf_save(void) static int handle_exit(void) { int res; + char *env; save_and_exit = 1; reset_subtitle(); @@ -966,6 +967,13 @@ static int handle_exit(void) end_dialog(saved_x, saved_y); + env = getenv("KCONFIG_STRICT"); + if (env && *env && kconfig_warnings) { + fprintf(stderr, _("\n*** ERROR: %d warnings encountered, and " + "warnings are errors.\n\n"), kconfig_warnings); + res = 2; + } + switch (res) { case 0: if (conf_write(filename)) { diff --git a/util/kconfig/nconf.c b/util/kconfig/nconf.c index 984489ef2b..bc845fc6fc 100644 --- a/util/kconfig/nconf.c +++ b/util/kconfig/nconf.c @@ -646,6 +646,8 @@ static const char *set_config_filename(const char *config_filename) static int do_exit(void) { int res; + char *env; + if (!conf_get_changed()) { global_exit = 1; return 0; @@ -661,6 +663,15 @@ static int do_exit(void) return -1; } + env = getenv("KCONFIG_STRICT"); + if (env && *env && kconfig_warnings) { + btn_dialog(main_window, + _("\nWarnings encountered, and warnings are errors.\n\n"), + 1, + "<OK>"); + res = 2; + } + /* if we got here, the user really wants to exit */ switch (res) { case 0: diff --git a/util/kconfig/symbol.c b/util/kconfig/symbol.c index 7caabdb51c..65ba46543f 100644 --- a/util/kconfig/symbol.c +++ b/util/kconfig/symbol.c @@ -375,6 +375,7 @@ void sym_calc_value(struct symbol *sym) sym->name); expr_fprint(sym->dir_dep.expr, stderr); fprintf(stderr, ")\n"); + kconfig_warnings++; expr_free(e); } newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); |