From: Dmitry Selyutin Date: Wed, 1 Jun 2022 17:03:41 +0000 (+0000) Subject: sv_binutils: allow excluding enum values X-Git-Tag: sv_maxu_works-initial~402 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a02de76190d611f5779b76e52bcf58026ab292e7;p=openpower-isa.git sv_binutils: allow excluding enum values --- diff --git a/src/openpower/sv/sv_binutils.py b/src/openpower/sv/sv_binutils.py index bf348873..6ce8db19 100644 --- a/src/openpower/sv/sv_binutils.py +++ b/src/openpower/sv/sv_binutils.py @@ -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()}"