Kconfig: Add KCONFIG_STRICT mode

This is basically a -Werror mode for Kconfig. When exporting
KCONFIG_STRICT in the Makefile, warnings in Kconfig will produce
errors instead.

This will make it easier to spot unclean Kconfig files, settings
and dependencies.

Change-Id: I941af24c3ccb10b8b9ddc5c98327154749ebbbc6
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/10977
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Stefan Reinauer 2015-07-17 17:26:48 -07:00 committed by Patrick Georgi
parent eb5f45ac62
commit f534203f06
1 changed files with 8 additions and 0 deletions

View File

@ -358,6 +358,7 @@ load:
if (def == S_DEF_USER) { if (def == S_DEF_USER) {
sym = sym_find(line + strlen(CONFIG_)); sym = sym_find(line + strlen(CONFIG_));
if (!sym) { if (!sym) {
conf_warning("trying to assign non-existent symbol %s", line + strlen(CONFIG_));
sym_add_change_count(1); sym_add_change_count(1);
goto setsym; goto setsym;
} }
@ -402,6 +403,13 @@ setsym:
if (modules_sym) if (modules_sym)
sym_calc_value(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;
}
return 0; return 0;
} }