summaryrefslogtreecommitdiff
path: root/util/kconfig/patches/0001-Kconfig-Add-KCONFIG_STRICT-mode.patch
blob: 9e50eb39a12c7a2f4a2d31c28e3d96bf2806d10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From c822f47921feb53b97f48f3aa8d1e843f5099c63 Mon Sep 17 00:00:00 2001
From: Stefan Reinauer <stefan.reinauer@coreboot.org>
Date: Fri, 17 Jul 2015 17:26:48 -0700
Subject: [PATCH] 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.

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
---
 util/kconfig/confdata.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -437,6 +437,7 @@ load:
 			if (def == S_DEF_USER) {
 				sym = sym_find(line + 2 + strlen(CONFIG_));
 				if (!sym) {
+					conf_warning("trying to assign non-existent symbol %s", line + strlen(CONFIG_));
 					conf_set_changed(true);
 					continue;
 				}
@@ -519,6 +520,13 @@ load:
 	}
 	free(line);
 	fclose(in);
+
+	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;
 }