sv_binutils: allow excluding enum values
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 1 Jun 2022 17:03:41 +0000 (17:03 +0000)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 1 Jun 2022 17:39:53 +0000 (17:39 +0000)
src/openpower/sv/sv_binutils.py

index bf348873e91ca9004e726a2e1ddf83aa4011401b..6ce8db196cf31a49812b14475551c552ae2bdf52 100644 (file)
@@ -135,12 +135,15 @@ class Void(CType, typedef="void"):
 
 
 class EnumMeta(_enum.EnumMeta, CTypeMeta):
-    def __call__(metacls, name, entries, tag=None, **kwargs):
+    def __call__(metacls, name, entries, tag=None, exclude=None, **kwargs):
+        if exclude is None:
+            exclude = frozenset()
         if isinstance(entries, type) and issubclass(entries, _enum.Enum):
             # Use __members__, not __iter__, otherwise aliases are lost.
             entries = dict(entries.__members__)
         if isinstance(entries, dict):
             entries = tuple(entries.items())
+        entries = ((key, value) for (key, value) in entries if key not in exclude)
         if tag is None:
             tag = f"svp64_{name.lower()}"