util/kconfig: Uprev to Linux 6.8's kconfig

Linux kconfig has its own implementation of KCONFIG_WERROR now, so use
that. This reduces our patch count by 2.

Change-Id: I4f5f1f552e96f8ef7a4c5c0ab2ab7e2b6d798ceb
Signed-off-by: Patrick Georgi <patrick@georgi.software>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81223
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Georgi
2024-03-13 13:01:21 +01:00
committed by Felix Held
parent 96499840aa
commit 7761237dfe
21 changed files with 229 additions and 360 deletions

View File

@ -27,6 +27,14 @@ KCONFIG_DEFCONFIG_LIST += \
endif
KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)
ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),)
export KCONFIG_WARN_UNKNOWN_SYMBOLS=1
endif
ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),)
export KCONFIG_WERROR=1
endif
# We need this, in case the user has it in its environment
unexport CONFIG_
@ -99,7 +107,7 @@ config-fragments = $(call configfiles,$@)
%.config: $(obj)/conf
$(if $(config-fragments),, $(error $@ fragment does not exists on this architecture))
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(config-fragments)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m $(KCONFIG_CONFIG) $(config-fragments)
$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
PHONY += tinyconfig
@ -166,7 +174,7 @@ conf-objs := conf.o $(common-objs)
# nconf: Used for the nconfig target based on ncurses
hostprogs += nconf
nconf-objs := nconf.o nconf.gui.o $(common-objs)
nconf-objs := nconf.o nconf.gui.o mnconf-common.o $(common-objs)
HOSTLDLIBS_nconf = $(call read-file, $(obj)/nconf-libs)
HOSTCFLAGS_nconf.o = $(call read-file, $(obj)/nconf-cflags)
@ -179,7 +187,7 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: | $(obj)/nconf-cflags
hostprogs += mconf
lxdialog := $(addprefix lxdialog/, \
checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
mconf-objs := mconf.o $(lxdialog) $(common-objs)
mconf-objs := mconf.o $(lxdialog) mnconf-common.o $(common-objs)
HOSTLDLIBS_mconf = $(call read-file, $(obj)/mconf-libs)
$(foreach f, mconf.o $(lxdialog), \

View File

@ -827,6 +827,9 @@ int main(int ac, char **av)
break;
}
if (conf_errors())
exit(1);
if (sync_kconfig) {
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
@ -890,6 +893,9 @@ int main(int ac, char **av)
break;
}
if (sym_dep_errors())
exit(1);
if (input_mode == savedefconfig) {
if (conf_write_defconfig(defconfig_file)) {
fprintf(stderr, "\n*** Error while saving defconfig to: %s\n\n",

View File

@ -155,6 +155,13 @@ static void conf_message(const char *fmt, ...)
static const char *conf_filename;
static int conf_lineno, conf_warnings;
bool conf_errors(void)
{
if (conf_warnings)
return getenv("KCONFIG_WERROR");
return false;
}
#ifdef __MINGW32__
#define mkdir(_n,_p) mkdir((_n))
#endif
@ -310,16 +317,12 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
#define LINE_GROWTH 16
static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
{
char *nline;
size_t new_size = slen + 1;
if (new_size > *n) {
new_size += LINE_GROWTH - 1;
new_size *= 2;
nline = xrealloc(*lineptr, new_size);
if (!nline)
return -1;
*lineptr = nline;
*lineptr = xrealloc(*lineptr, new_size);
*n = new_size;
}
@ -362,19 +365,37 @@ e_out:
return -1;
}
/* like getline(), but the newline character is stripped away */
static ssize_t getline_stripped(char **lineptr, size_t *n, FILE *stream)
{
ssize_t len;
len = compat_getline(lineptr, n, stream);
if (len > 0 && (*lineptr)[len - 1] == '\n') {
len--;
(*lineptr)[len] = '\0';
if (len > 0 && (*lineptr)[len - 1] == '\r') {
len--;
(*lineptr)[len] = '\0';
}
}
return len;
}
int conf_read_simple(const char *name, int def)
{
FILE *in = NULL;
char *line = NULL;
size_t line_asize = 0;
char *p, *p2;
char *p, *val;
struct symbol *sym;
int i, def_flags;
const char *warn_unknown;
const char *werror;
const char *warn_unknown, *sym_name;
warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");
werror = getenv("KCONFIG_WERROR");
if (name) {
in = zconf_fopen(name);
} else {
@ -438,8 +459,7 @@ load:
case S_INT:
case S_HEX:
case S_STRING:
if (sym->def[def].val)
free(sym->def[def].val);
free(sym->def[def].val);
/* fall through */
default:
sym->def[def].val = NULL;
@ -447,90 +467,68 @@ load:
}
}
while (compat_getline(&line, &line_asize, in) != -1) {
while (getline_stripped(&line, &line_asize, in) != -1) {
conf_lineno++;
sym = NULL;
if (!line[0]) /* blank line */
continue;
if (line[0] == '#') {
if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
if (line[1] != ' ')
continue;
p = strchr(line + 2 + strlen(CONFIG_), ' ');
p = line + 2;
if (memcmp(p, CONFIG_, strlen(CONFIG_)))
continue;
sym_name = p + strlen(CONFIG_);
p = strchr(sym_name, ' ');
if (!p)
continue;
*p++ = 0;
if (strncmp(p, "is not set", 10))
if (strcmp(p, "is not set"))
continue;
if (def == S_DEF_USER) {
sym = sym_find(line + 2 + strlen(CONFIG_));
if (!sym) {
if (warn_unknown)
conf_warning("unknown symbol: %s",
line + 2 + strlen(CONFIG_));
conf_set_changed(true);
continue;
}
} else {
sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
if (sym->type == S_UNKNOWN)
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
conf_notice("override: reassigning to symbol %s", sym->name);
}
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
default:
;
}
} else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
p = strchr(line + strlen(CONFIG_), '=');
if (!p)
continue;
*p++ = 0;
p2 = strchr(p, '\n');
if (p2) {
*p2-- = 0;
if (*p2 == '\r')
*p2 = 0;
}
sym = sym_find(line + strlen(CONFIG_));
if (!sym) {
if (def == S_DEF_AUTO) {
/*
* Reading from include/config/auto.conf
* If CONFIG_FOO previously existed in
* auto.conf but it is missing now,
* include/config/FOO must be touched.
*/
conf_touch_dep(line + strlen(CONFIG_));
} else {
if (warn_unknown)
conf_warning("unknown symbol: %s",
line + strlen(CONFIG_));
conf_set_changed(true);
}
continue;
}
if (sym->flags & def_flags) {
conf_notice("override: reassigning to symbol %s", sym->name);
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
val = "n";
} else {
if (line[0] != '\r' && line[0] != '\n')
conf_warning("unexpected data: %.*s",
(int)strcspn(line, "\r\n"), line);
if (memcmp(line, CONFIG_, strlen(CONFIG_))) {
conf_warning("unexpected data: %s", line);
continue;
}
sym_name = line + strlen(CONFIG_);
p = strchr(sym_name, '=');
if (!p) {
conf_warning("unexpected data: %s", line);
continue;
}
*p = 0;
val = p + 1;
}
sym = sym_find(sym_name);
if (!sym) {
if (def == S_DEF_AUTO) {
/*
* Reading from include/config/auto.conf.
* If CONFIG_FOO previously existed in auto.conf
* but it is missing now, include/config/FOO
* must be touched.
*/
conf_touch_dep(sym_name);
} else {
if (warn_unknown)
conf_warning("unknown symbol: %s", sym_name);
conf_set_changed(true);
}
continue;
}
if (sym->flags & def_flags)
conf_notice("override: reassigning to symbol %s", sym->name);
if (conf_set_sym_val(sym, def, def_flags, val))
continue;
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->def[def].tri) {
@ -554,11 +552,6 @@ load:
free(line);
fclose(in);
if (conf_warnings && werror) {
fprintf(stderr, "\nERROR: %d warnings encountered, and warnings are errors.\n\n", conf_warnings);
exit(1);
}
return 0;
}
@ -617,7 +610,7 @@ int conf_read(const char *name)
/* Reset a string value if it's out of range */
if (sym_string_within_range(sym, sym->def[S_DEF_USER].val))
break;
sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
sym->flags &= ~SYMBOL_VALID;
conf_unsaved++;
break;
default:

View File

@ -1131,7 +1131,6 @@ static int expr_compare_type(enum expr_type t1, enum expr_type t2)
default:
return -1;
}
printf("[%dgt%d?]", t1, t2);
return 0;
}

View File

@ -100,8 +100,6 @@ bool menu_is_visible(struct menu *menu);
bool menu_has_prompt(struct menu *menu);
const char *menu_get_prompt(struct menu *menu);
struct menu *menu_get_parent_menu(struct menu *menu);
bool menu_has_help(struct menu *menu);
const char *menu_get_help(struct menu *menu);
int get_jump_key_char(void);
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
void menu_get_ext_help(struct menu *menu, struct gstr *help);

View File

@ -1,4 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LKC_PROTO_H
#define LKC_PROTO_H
#include <stdarg.h>
/* confdata.c */
@ -12,6 +15,7 @@ void conf_set_changed(bool val);
bool conf_get_changed(void);
void conf_set_changed_callback(void (*fn)(void));
void conf_set_message_callback(void (*fn)(const char *s));
bool conf_errors(void);
/* symbol.c */
extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
@ -22,6 +26,7 @@ void print_symbol_for_listconfig(struct symbol *sym);
struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type);
void sym_calc_value(struct symbol *sym);
bool sym_dep_errors(void);
enum symbol_type sym_get_type(struct symbol *sym);
bool sym_tristate_within_range(struct symbol *sym,tristate tri);
bool sym_set_tristate_value(struct symbol *sym,tristate tri);
@ -50,3 +55,5 @@ char *expand_one_token(const char **str);
/* expr.c */
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);
#endif /* LKC_PROTO_H */

