Re: [RFC][PATCH] kconfig: introduce listunknownconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On (23/08/20 16:21), Sergey Senozhatsky wrote:
> What the preferred approach would be? Do we want a new KCONFIG_FOO env
> variable that changes behaviour of one of the targets? E.g.
> 
> 	KCONFIG_LIST_MISSING=1 make oldconfig
> 
> and then have conf list symbols and terminate with exit(1) if there are
> some unrecognized symbols?


Will something like this be OK with you?


 KCONFIG_LIST_MISSING=1 make oldconfig

.config:6:warning: unknown symbol: DISABLE_BUGS
.config:7:warning: unknown unset symbol: ENABLE_WINAPI

make[2]: *** [scripts/kconfig/Makefile:77: oldconfig] Error 1


---

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index fa2ae6f63352..b2c0bcf0e5c1 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -360,7 +360,9 @@ int conf_read_simple(const char *name, int def)
        char *p, *p2;
        struct symbol *sym;
        int i, def_flags;
+       const char *list_missing;
 
+       list_missing = getenv("KCONFIG_LIST_MISSING");
        if (name) {
                in = zconf_fopen(name);
        } else {
@@ -448,6 +450,12 @@ int conf_read_simple(const char *name, int def)
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 2 + strlen(CONFIG_));
                                if (!sym) {
+                                       if (list_missing) {
+                                               conf_warning("unknown unset symbol: %s",
+                                                            line + 2 + strlen(CONFIG_));
+                                               continue;
+                                       }
+
                                        conf_set_changed(true);
                                        continue;
                                }
@@ -482,6 +490,12 @@ int conf_read_simple(const char *name, int def)
 
                        sym = sym_find(line + strlen(CONFIG_));
                        if (!sym) {
+                               if (list_missing) {
+                                       conf_warning("unknown symbol: %s",
+                                                    line + strlen(CONFIG_));
+                                       continue;
+                               }
+
                                if (def == S_DEF_AUTO)
                                        /*
                                         * Reading from include/config/auto.conf
@@ -530,6 +544,13 @@ int conf_read_simple(const char *name, int def)
        }
        free(line);
        fclose(in);
+
+       if (list_missing) {
+               if (conf_warnings)
+                       exit(1);
+               exit(0);
+       }
+
        return 0;
 }



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux