Skip to content

Commit 15d3f76

Browse files
sergey-senozhatskymasahir0y
authored andcommitted
kconfig: WERROR unmet symbol dependency
When KCONFIG_WERROR env variable is set treat unmet direct symbol dependency as a terminal condition (error). Suggested-by: Stefan Reinauer <[email protected]> Signed-off-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 5a602de commit 15d3f76

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

scripts/kconfig/conf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,9 @@ int main(int ac, char **av)
827827
break;
828828
}
829829

830+
if (conf_errors())
831+
exit(1);
832+
830833
if (sync_kconfig) {
831834
name = getenv("KCONFIG_NOSILENTUPDATE");
832835
if (name && *name) {
@@ -890,6 +893,9 @@ int main(int ac, char **av)
890893
break;
891894
}
892895

896+
if (sym_dep_errors())
897+
exit(1);
898+
893899
if (input_mode == savedefconfig) {
894900
if (conf_write_defconfig(defconfig_file)) {
895901
fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",

scripts/kconfig/confdata.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ static void conf_message(const char *fmt, ...)
155155
static const char *conf_filename;
156156
static int conf_lineno, conf_warnings;
157157

158+
bool conf_errors(void)
159+
{
160+
if (conf_warnings)
161+
return getenv("KCONFIG_WERROR");
162+
return false;
163+
}
164+
158165
static void conf_warning(const char *fmt, ...)
159166
{
160167
va_list ap;
@@ -365,10 +372,9 @@ int conf_read_simple(const char *name, int def)
365372
char *p, *val;
366373
struct symbol *sym;
367374
int i, def_flags;
368-
const char *warn_unknown, *werror, *sym_name;
375+
const char *warn_unknown, *sym_name;
369376

370377
warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");
371-
werror = getenv("KCONFIG_WERROR");
372378
if (name) {
373379
in = zconf_fopen(name);
374380
} else {
@@ -525,9 +531,6 @@ int conf_read_simple(const char *name, int def)
525531
free(line);
526532
fclose(in);
527533

528-
if (conf_warnings && werror)
529-
exit(1);
530-
531534
return 0;
532535
}
533536

scripts/kconfig/lkc_proto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ void conf_set_changed(bool val);
1515
bool conf_get_changed(void);
1616
void conf_set_changed_callback(void (*fn)(void));
1717
void conf_set_message_callback(void (*fn)(const char *s));
18+
bool conf_errors(void);
1819

1920
/* symbol.c */
2021
extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
@@ -25,6 +26,7 @@ void print_symbol_for_listconfig(struct symbol *sym);
2526
struct symbol ** sym_re_search(const char *pattern);
2627
const char * sym_type_name(enum symbol_type type);
2728
void sym_calc_value(struct symbol *sym);
29+
bool sym_dep_errors(void);
2830
enum symbol_type sym_get_type(struct symbol *sym);
2931
bool sym_tristate_within_range(struct symbol *sym,tristate tri);
3032
bool sym_set_tristate_value(struct symbol *sym,tristate tri);

scripts/kconfig/symbol.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct symbol symbol_no = {
3131

3232
struct symbol *modules_sym;
3333
static tristate modules_val;
34+
static int sym_warnings;
3435

3536
enum symbol_type sym_get_type(struct symbol *sym)
3637
{
@@ -311,6 +312,14 @@ static void sym_warn_unmet_dep(struct symbol *sym)
311312
" Selected by [m]:\n");
312313

313314
fputs(str_get(&gs), stderr);
315+
sym_warnings++;
316+
}
317+
318+
bool sym_dep_errors(void)
319+
{
320+
if (sym_warnings)
321+
return getenv("KCONFIG_WERROR");
322+
return false;
314323
}
315324

316325
void sym_calc_value(struct symbol *sym)

0 commit comments

Comments
 (0)