View File

@ -21,6 +21,7 @@
#include "lkc.h"
#include "lxdialog/dialog.h"
#include "mnconf-common.h"
static const char mconf_readme[] =
"Overview\n"
@ -247,7 +248,7 @@ search_help[] =
" -> PCI support (PCI [=y])\n"
"(1) -> PCI access mode (<choice> [=y])\n"
" Defined at drivers/pci/Kconfig:47\n"
" Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
" Depends on: X86_LOCAL_APIC && X86_IO_APIC\n"
" Selects: LIBCRC32\n"
" Selected by: BAR [=n]\n"
"-----------------------------------------------------------------\n"
@ -286,7 +287,6 @@ static int single_menu_mode;
static int show_all_options;
static int save_and_exit;
static int silent;
static int jump_key_char;
static void conf(struct menu *menu, struct menu *active_menu);
@ -378,58 +378,6 @@ static void show_help(struct menu *menu)
str_free(&help);
}
struct search_data {
struct list_head *head;
struct menu *target;
};
static int next_jump_key(int key)
{
if (key < '1' || key > '9')
return '1';
key++;
if (key > '9')
key = '1';
return key;
}
static int handle_search_keys(int key, size_t start, size_t end, void *_data)
{
struct search_data *data = _data;
struct jump_key *pos;
int index = 0;
if (key < '1' || key > '9')
return 0;
list_for_each_entry(pos, data->head, entries) {
index = next_jump_key(index);
if (pos->offset < start)
continue;
if (pos->offset >= end)
break;
if (key == index) {
data->target = pos->target;
return 1;
}
}
return 0;
}
int get_jump_key_char(void)
{
jump_key_char = next_jump_key(jump_key_char);
return jump_key_char;
}
static void search_conf(void)
{
struct symbol **sym_arr;

View File

@ -673,19 +673,6 @@ struct menu *menu_get_parent_menu(struct menu *menu)
return menu;
}
bool menu_has_help(struct menu *menu)
{
return menu->help != NULL;
}
const char *menu_get_help(struct menu *menu)
{
if (menu->help)
return menu->help;
else
return "";
}
static void get_def_str(struct gstr *r, struct menu *menu)
{
str_printf(r, "Defined at %s:%d\n",
@ -856,10 +843,10 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
struct symbol *sym = menu->sym;
const char *help_text = nohelp_text;
if (menu_has_help(menu)) {
if (menu->help) {
if (sym->name)
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
help_text = menu_get_help(menu);
help_text = menu->help;
}
str_printf(help, "%s\n", help_text);
if (sym)

View File

@ -0,0 +1,53 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "expr.h"
#include "list.h"
#include "mnconf-common.h"
int jump_key_char;
int next_jump_key(int key)
{
if (key < '1' || key > '9')
return '1';
key++;
if (key > '9')
key = '1';
return key;
}
int handle_search_keys(int key, size_t start, size_t end, void *_data)
{
struct search_data *data = _data;
struct jump_key *pos;
int index = 0;
if (key < '1' || key > '9')
return 0;
list_for_each_entry(pos, data->head, entries) {
index = next_jump_key(index);
if (pos->offset < start)
continue;
if (pos->offset >= end)
break;
if (key == index) {
data->target = pos->target;
return 1;
}
}
return 0;
}
int get_jump_key_char(void)
{
jump_key_char = next_jump_key(jump_key_char);
return jump_key_char;
}

View File

@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef MNCONF_COMMON_H
#define MNCONF_COMMON_H
#include <stddef.h>
struct search_data {
struct list_head *head;
struct menu *target;
};
extern int jump_key_char;
int next_jump_key(int key);
int handle_search_keys(int key, size_t start, size_t end, void *_data);
int get_jump_key_char(void);
#endif /* MNCONF_COMMON_H */

View File

@ -12,6 +12,7 @@
#include <stdlib.h>
#include "lkc.h"
#include "mnconf-common.h"
#include "nconf.h"
#include <ctype.h>
@ -216,7 +217,7 @@ search_help[] =
"Symbol: FOO [ = m]\n"
"Prompt: Foo bus is used to drive the bar HW\n"
"Defined at drivers/pci/Kconfig:47\n"
"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
"Depends on: X86_LOCAL_APIC && X86_IO_APIC\n"
"Location:\n"
" -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
" -> PCI support (PCI [ = y])\n"
@ -279,7 +280,6 @@ static const char *current_instructions = menu_instructions;
static char *dialog_input_result;
static int dialog_input_result_len;
static int jump_key_char;
static void selected_conf(struct menu *menu, struct menu *active_menu);
static void conf(struct menu *menu);
@ -691,57 +691,6 @@ static int do_exit(void)
return 0;
}
struct search_data {
struct list_head *head;
struct menu *target;
};
static int next_jump_key(int key)
{
if (key < '1' || key > '9')
return '1';
key++;
if (key > '9')
key = '1';
return key;
}
static int handle_search_keys(int key, size_t start, size_t end, void *_data)
{
struct search_data *data = _data;
struct jump_key *pos;
int index = 0;
if (key < '1' || key > '9')
return 0;
list_for_each_entry(pos, data->head, entries) {
index = next_jump_key(index);
if (pos->offset < start)
continue;
if (pos->offset >= end)
break;
if (key == index) {
data->target = pos->target;
return 1;
}
}
return 0;
}
int get_jump_key_char(void)
{
jump_key_char = next_jump_key(jump_key_char);
return jump_key_char;
}
static void search_conf(void)
{

View File

@ -1,18 +0,0 @@
Make KCONFIG_WERROR more verbose.
Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -533,8 +533,10 @@ load:
free(line);
fclose(in);
- if (conf_warnings && werror)
+ if (conf_warnings && werror) {
+ fprintf(stderr, "\nERROR: %d warnings encountered, and warnings are errors.\n\n", conf_warnings);
exit(1);
+ }
return 0;
}

View File

@ -23,7 +23,7 @@ Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -166,6 +166,16 @@ static void conf_warning(const char *fmt
@@ -173,6 +173,16 @@ static void conf_warning(const char *fmt
conf_warnings++;
}
@ -40,25 +40,16 @@ Index: kconfig/confdata.c
static void conf_default_message_callback(const char *s)
{
printf("#\n# ");
@@ -454,7 +464,7 @@ load:
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
- conf_warning("override: reassigning to symbol %s", sym->name);
+ conf_notice("override: reassigning to symbol %s", sym->name);
}
switch (sym->type) {
case S_BOOLEAN:
@@ -498,7 +508,7 @@ load:
}
@@ -503,7 +513,7 @@ load:
}
if (sym->flags & def_flags) {
- conf_warning("override: reassigning to symbol %s", sym->name);
+ conf_notice("override: reassigning to symbol %s", sym->name);
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
@@ -523,7 +533,7 @@ load:
if (sym->flags & def_flags)
- conf_warning("override: reassigning to symbol %s", sym->name);
+ conf_notice("override: reassigning to symbol %s", sym->name);
if (conf_set_sym_val(sym, def, def_flags, val))
continue;
@@ -521,7 +531,7 @@ load:
break;
case yes:
if (cs->def[def].tri != no)

View File

@ -14,7 +14,7 @@ Index: kconfig/conf.c
===================================================================
--- kconfig.orig/conf.c
+++ kconfig/conf.c
@@ -892,7 +892,7 @@ int main(int ac, char **av)
@@ -898,7 +898,7 @@ int main(int ac, char **av)
if (input_mode == savedefconfig) {
if (conf_write_defconfig(defconfig_file)) {

View File

@ -15,9 +15,9 @@ Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -155,6 +155,10 @@ static void conf_message(const char *fmt
static const char *conf_filename;
static int conf_lineno, conf_warnings;
@@ -162,6 +162,10 @@ bool conf_errors(void)
return false;
}
+#ifdef __MINGW32__
+#define mkdir(_n,_p) mkdir((_n))

View File

@ -1,71 +0,0 @@
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Patrick Georgi <pgeorgi@google.com>, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Stefan Reinauer <reinauer@google.com>
Subject: [PATCH] kconfig: WERROR unmet symbol dependency
Date: Wed, 22 Nov 2023 12:47:45 +0900
Message-ID: <20231122034753.1446513-1-senozhatsky@chromium.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
When KCONFIG_WERROR env variable is set treat unmet direct
symbol dependency as a terminal condition (error).
Suggested-by: Stefan Reinauer <reinauer@google.com>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
scripts/kconfig/symbol.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: kconfig/symbol.c
===================================================================
--- kconfig.orig/symbol.c
+++ kconfig/symbol.c
@@ -37,6 +37,7 @@ static struct symbol symbol_empty = {
struct symbol *modules_sym;
static tristate modules_val;
+static int sym_warnings;
enum symbol_type sym_get_type(struct symbol *sym)
{
@@ -317,12 +318,14 @@ static void sym_warn_unmet_dep(struct sy
" Selected by [m]:\n");
fputs(str_get(&gs), stderr);
+ sym_warnings++;
}
void sym_calc_value(struct symbol *sym)
{
struct symbol_value newval, oldval;
struct property *prop;
+ const char *werror;
struct expr *e;
if (!sym)
@@ -338,8 +341,9 @@ void sym_calc_value(struct symbol *sym)
sym_calc_value(prop_get_symbol(prop));
}
+ werror = getenv("KCONFIG_WERROR");
+ sym_warnings = 0;
sym->flags |= SYMBOL_VALID;
-
oldval = sym->curr;
switch (sym->type) {
@@ -430,6 +434,9 @@ void sym_calc_value(struct symbol *sym)
;
}
+ if (sym_warnings && werror)
+ exit(1);
+
sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym);

View File

@ -14,7 +14,7 @@ Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -738,7 +738,12 @@ static void print_symbol_for_dotconfig(F
@@ -731,7 +731,12 @@ static void print_symbol_for_dotconfig(F
static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
{
@ -28,7 +28,7 @@ Index: kconfig/confdata.c
}
void print_symbol_for_listconfig(struct symbol *sym)
@@ -763,6 +768,10 @@ static void print_symbol_for_c(FILE *fp,
@@ -756,6 +761,10 @@ static void print_symbol_for_c(FILE *fp,
case S_TRISTATE:
switch (*val) {
case 'n':
@ -39,7 +39,7 @@ Index: kconfig/confdata.c
return;
case 'm':
sym_suffix = "_MODULE";
@@ -774,6 +783,12 @@ static void print_symbol_for_c(FILE *fp,
@@ -767,6 +776,12 @@ static void print_symbol_for_c(FILE *fp,
case S_HEX:
if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X'))
val_prefix = "0x";
@ -52,7 +52,7 @@ Index: kconfig/confdata.c
break;
case S_STRING:
escaped = escape_string_value(val);
@@ -1190,8 +1205,9 @@ static int __conf_write_autoconf(const c
@@ -1183,8 +1198,9 @@ static int __conf_write_autoconf(const c
conf_write_heading(file, comment_style);

View File

@ -21,7 +21,7 @@ Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -237,6 +237,13 @@ static const char *conf_get_rustccfg_nam
@@ -244,6 +244,13 @@ static const char *conf_get_rustccfg_nam
return name ? name : "include/generated/rustc_cfg";
}
@ -35,7 +35,7 @@ Index: kconfig/confdata.c
static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
{
char *p2;
@@ -1106,19 +1113,19 @@ static int conf_write_autoconf_cmd(const
@@ -1099,19 +1106,19 @@ static int conf_write_autoconf_cmd(const
static int conf_touch_deps(void)
{

View File

@ -1,9 +1,7 @@
0001-Kconfig-Add-KCONFIG_STRICT-mode.patch
0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch
0003-util-kconfig-conf.c-Fix-newline-in-error-printf.patch
0004-src-util-Use-NULL-instead-of-0-for-pointer.patch
0006-util-kconfig-Set-parameter-of-mkdir-to-only-one-for-.patch
0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch
0008-kconfig-Add-wildcard-support-for-source.patch
0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch
0010-reenable-source-in-choice.patch

View File

@ -29,12 +29,6 @@ struct symbol symbol_no = {
.flags = SYMBOL_CONST|SYMBOL_VALID,
};
static struct symbol symbol_empty = {
.name = "",
.curr = { "", no },
.flags = SYMBOL_VALID,
};
struct symbol *modules_sym;
static tristate modules_val;
static int sym_warnings;
@ -321,11 +315,17 @@ static void sym_warn_unmet_dep(struct symbol *sym)
sym_warnings++;
}
bool sym_dep_errors(void)
{
if (sym_warnings)
return getenv("KCONFIG_WERROR");
return false;
}
void sym_calc_value(struct symbol *sym)
{
struct symbol_value newval, oldval;
struct property *prop;
const char *werror;
struct expr *e;
if (!sym)
@ -341,20 +341,25 @@ void sym_calc_value(struct symbol *sym)
sym_calc_value(prop_get_symbol(prop));
}
werror = getenv("KCONFIG_WERROR");
sym_warnings = 0;
sym->flags |= SYMBOL_VALID;
oldval = sym->curr;
newval.tri = no;
switch (sym->type) {
case S_INT:
newval.val = "0";
break;
case S_HEX:
newval.val = "0x0";
break;
case S_STRING:
newval = symbol_empty.curr;
newval.val = "";
break;
case S_BOOLEAN:
case S_TRISTATE:
newval = symbol_no.curr;
newval.val = "n";
break;
default:
sym->curr.val = sym->name;
@ -434,9 +439,6 @@ void sym_calc_value(struct symbol *sym)
;
}
if (sym_warnings && werror)
exit(1);
sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym);
@ -704,13 +706,12 @@ const char *sym_get_string_default(struct symbol *sym)
{
struct property *prop;
struct symbol *ds;
const char *str;
const char *str = "";
tristate val;
sym_calc_visibility(sym);
sym_calc_value(modules_sym);
val = symbol_no.curr.tri;
str = symbol_empty.curr.val;
/* If symbol has a default value look it up */
prop = sym_get_default_prop(sym);
@ -760,14 +761,17 @@ const char *sym_get_string_default(struct symbol *sym)
case yes: return "y";
}
case S_INT:
if (!str[0])
str = "0";
break;
case S_HEX:
return str;
case S_STRING:
return str;
case S_UNKNOWN:
if (!str[0])
str = "0x0";
break;
default:
break;
}
return "";
return str;
}
const char *sym_get_string_value(struct symbol *sym)

View File

@ -42,8 +42,7 @@ struct gstr str_new(void)
/* Free storage for growable string */
void str_free(struct gstr *gs)
{
if (gs->s)
free(gs->s);
free(gs->s);
gs->s = NULL;
gs->len = 0;
}