intel/genxml: Handle field names with different spacing/hyphen
authorJordan Justen <jordan.l.justen@intel.com>
Thu, 17 Aug 2017 01:19:39 +0000 (18:19 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Wed, 28 Aug 2019 20:38:28 +0000 (13:38 -0700)
If a field name differs slightly between two generations then this
change will still add the fields into the same group.

For example, these will be treated as equal:
* "Software Exception" and "Software  Exception"
* "Per Thread" and "Per-Thread"

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/genxml/gen_bits_header.py

index 8c87edb2e5554a4fdcadfee12e92208237badd2b..6dd0d7c6b75890dbbde7f83f7ff822ab0cb7dd30 100644 (file)
@@ -182,12 +182,13 @@ class Container(object):
             self.length_by_gen[gen] = xml_attrs['length']
 
     def get_field(self, field_name, create=False):
-        if field_name not in self.fields:
+        key = to_alphanum(field_name)
+        if key not in self.fields:
             if create:
-                self.fields[field_name] = Field(self, field_name)
+                self.fields[key] = Field(self, field_name)
             else:
                 return None
-        return self.fields[field_name]
+        return self.fields[key]
 
     def has_prop(self, prop):
         if prop == 'length':