Re: [PATCH] kconfig: add dependency warning print about invalid values in verbose mode

From: Sergey Senozhatsky
Date: Wed Aug 23 2023 - 20:53:28 EST


On (23/08/24 06:52), Masahiro Yamada wrote:
> On Wed, Aug 23, 2023 at 10:56 AM Sergey Senozhatsky
> <senozhatsky@xxxxxxxxxxxx> wrote:
> >
> > On (23/08/19 22:40), Jesse T wrote:
> > > > > From: Ying Sun <sunying@xxxxxxxxxxxxxx>
> > > > >
> > > > > Add warning about the configuration option's invalid value in verbose mode,
> > > > > including error causes, mismatch dependency, old and new values,
> > > > > to help users correct them.
> >
> > Are those really errors?
> >
> > ERROR : CLANG_VERSION[140006 => 0] value is invalid due to it has default value
> > ERROR : CC_IS_GCC[n => y] value is invalid due to it has default value
> > ERROR : GCC_VERSION[0 => 120200] value is invalid due to it has default value
> >
> > I'm using clang, so corresponding options are set accordingly in my .config
>
>
> I think not errors, but warnings.

I agree.

Masahiro, do we really need "list missing" to be blocked on this?
This patch has been posted on Aug 8 and there was not much progress
since then. Can we, perhaps, move "list missing" forward?


---
scripts/kconfig/confdata.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index fa2ae6f63352..bf6d473755aa 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -360,7 +360,10 @@ int conf_read_simple(const char *name, int def)
char *p, *p2;
struct symbol *sym;
int i, def_flags;
+ bool missing = false;
+ const char *sanity_checks;

+ sanity_checks = getenv("KCONFIG_SANITY_CHECKS");
if (name) {
in = zconf_fopen(name);
} else {
@@ -448,6 +451,13 @@ int conf_read_simple(const char *name, int def)
if (def == S_DEF_USER) {
sym = sym_find(line + 2 + strlen(CONFIG_));
if (!sym) {
+ if (sanity_checks) {
+ conf_warning("unknown symbol: %s",
+ line + 2 + strlen(CONFIG_));
+ missing = true;
+ continue;
+ }
+
conf_set_changed(true);
continue;
}
@@ -482,6 +492,13 @@ int conf_read_simple(const char *name, int def)

sym = sym_find(line + strlen(CONFIG_));
if (!sym) {
+ if (sanity_checks && def != S_DEF_AUTO) {
+ conf_warning("unknown symbol: %s",
+ line + strlen(CONFIG_));
+ missing = true;
+ continue;
+ }
+
if (def == S_DEF_AUTO)
/*
* Reading from include/config/auto.conf
@@ -530,6 +547,10 @@ int conf_read_simple(const char *name, int def)
}
free(line);
fclose(in);
+
+ if (missing)
+ exit(1);
+
return 0;
}

--
2.42.0.rc1.204.g551eb34607-goog