intel/genxml: Convert a not-present-or-"1" dict to a set.
authorEric Anholt <eric@anholt.net>
Fri, 8 Sep 2017 22:30:00 +0000 (15:30 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 26 Sep 2017 21:50:29 +0000 (14:50 -0700)
I was implementing the same enum support in broadcom's gen_pack_header.py,
and did this same simplification there.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/genxml/gen_pack_header.py

index 9021f008a823990a4c060660db448636c3721adf..405f600174d2491771f693eed2fe17e2ff96b5a3 100644 (file)
@@ -493,7 +493,8 @@ class Parser(object):
 
         self.instruction = None
         self.structs = {}
-        self.enums = {}
+        # Set of enum names we've seen.
+        self.enums = set()
         self.registers = {}
 
     def gen_prefix(self, name):
@@ -540,7 +541,7 @@ class Parser(object):
         elif name == "enum":
             self.values = []
             self.enum = safe_name(attrs["name"])
-            self.enums[attrs["name"]] = 1
+            self.enums.add(attrs["name"])
             if "prefix" in attrs:
                 self.prefix = safe_name(attrs["prefix"])
             else: