From de3ef10fa54afb6f4006ccfb204db4d9ebcf5145 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Tue, 19 Apr 2022 22:46:15 +0000 Subject: [PATCH] sv_binutils: integrate c_typedef into base metaclass --- src/openpower/sv/sv_binutils.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/openpower/sv/sv_binutils.py b/src/openpower/sv/sv_binutils.py index 6b0a9776..bae6aa20 100644 --- a/src/openpower/sv/sv_binutils.py +++ b/src/openpower/sv/sv_binutils.py @@ -33,6 +33,16 @@ def indent(strings): class CTypeMeta(type): + def __new__(metacls, name, bases, attrs, typedef=None): + cls = super().__new__(metacls, name, bases, attrs) + cls.__typedef = typedef + + return cls + + @property + def c_typedef(cls): + return cls.__typedef + @_abc.abstractmethod def c_decl(cls): pass @@ -145,16 +155,6 @@ class Struct(CType, metaclass=StructMeta): class IntegerMeta(CTypeMeta): - def __new__(metacls, name, bases, attrs, typedef=None): - cls = super().__new__(metacls, name, bases, attrs) - cls.__typedef = typedef - - return cls - - @property - def c_typedef(cls): - return cls.__typedef - def c_decl(cls): yield "#include " -- 2.30.2