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, + ""); + 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);