diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index a3ac2c91331c..52a0ee0637e9 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -222,3 +222,8 @@ $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE $(call filechk,conf_cfg) clean-files += .*conf-cfg + +PHONY += symcheckconfig + +symcheckconfig: $(obj)/conf + $< $(silent) --$@ $(Kconfig) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 671ff5364497..1083ddcdd05e 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -33,6 +33,7 @@ enum input_mode { savedefconfig, listnewconfig, olddefconfig, + symcheckconfig, }; static enum input_mode input_mode = oldaskconfig; @@ -466,6 +467,7 @@ static struct option long_opts[] = { * value but not 'n') with the counter-intuitive name. */ {"oldnoconfig", no_argument, NULL, olddefconfig}, + {"symcheckconfig", no_argument, NULL, symcheckconfig}, {NULL, 0, NULL, 0} }; @@ -490,6 +492,31 @@ static void conf_usage(const char *progname) printf(" --randconfig New config with random answer to all options\n"); } +static void find_sym_dups(void) +{ + struct symbol *sym; + struct property *prop; + int i; + int cnt = 0; + char *file; + int lineno; + + for_all_symbols(i, sym) { + for_all_properties(sym, prop, P_SYMBOL) { + if (cnt == 1) { + printf("Duplicate symbol %s\n\t(%s:%d):\n", sym->name, file, lineno); + } + if (cnt) + printf("\t(%s:%d)\n", prop->file->name, prop->lineno); + + cnt += 1; + file = (char *)prop->file->name; + lineno = prop->lineno; + } + cnt = 0; + } +} + int main(int ac, char **av) { const char *progname = av[0]; @@ -560,6 +587,12 @@ int main(int ac, char **av) } name = av[optind]; conf_parse(name); + + if (input_mode == symcheckconfig) { + find_sym_dups(); + exit(0); + } + //zconfdump(stdout); if (sync_kconfig) { name = conf_get_configname();