From f927c7054191c557c99bceae9599d97d42073616 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 23 May 2022 12:50:04 +0000 Subject: kconfig: give predictable names to unnamed choice nodes --- lib/loader/kconfig.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/loader') 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() -- cgit v1.2.3