diff options
author | Daniel Friesel <dfriesel@uos.de> | 2022-05-23 12:50:04 +0000 |
---|---|---|
committer | Daniel Friesel <dfriesel@uos.de> | 2022-05-23 12:50:04 +0000 |
commit | f927c7054191c557c99bceae9599d97d42073616 (patch) | |
tree | 3ab12fa2676a3cf9b1dd977f56211e94e47bd782 /lib | |
parent | 70dd4eeb7ddab1ae69e176e44289bbf067f005f7 (diff) |
kconfig: give predictable names to unnamed choice nodes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/loader/kconfig.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/loader/kconfig.py b/lib/loader/kconfig.py index 80bdd21..575d617 100644 --- a/lib/loader/kconfig.py +++ b/lib/loader/kconfig.py @@ -56,14 +56,18 @@ class KConfigAttributes: ) ) - self.choice_names = sorted( - map(lambda choice: choice.name or choice.name_and_loc, kconf.choices) - ) + unnamed_choice_index = 0 + for choice in kconf.choices: + if choice.name is None: + choice.name = f"UNNAMED_CHOICE_{unnamed_choice_index}" + unnamed_choice_index += 1 + + self.choice_names = sorted(map(lambda choice: choice.name, kconf.choices)) self.choice = dict() self.choice_symbol_names = list() for choice in kconf.choices: - self.choice[choice.name or choice.name_and_loc] = choice + self.choice[choice.name] = choice self.choice_symbol_names.extend(map(lambda sym: sym.name, choice.syms)) self.symbol = dict() |